import{s as An,A as Dn,o as On,n as rt}from"../chunks/scheduler.01eeda35.js";import{S as Kn,i as eo,g as c,s as o,r as u,A as to,h as d,f as t,c as r,j as w,u as f,x as y,k as B,y as a,a as l,v as g,d as h,t as _,w as b}from"../chunks/index.6dd51b66.js";import{T as Yn}from"../chunks/Tip.de9bae2b.js";import{D as j}from"../chunks/Docstring.cb556860.js";import{C as qt}from"../chunks/CodeBlock.19ec9b8c.js";import{E as Zt}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as G,E as no}from"../chunks/index.58fe8f9d.js";function oo(x){let i,I="Example:",p,m,v;return m=new qt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBJbnN0cnVjdEJsaXBWaXNpb25Db25maWclMkMlMEElMjAlMjAlMjAlMjBJbnN0cnVjdEJsaXBRRm9ybWVyQ29uZmlnJTJDJTBBJTIwJTIwJTIwJTIwT1BUQ29uZmlnJTJDJTBBJTIwJTIwJTIwJTIwSW5zdHJ1Y3RCbGlwQ29uZmlnJTJDJTBBJTIwJTIwJTIwJTIwSW5zdHJ1Y3RCbGlwRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTBBKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBJbnN0cnVjdEJsaXBDb25maWclMjB3aXRoJTIwU2FsZXNmb3JjZSUyRmluc3RydWN0LWJsaXAtZmxhbi10NSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBJbnN0cnVjdEJsaXBDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBJbnN0cnVjdEJsaXBGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMFNhbGVzZm9yY2UlMkZpbnN0cnVjdC1ibGlwLWZsYW4tdDUlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEluc3RydWN0QmxpcEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWclMEElMEElMjMlMjBXZSUyMGNhbiUyMGFsc28lMjBpbml0aWFsaXplJTIwYSUyMEluc3RydWN0QmxpcENvbmZpZyUyMGZyb20lMjBhJTIwSW5zdHJ1Y3RCbGlwVmlzaW9uQ29uZmlnJTJDJTIwSW5zdHJ1Y3RCbGlwUUZvcm1lckNvbmZpZyUyMGFuZCUyMGFueSUyMFByZXRyYWluZWRDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBJbnN0cnVjdEJMSVAlMjB2aXNpb24lMkMlMjBJbnN0cnVjdEJMSVAlMjBRLUZvcm1lciUyMGFuZCUyMGxhbmd1YWdlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9ucyUwQXZpc2lvbl9jb25maWclMjAlM0QlMjBJbnN0cnVjdEJsaXBWaXNpb25Db25maWcoKSUwQXFmb3JtZXJfY29uZmlnJTIwJTNEJTIwSW5zdHJ1Y3RCbGlwUUZvcm1lckNvbmZpZygpJTBBdGV4dF9jb25maWclMjAlM0QlMjBPUFRDb25maWcoKSUwQSUwQWNvbmZpZyUyMCUzRCUyMEluc3RydWN0QmxpcENvbmZpZy5mcm9tX3RleHRfdmlzaW9uX2NvbmZpZ3ModmlzaW9uX2NvbmZpZyUyQyUyMHFmb3JtZXJfY29uZmlnJTJDJTIwdGV4dF9jb25maWcp",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>    InstructBlipVisionConfig,
<span class="hljs-meta">... </span>    InstructBlipQFormerConfig,
<span class="hljs-meta">... </span>    OPTConfig,
<span class="hljs-meta">... </span>    InstructBlipConfig,
<span class="hljs-meta">... </span>    InstructBlipForConditionalGeneration,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a InstructBlipConfig with Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = InstructBlipConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a InstructBlipForConditionalGeneration (with random weights) from the Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = InstructBlipForConditionalGeneration(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 InstructBlipConfig from a InstructBlipVisionConfig, InstructBlipQFormerConfig and any PretrainedConfig</span>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>config = InstructBlipConfig.from_text_vision_configs(vision_config, qformer_config, text_config)`,wrap:!1}}),{c(){i=c("p"),i.textContent=I,p=o(),u(m.$$.fragment)},l(s){i=d(s,"P",{"data-svelte-h":!0}),y(i)!=="svelte-11lpom8"&&(i.textContent=I),p=r(s),f(m.$$.fragment,s)},m(s,M){l(s,i,M),l(s,p,M),g(m,s,M),v=!0},p:rt,i(s){v||(h(m.$$.fragment,s),v=!0)},o(s){_(m.$$.fragment,s),v=!1},d(s){s&&(t(i),t(p)),b(m,s)}}}function ro(x){let i,I="Example:",p,m,v;return m=new qt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEluc3RydWN0QmxpcFZpc2lvbkNvbmZpZyUyQyUyMEluc3RydWN0QmxpcFZpc2lvbk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEluc3RydWN0QmxpcFZpc2lvbkNvbmZpZyUyMHdpdGglMjBTYWxlc2ZvcmNlJTJGaW5zdHJ1Y3QtYmxpcC1mbGFuLXQ1JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEluc3RydWN0QmxpcFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMEluc3RydWN0QmxpcFZpc2lvbk1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBTYWxlc2ZvcmNlJTJGaW5zdHJ1Y3QtYmxpcC1mbGFuLXQ1JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBJbnN0cnVjdEJsaXBWaXNpb25Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> InstructBlipVisionConfig, InstructBlipVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a InstructBlipVisionConfig with Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = InstructBlipVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a InstructBlipVisionModel (with random weights) from the Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = InstructBlipVisionModel(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(){i=c("p"),i.textContent=I,p=o(),u(m.$$.fragment)},l(s){i=d(s,"P",{"data-svelte-h":!0}),y(i)!=="svelte-11lpom8"&&(i.textContent=I),p=r(s),f(m.$$.fragment,s)},m(s,M){l(s,i,M),l(s,p,M),g(m,s,M),v=!0},p:rt,i(s){v||(h(m.$$.fragment,s),v=!0)},o(s){_(m.$$.fragment,s),v=!1},d(s){s&&(t(i),t(p)),b(m,s)}}}function so(x){let i,I="Examples:",p,m,v;return m=new qt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEluc3RydWN0QmxpcFFGb3JtZXJDb25maWclMkMlMjBJbnN0cnVjdEJsaXBRRm9ybWVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwSW5zdHJ1Y3RCTElQJTIwU2FsZXNmb3JjZSUyRmluc3RydWN0LWJsaXAtZmxhbi10NSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBJbnN0cnVjdEJsaXBRRm9ybWVyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMFNhbGVzZm9yY2UlMkZpbnN0cnVjdC1ibGlwLWZsYW4tdDUlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEluc3RydWN0QmxpcFFGb3JtZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> InstructBlipQFormerConfig, InstructBlipQFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a InstructBLIP Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = InstructBlipQFormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the Salesforce/instruct-blip-flan-t5 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = InstructBlipQFormerModel(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(){i=c("p"),i.textContent=I,p=o(),u(m.$$.fragment)},l(s){i=d(s,"P",{"data-svelte-h":!0}),y(i)!=="svelte-kvfsh7"&&(i.textContent=I),p=r(s),f(m.$$.fragment,s)},m(s,M){l(s,i,M),l(s,p,M),g(m,s,M),v=!0},p:rt,i(s){v||(h(m.$$.fragment,s),v=!0)},o(s){_(m.$$.fragment,s),v=!1},d(s){s&&(t(i),t(p)),b(m,s)}}}function ao(x){let i,I=`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(){i=c("p"),i.innerHTML=I},l(p){i=d(p,"P",{"data-svelte-h":!0}),y(i)!=="svelte-fincs2"&&(i.innerHTML=I)},m(p,m){l(p,i,m)},p:rt,d(p){p&&t(i)}}}function io(x){let i,I=`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(){i=c("p"),i.innerHTML=I},l(p){i=d(p,"P",{"data-svelte-h":!0}),y(i)!=="svelte-fincs2"&&(i.innerHTML=I)},m(p,m){l(p,i,m)},p:rt,d(p){p&&t(i)}}}function lo(x){let i,I="Examples:",p,m,v;return m=new qt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEluc3RydWN0QmxpcFByb2Nlc3NvciUyQyUyMEluc3RydWN0QmxpcEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFtb2RlbCUyMCUzRCUyMEluc3RydWN0QmxpcEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyU2FsZXNmb3JjZSUyRmluc3RydWN0YmxpcC12aWN1bmEtN2IlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwSW5zdHJ1Y3RCbGlwUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGaW5zdHJ1Y3RibGlwLXZpY3VuYS03YiUyMiklMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQW1vZGVsLnRvKGRldmljZSklMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZzYWxlc2ZvcmNlJTJGTEFWSVMlMkZtYWluJTJGZG9jcyUyRl9zdGF0aWMlMkZDb25mdXNpbmctUGljdHVyZXMuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQXByb21wdCUyMCUzRCUyMCUyMldoYXQlMjBpcyUyMHVudXN1YWwlMjBhYm91dCUyMHRoaXMlMjBpbWFnZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHRleHQlM0Rwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhkZXZpY2UpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCUwQSUyMCUyMCUyMCUyMCoqaW5wdXRzJTJDJTBBJTIwJTIwJTIwJTIwZG9fc2FtcGxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBudW1fYmVhbXMlM0Q1JTJDJTBBJTIwJTIwJTIwJTIwbWF4X2xlbmd0aCUzRDI1NiUyQyUwQSUyMCUyMCUyMCUyMG1pbl9sZW5ndGglM0QxJTJDJTBBJTIwJTIwJTIwJTIwdG9wX3AlM0QwLjklMkMlMEElMjAlMjAlMjAlMjByZXBldGl0aW9uX3BlbmFsdHklM0QxLjUlMkMlMEElMjAlMjAlMjAlMjBsZW5ndGhfcGVuYWx0eSUzRDEuMCUyQyUwQSUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMSUyQyUwQSklMEFnZW5lcmF0ZWRfdGV4dCUyMCUzRCUyMHByb2Nlc3Nvci5iYXRjaF9kZWNvZGUob3V0cHV0cyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQuc3RyaXAoKSUwQXByaW50KGdlbmVyYXRlZF90ZXh0KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> InstructBlipProcessor, InstructBlipForConditionalGeneration
<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>model = InstructBlipForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Salesforce/instructblip-vicuna-7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = InstructBlipProcessor.from_pretrained(<span class="hljs-string">&quot;Salesforce/instructblip-vicuna-7b&quot;</span>)

<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.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/salesforce/LAVIS/main/docs/_static/Confusing-Pictures.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;What is unusual about this image?&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-meta">&gt;&gt;&gt; </span>outputs = model.generate(
<span class="hljs-meta">... </span>    **inputs,
<span class="hljs-meta">... </span>    do_sample=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    num_beams=<span class="hljs-number">5</span>,
<span class="hljs-meta">... </span>    max_length=<span class="hljs-number">256</span>,
<span class="hljs-meta">... </span>    min_length=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    top_p=<span class="hljs-number">0.9</span>,
<span class="hljs-meta">... </span>    repetition_penalty=<span class="hljs-number">1.5</span>,
<span class="hljs-meta">... </span>    length_penalty=<span class="hljs-number">1.0</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = processor.batch_decode(outputs, 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)
The unusual aspect of this image <span class="hljs-keyword">is</span> that a man <span class="hljs-keyword">is</span> ironing clothes on the back of a yellow SUV, which <span class="hljs-keyword">is</span> parked <span class="hljs-keyword">in</span> the middle of a busy city street. This <span class="hljs-keyword">is</span> an unconventional approach to ironing clothes, <span class="hljs-keyword">as</span> it requires the man to balance himself <span class="hljs-keyword">and</span> his ironing equipment on top of the vehicle <span class="hljs-keyword">while</span> navigating through traffic. Additionally, the presence of taxis <span class="hljs-keyword">and</span> other vehicles <span class="hljs-keyword">in</span> the scene further emphasizes the unusual nature of this situation.`,wrap:!1}}),{c(){i=c("p"),i.textContent=I,p=o(),u(m.$$.fragment)},l(s){i=d(s,"P",{"data-svelte-h":!0}),y(i)!=="svelte-kvfsh7"&&(i.textContent=I),p=r(s),f(m.$$.fragment,s)},m(s,M){l(s,i,M),l(s,p,M),g(m,s,M),v=!0},p:rt,i(s){v||(h(m.$$.fragment,s),v=!0)},o(s){_(m.$$.fragment,s),v=!1},d(s){s&&(t(i),t(p)),b(m,s)}}}function co(x){let i,I,p,m,v,s,M,yn='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',at,te,it,ne,vn=`The InstructBLIP model was proposed in <a href="https://arxiv.org/abs/2305.06500" rel="nofollow">InstructBLIP: Towards General-purpose Vision-Language Models with Instruction Tuning</a> by Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, Steven Hoi.
InstructBLIP leverages the <a href="blip2">BLIP-2</a> architecture for visual instruction tuning.`,lt,oe,Mn="The abstract from the paper is the following:",ct,re,In="<em>General-purpose language models that can solve various language-domain tasks have emerged driven by the pre-training and instruction-tuning pipeline. However, building general-purpose vision-language models is challenging due to the increased task discrepancy introduced by the additional visual input. Although vision-language pre-training has been widely studied, vision-language instruction tuning remains relatively less explored. In this paper, we conduct a systematic and comprehensive study on vision-language instruction tuning based on the pre-trained BLIP-2 models. We gather a wide variety of 26 publicly available datasets, transform them into instruction tuning format and categorize them into two clusters for held-in instruction tuning and held-out zero-shot evaluation. Additionally, we introduce instruction-aware visual feature extraction, a crucial method that enables the model to extract informative features tailored to the given instruction. The resulting InstructBLIP models achieve state-of-the-art zero-shot performance across all 13 held-out datasets, substantially outperforming BLIP-2 and the larger Flamingo. Our models also lead to state-of-the-art performance when finetuned on individual downstream tasks (e.g., 90.7% accuracy on ScienceQA IMG). Furthermore, we qualitatively demonstrate the advantages of InstructBLIP over concurrent multimodal models.</em>",dt,N,Bn,mt,se,Tn='InstructBLIP architecture. Taken from the <a href="https://arxiv.org/abs/2305.06500">original paper.</a>',pt,ae,wn=`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/main/projects/instructblip" rel="nofollow">here</a>.`,ut,ie,ft,le,$n='InstructBLIP uses the same architecture as <a href="blip2">BLIP-2</a> with a tiny but important difference: it also feeds the text prompt (instruction) to the Q-Former.',gt,ce,Cn=`<p>[!NOTE]
BLIP models after release v4.46 will raise warnings about adding <code>processor.num_query_tokens = {{num_query_tokens}}</code> and expand model embeddings layer to add special <code>&lt;image&gt;</code> token. It is strongly recommended to add the attributes to the processor if you own the model checkpoint, or open a PR if it is not owned by you. Adding these attributes means that BLIP will add the number of query tokens required per image and expand the text with as many <code>&lt;image&gt;</code> placeholders as there will be query tokens. Usually it is around 500 tokens per image, so make sure that the text is not truncated as otherwise there wil be failure when merging the embeddings.
The attributes can be obtained from model config, as <code>model.config.num_query_tokens</code> and model embeddings expansion can be done by following <a href="https://gist.github.com/zucchini-nlp/e9f20b054fa322f84ac9311d9ab67042" rel="nofollow">this link</a>.</p>`,ht,de,_t,$,me,Pt,ze,xn=`<a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipConfig">InstructBlipConfig</a> is the configuration class to store the configuration of a
<a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipForConditionalGeneration">InstructBlipForConditionalGeneration</a>. It is used to instantiate a InstructBLIP 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 InstructBLIP
<a href="https://huggingface.co/Salesforce/instruct-blip-flan-t5" rel="nofollow">Salesforce/instruct-blip-flan-t5</a> architecture.`,Lt,We,kn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Qt,R,Gt,H,pe,Vt,Ze,jn=`Instantiate a <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipConfig">InstructBlipConfig</a> (or a derived class) from a InstructBLIP vision model, Q-Former and
language model configurations.`,bt,ue,yt,F,fe,Nt,qe,Fn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipVisionModel">InstructBlipVisionModel</a>. It is used to
instantiate a InstructBLIP vision encoder according to the specified arguments, defining the model architecture.
Instantiating a configuration defaults will yield a similar configuration to that of the InstructBLIP
<a href="https://huggingface.co/Salesforce/instruct-blip-flan-t5" rel="nofollow">Salesforce/instruct-blip-flan-t5</a> architecture.`,Rt,Pe,Jn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ht,S,vt,ge,Mt,J,he,St,Le,Un=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipQFormerModel">InstructBlipQFormerModel</a>. It is used to
instantiate a InstructBLIP 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 InstructBLIP <a href="https://huggingface.co/Salesforce/instruct-blip-flan-t5" rel="nofollow">Salesforce/instruct-blip-flan-t5</a>
architecture. Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs.
Read the documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Et,Qe,zn='Note that <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipQFormerModel">InstructBlipQFormerModel</a> is very similar to <a href="/docs/transformers/main/en/model_doc/bert#transformers.BertLMHeadModel">BertLMHeadModel</a> with interleaved cross-attention.',Xt,E,It,_e,Bt,C,be,Yt,Ge,Wn=`Constructs an InstructBLIP processor which wraps a BLIP image processor and a LLaMa/T5 tokenizer into a single
processor.`,At,Ve,Zn=`<a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipProcessor">InstructBlipProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See the
docstring of <code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipProcessor.decode">decode()</a> for more information.`,Dt,X,ye,Ot,Ne,qn=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,Kt,Y,ve,en,Re,Pn=`This method forwards all its arguments to PreTrainedTokenizer’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,Tt,Me,wt,V,Ie,tn,L,Be,nn,He,Ln='The <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipVisionModel">InstructBlipVisionModel</a> forward method, overrides the <code>__call__</code> special method.',on,A,$t,Te,Ct,Z,we,rn,Se,Qn=`Querying Transformer (Q-Former), used in InstructBLIP. Slightly modified from BLIP-2 as it also takes the
instruction as input.`,sn,Q,$e,an,Ee,Gn=`encoder_hidden_states  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>):
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>, <em>optional</em>):
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>:`,ln,Xe,Vn=`<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>, <em>optional</em>):
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>`,xt,Ce,kt,T,xe,cn,Ye,Nn=`InstructBLIP 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.`,dn,Ae,Rn=`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.`,mn,De,Hn=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,pn,Oe,Sn=`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.`,un,W,ke,fn,Ke,En='The <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipForConditionalGeneration">InstructBlipForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',gn,D,hn,O,_n,K,je,bn,et,Xn="Overrides <code>generate</code> function to be able to use the model as a conditional generator.",jt,Fe,Ft,st,Jt;return v=new G({props:{title:"InstructBLIP",local:"instructblip",headingTag:"h1"}}),te=new G({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ie=new G({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),de=new G({props:{title:"InstructBlipConfig",local:"transformers.InstructBlipConfig",headingTag:"h2"}}),me=new j({props:{name:"class transformers.InstructBlipConfig",anchor:"transformers.InstructBlipConfig",parameters:[{name:"vision_config",val:" = None"},{name:"qformer_config",val:" = None"},{name:"text_config",val:" = None"},{name:"num_query_tokens",val:" = 32"},{name:"image_token_index",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.InstructBlipConfig.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipVisionConfig">InstructBlipVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.InstructBlipConfig.qformer_config",description:`<strong>qformer_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipQFormerConfig">InstructBlipQFormerConfig</a>.`,name:"qformer_config"},{anchor:"transformers.InstructBlipConfig.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize any <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>.`,name:"text_config"},{anchor:"transformers.InstructBlipConfig.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.InstructBlipConfig.image_token_index",description:`<strong>image_token_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Token index of special image token.`,name:"image_token_index"},{anchor:"transformers.InstructBlipConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/configuration_instructblip.py#L214"}}),R=new Zt({props:{anchor:"transformers.InstructBlipConfig.example",$$slots:{default:[oo]},$$scope:{ctx:x}}}),pe=new j({props:{name:"from_vision_qformer_text_configs",anchor:"transformers.InstructBlipConfig.from_vision_qformer_text_configs",parameters:[{name:"vision_config",val:": InstructBlipVisionConfig"},{name:"qformer_config",val:": InstructBlipQFormerConfig"},{name:"text_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/configuration_instructblip.py#L312",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipConfig"
>InstructBlipConfig</a></p>
`}}),ue=new G({props:{title:"InstructBlipVisionConfig",local:"transformers.InstructBlipVisionConfig",headingTag:"h2"}}),fe=new j({props:{name:"class transformers.InstructBlipVisionConfig",anchor:"transformers.InstructBlipVisionConfig",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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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.InstructBlipVisionConfig.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. to 1e-5): The epsilon used by the layer
normalization layers.`,name:"hidden_act"},{anchor:"transformers.InstructBlipVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.InstructBlipVisionConfig.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.InstructBlipVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-10) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.InstructBlipVisionConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries and values in the self-attention layers.`,name:"qkv_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/configuration_instructblip.py#L26"}}),S=new Zt({props:{anchor:"transformers.InstructBlipVisionConfig.example",$$slots:{default:[ro]},$$scope:{ctx:x}}}),ge=new G({props:{title:"InstructBlipQFormerConfig",local:"transformers.InstructBlipQFormerConfig",headingTag:"h2"}}),he=new j({props:{name:"class transformers.InstructBlipQFormerConfig",anchor:"transformers.InstructBlipQFormerConfig",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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Token id used for padding sequences.`,name:"pad_token_id"},{anchor:"transformers.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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.InstructBlipQFormerConfig.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/main/src/transformers/models/instructblip/configuration_instructblip.py#L110"}}),E=new Zt({props:{anchor:"transformers.InstructBlipQFormerConfig.example",$$slots:{default:[so]},$$scope:{ctx:x}}}),_e=new G({props:{title:"InstructBlipProcessor",local:"transformers.InstructBlipProcessor",headingTag:"h2"}}),be=new j({props:{name:"class transformers.InstructBlipProcessor",anchor:"transformers.InstructBlipProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""},{name:"qformer_tokenizer",val:""},{name:"num_query_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.InstructBlipProcessor.image_processor",description:`<strong>image_processor</strong> (<code>BlipImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/blip#transformers.BlipImageProcessor">BlipImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.InstructBlipProcessor.tokenizer",description:"<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;\nAn instance of [&#x2018;PreTrainedTokenizer`]. The tokenizer is a required input.",name:"tokenizer"},{anchor:"transformers.InstructBlipProcessor.qformer_tokenizer",description:"<strong>qformer_tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;\nAn instance of [&#x2018;PreTrainedTokenizer`]. The Q-Former tokenizer is a required input.",name:"qformer_tokenizer"},{anchor:"transformers.InstructBlipProcessor.num_query_tokens",description:`<strong>num_query_tokens</strong> (<code>int</code>, <em>optional</em>) &#x2014;&#x201D;
Number of tokens used by the Qformer as queries, should be same as in model&#x2019;s config.`,name:"num_query_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/processing_instructblip.py#L55"}}),ye=new j({props:{name:"batch_decode",anchor:"transformers.InstructBlipProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/processing_instructblip.py#L169"}}),ve=new j({props:{name:"decode",anchor:"transformers.InstructBlipProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/processing_instructblip.py#L177"}}),Me=new G({props:{title:"InstructBlipVisionModel",local:"transformers.InstructBlipVisionModel",headingTag:"h2"}}),Ie=new j({props:{name:"class transformers.InstructBlipVisionModel",anchor:"transformers.InstructBlipVisionModel",parameters:[{name:"config",val:": InstructBlipVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L537"}}),Be=new j({props:{name:"forward",anchor:"transformers.InstructBlipVisionModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": bool = False"}],parametersDescription:[{anchor:"transformers.InstructBlipVisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipProcessor">InstructBlipProcessor</a>. See
<code>InstructBlipProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.InstructBlipVisionModel.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.InstructBlipVisionModel.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.InstructBlipVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.InstructBlipVisionModel.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L552",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.instructblip.configuration_instructblip.InstructBlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),A=new Yn({props:{$$slots:{default:[ao]},$$scope:{ctx:x}}}),Te=new G({props:{title:"InstructBlipQFormerModel",local:"transformers.InstructBlipQFormerModel",headingTag:"h2"}}),we=new j({props:{name:"class transformers.InstructBlipQFormerModel",anchor:"transformers.InstructBlipQFormerModel",parameters:[{name:"config",val:": InstructBlipQFormerConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L1083"}}),$e=new j({props:{name:"forward",anchor:"transformers.InstructBlipQFormerModel.forward",parameters:[{name:"input_ids",val:": LongTensor"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"query_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L1156"}}),Ce=new G({props:{title:"InstructBlipForConditionalGeneration",local:"transformers.InstructBlipForConditionalGeneration",headingTag:"h2"}}),xe=new j({props:{name:"class transformers.InstructBlipForConditionalGeneration",anchor:"transformers.InstructBlipForConditionalGeneration",parameters:[{name:"config",val:": InstructBlipConfig"}],parametersDescription:[{anchor:"transformers.InstructBlipForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipConfig">InstructBlipConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L1279"}}),ke=new j({props:{name:"forward",anchor:"transformers.InstructBlipForConditionalGeneration.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"qformer_input_ids",val:": FloatTensor"},{name:"qformer_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"input_ids",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"use_cache",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.InstructBlipForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipProcessor">InstructBlipProcessor</a>. See
<code>InstructBlipProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.qformer_input_ids",description:`<strong>qformer_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 Q-Former. Input tokens can optionally be provided
to serve as text prompt, which the Q-Former model will encode.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipProcessor">InstructBlipProcessor</a>. See <code>InstructBlipProcessor.__call__()</code> for
details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"qformer_input_ids"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.qformer_attention_mask",description:`<strong>qformer_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:"qformer_attention_mask"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary of the language model. Input tokens can optionally be
provided to serve as text prompt, which the language model can continue.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/instructblip#transformers.InstructBlipProcessor">InstructBlipProcessor</a>. See <code>InstructBlipProcessor.__call__()</code> for
details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary of the language model. Only relevant in case an
encoder-decoder language model (like T5) is used.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#decoder-input-ids">What are decoder input IDs?</a>`,name:"decoder_input_ids"},{anchor:"transformers.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the pre-trained position encodings.`,name:"interpolate_pos_encoding"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.InstructBlipForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size - 1]</code>. All labels set to <code>-100</code> are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L1366",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.instructblip.modeling_instructblip.InstructBlipForConditionalGenerationModelOutput</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.instructblip.configuration_instructblip.InstructBlipVisionConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code>, <em>optional</em>, returned when <code>labels</code> is provided, <code>torch.FloatTensor</code> of shape <code>(1,)</code>) — Language modeling loss from the language model.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head of the language model.</li>
<li><strong>vision_outputs</strong> (<code>BaseModelOutputWithPooling</code>) — Outputs of the vision encoder.</li>
<li><strong>qformer_outputs</strong> (<code>BaseModelOutputWithPoolingAndCrossAttentions</code>) — Outputs of the Q-Former (Querying Transformer).</li>
<li><strong>language_model_outputs</strong> (<code>CausalLMOutputWithPast</code> or <code>Seq2SeqLMOutput</code>) — Outputs of the language model.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.instructblip.modeling_instructblip.InstructBlipForConditionalGenerationModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),D=new Yn({props:{$$slots:{default:[io]},$$scope:{ctx:x}}}),O=new Zt({props:{anchor:"transformers.InstructBlipForConditionalGeneration.forward.example",$$slots:{default:[lo]},$$scope:{ctx:x}}}),je=new j({props:{name:"generate",anchor:"transformers.InstructBlipForConditionalGeneration.generate",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"qformer_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"qformer_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"interpolate_pos_encoding",val:": bool = False"},{name:"**generate_kwargs",val:""}],parametersDescription:[{anchor:"transformers.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.generate.qformer_input_ids",description:`<strong>qformer_input_ids</strong> (<code>torch.LongTensor</code> of shape (batch_size, sequence_length), <em>optional</em>) &#x2014;
The sequence used as a prompt to be fed to the Q-Former module.`,name:"qformer_input_ids"},{anchor:"transformers.InstructBlipForConditionalGeneration.generate.qformer_attention_mask",description:`<strong>qformer_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:"qformer_attention_mask"},{anchor:"transformers.InstructBlipForConditionalGeneration.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.InstructBlipForConditionalGeneration.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"},{anchor:"transformers.InstructBlipForConditionalGeneration.generate.interpolate_pos_encoding",description:`<strong>interpolate_pos_encoding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to interpolate the positional encoding of the image embeddings.`,name:"interpolate_pos_encoding"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/instructblip/modeling_instructblip.py#L1538",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p>captions (list)</p>
`}}),Fe=new no({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/instructblip.md"}}),{c(){i=c("meta"),I=o(),p=c("p"),m=o(),u(v.$$.fragment),s=o(),M=c("div"),M.innerHTML=yn,at=o(),u(te.$$.fragment),it=o(),ne=c("p"),ne.innerHTML=vn,lt=o(),oe=c("p"),oe.textContent=Mn,ct=o(),re=c("p"),re.innerHTML=In,dt=o(),N=c("img"),mt=o(),se=c("small"),se.innerHTML=Tn,pt=o(),ae=c("p"),ae.innerHTML=wn,ut=o(),u(ie.$$.fragment),ft=o(),le=c("p"),le.innerHTML=$n,gt=o(),ce=c("blockquote"),ce.innerHTML=Cn,ht=o(),u(de.$$.fragment),_t=o(),$=c("div"),u(me.$$.fragment),Pt=o(),ze=c("p"),ze.innerHTML=xn,Lt=o(),We=c("p"),We.innerHTML=kn,Qt=o(),u(R.$$.fragment),Gt=o(),H=c("div"),u(pe.$$.fragment),Vt=o(),Ze=c("p"),Ze.innerHTML=jn,bt=o(),u(ue.$$.fragment),yt=o(),F=c("div"),u(fe.$$.fragment),Nt=o(),qe=c("p"),qe.innerHTML=Fn,Rt=o(),Pe=c("p"),Pe.innerHTML=Jn,Ht=o(),u(S.$$.fragment),vt=o(),u(ge.$$.fragment),Mt=o(),J=c("div"),u(he.$$.fragment),St=o(),Le=c("p"),Le.innerHTML=Un,Et=o(),Qe=c("p"),Qe.innerHTML=zn,Xt=o(),u(E.$$.fragment),It=o(),u(_e.$$.fragment),Bt=o(),C=c("div"),u(be.$$.fragment),Yt=o(),Ge=c("p"),Ge.textContent=Wn,At=o(),Ve=c("p"),Ve.innerHTML=Zn,Dt=o(),X=c("div"),u(ye.$$.fragment),Ot=o(),Ne=c("p"),Ne.innerHTML=qn,Kt=o(),Y=c("div"),u(ve.$$.fragment),en=o(),Re=c("p"),Re.innerHTML=Pn,Tt=o(),u(Me.$$.fragment),wt=o(),V=c("div"),u(Ie.$$.fragment),tn=o(),L=c("div"),u(Be.$$.fragment),nn=o(),He=c("p"),He.innerHTML=Ln,on=o(),u(A.$$.fragment),$t=o(),u(Te.$$.fragment),Ct=o(),Z=c("div"),u(we.$$.fragment),rn=o(),Se=c("p"),Se.textContent=Qn,sn=o(),Q=c("div"),u($e.$$.fragment),an=o(),Ee=c("p"),Ee.innerHTML=Gn,ln=o(),Xe=c("ul"),Xe.innerHTML=Vn,xt=o(),u(Ce.$$.fragment),kt=o(),T=c("div"),u(xe.$$.fragment),cn=o(),Ye=c("p"),Ye.textContent=Nn,dn=o(),Ae=c("p"),Ae.innerHTML=Rn,mn=o(),De=c("p"),De.innerHTML=Hn,pn=o(),Oe=c("p"),Oe.innerHTML=Sn,un=o(),W=c("div"),u(ke.$$.fragment),fn=o(),Ke=c("p"),Ke.innerHTML=En,gn=o(),u(D.$$.fragment),hn=o(),u(O.$$.fragment),_n=o(),K=c("div"),u(je.$$.fragment),bn=o(),et=c("p"),et.innerHTML=Xn,jt=o(),u(Fe.$$.fragment),Ft=o(),st=c("p"),this.h()},l(e){const n=to("svelte-u9bgzb",document.head);i=d(n,"META",{name:!0,content:!0}),n.forEach(t),I=r(e),p=d(e,"P",{}),w(p).forEach(t),m=r(e),f(v.$$.fragment,e),s=r(e),M=d(e,"DIV",{class:!0,"data-svelte-h":!0}),y(M)!=="svelte-13t8s2t"&&(M.innerHTML=yn),at=r(e),f(te.$$.fragment,e),it=r(e),ne=d(e,"P",{"data-svelte-h":!0}),y(ne)!=="svelte-15j8z3m"&&(ne.innerHTML=vn),lt=r(e),oe=d(e,"P",{"data-svelte-h":!0}),y(oe)!=="svelte-vfdo9a"&&(oe.textContent=Mn),ct=r(e),re=d(e,"P",{"data-svelte-h":!0}),y(re)!=="svelte-g3w4hv"&&(re.innerHTML=In),dt=r(e),N=d(e,"IMG",{src:!0,alt:!0,width:!0}),mt=r(e),se=d(e,"SMALL",{"data-svelte-h":!0}),y(se)!=="svelte-gvupf8"&&(se.innerHTML=Tn),pt=r(e),ae=d(e,"P",{"data-svelte-h":!0}),y(ae)!=="svelte-1b5u17p"&&(ae.innerHTML=wn),ut=r(e),f(ie.$$.fragment,e),ft=r(e),le=d(e,"P",{"data-svelte-h":!0}),y(le)!=="svelte-14dqybh"&&(le.innerHTML=$n),gt=r(e),ce=d(e,"BLOCKQUOTE",{"data-svelte-h":!0}),y(ce)!=="svelte-w0b318"&&(ce.innerHTML=Cn),ht=r(e),f(de.$$.fragment,e),_t=r(e),$=d(e,"DIV",{class:!0});var U=w($);f(me.$$.fragment,U),Pt=r(U),ze=d(U,"P",{"data-svelte-h":!0}),y(ze)!=="svelte-18qxzwu"&&(ze.innerHTML=xn),Lt=r(U),We=d(U,"P",{"data-svelte-h":!0}),y(We)!=="svelte-o55m63"&&(We.innerHTML=kn),Qt=r(U),f(R.$$.fragment,U),Gt=r(U),H=d(U,"DIV",{class:!0});var Je=w(H);f(pe.$$.fragment,Je),Vt=r(Je),Ze=d(Je,"P",{"data-svelte-h":!0}),y(Ze)!=="svelte-jiu0a6"&&(Ze.innerHTML=jn),Je.forEach(t),U.forEach(t),bt=r(e),f(ue.$$.fragment,e),yt=r(e),F=d(e,"DIV",{class:!0});var q=w(F);f(fe.$$.fragment,q),Nt=r(q),qe=d(q,"P",{"data-svelte-h":!0}),y(qe)!=="svelte-w1p2u2"&&(qe.innerHTML=Fn),Rt=r(q),Pe=d(q,"P",{"data-svelte-h":!0}),y(Pe)!=="svelte-o55m63"&&(Pe.innerHTML=Jn),Ht=r(q),f(S.$$.fragment,q),q.forEach(t),vt=r(e),f(ge.$$.fragment,e),Mt=r(e),J=d(e,"DIV",{class:!0});var P=w(J);f(he.$$.fragment,P),St=r(P),Le=d(P,"P",{"data-svelte-h":!0}),y(Le)!=="svelte-1rwjuiy"&&(Le.innerHTML=Un),Et=r(P),Qe=d(P,"P",{"data-svelte-h":!0}),y(Qe)!=="svelte-1szlo2r"&&(Qe.innerHTML=zn),Xt=r(P),f(E.$$.fragment,P),P.forEach(t),It=r(e),f(_e.$$.fragment,e),Bt=r(e),C=d(e,"DIV",{class:!0});var z=w(C);f(be.$$.fragment,z),Yt=r(z),Ge=d(z,"P",{"data-svelte-h":!0}),y(Ge)!=="svelte-1o16zs2"&&(Ge.textContent=Wn),At=r(z),Ve=d(z,"P",{"data-svelte-h":!0}),y(Ve)!=="svelte-y9wawf"&&(Ve.innerHTML=Zn),Dt=r(z),X=d(z,"DIV",{class:!0});var Ue=w(X);f(ye.$$.fragment,Ue),Ot=r(Ue),Ne=d(Ue,"P",{"data-svelte-h":!0}),y(Ne)!=="svelte-oplyi9"&&(Ne.innerHTML=qn),Ue.forEach(t),Kt=r(z),Y=d(z,"DIV",{class:!0});var Ut=w(Y);f(ve.$$.fragment,Ut),en=r(Ut),Re=d(Ut,"P",{"data-svelte-h":!0}),y(Re)!=="svelte-13jr6zv"&&(Re.innerHTML=Pn),Ut.forEach(t),z.forEach(t),Tt=r(e),f(Me.$$.fragment,e),wt=r(e),V=d(e,"DIV",{class:!0});var zt=w(V);f(Ie.$$.fragment,zt),tn=r(zt),L=d(zt,"DIV",{class:!0});var tt=w(L);f(Be.$$.fragment,tt),nn=r(tt),He=d(tt,"P",{"data-svelte-h":!0}),y(He)!=="svelte-nnnlds"&&(He.innerHTML=Ln),on=r(tt),f(A.$$.fragment,tt),tt.forEach(t),zt.forEach(t),$t=r(e),f(Te.$$.fragment,e),Ct=r(e),Z=d(e,"DIV",{class:!0});var nt=w(Z);f(we.$$.fragment,nt),rn=r(nt),Se=d(nt,"P",{"data-svelte-h":!0}),y(Se)!=="svelte-1ta0rcm"&&(Se.textContent=Qn),sn=r(nt),Q=d(nt,"DIV",{class:!0});var ot=w(Q);f($e.$$.fragment,ot),an=r(ot),Ee=d(ot,"P",{"data-svelte-h":!0}),y(Ee)!=="svelte-1h74cdd"&&(Ee.innerHTML=Gn),ln=r(ot),Xe=d(ot,"UL",{"data-svelte-h":!0}),y(Xe)!=="svelte-1yyv1jy"&&(Xe.innerHTML=Vn),ot.forEach(t),nt.forEach(t),xt=r(e),f(Ce.$$.fragment,e),kt=r(e),T=d(e,"DIV",{class:!0});var k=w(T);f(xe.$$.fragment,k),cn=r(k),Ye=d(k,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-18txus8"&&(Ye.textContent=Nn),dn=r(k),Ae=d(k,"P",{"data-svelte-h":!0}),y(Ae)!=="svelte-1ks26sg"&&(Ae.innerHTML=Rn),mn=r(k),De=d(k,"P",{"data-svelte-h":!0}),y(De)!=="svelte-6pahdo"&&(De.innerHTML=Hn),pn=r(k),Oe=d(k,"P",{"data-svelte-h":!0}),y(Oe)!=="svelte-hswkmf"&&(Oe.innerHTML=Sn),un=r(k),W=d(k,"DIV",{class:!0});var ee=w(W);f(ke.$$.fragment,ee),fn=r(ee),Ke=d(ee,"P",{"data-svelte-h":!0}),y(Ke)!=="svelte-11sp8yc"&&(Ke.innerHTML=En),gn=r(ee),f(D.$$.fragment,ee),hn=r(ee),f(O.$$.fragment,ee),ee.forEach(t),_n=r(k),K=d(k,"DIV",{class:!0});var Wt=w(K);f(je.$$.fragment,Wt),bn=r(Wt),et=d(Wt,"P",{"data-svelte-h":!0}),y(et)!=="svelte-eq620n"&&(et.innerHTML=Xn),Wt.forEach(t),k.forEach(t),jt=r(e),f(Fe.$$.fragment,e),Ft=r(e),st=d(e,"P",{}),w(st).forEach(t),this.h()},h(){B(i,"name","hf:doc:metadata"),B(i,"content",mo),B(M,"class","flex flex-wrap space-x-1"),Dn(N.src,Bn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/instructblip_architecture.jpg")||B(N,"src",Bn),B(N,"alt","drawing"),B(N,"width","600"),B(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(T,"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,n){a(document.head,i),l(e,I,n),l(e,p,n),l(e,m,n),g(v,e,n),l(e,s,n),l(e,M,n),l(e,at,n),g(te,e,n),l(e,it,n),l(e,ne,n),l(e,lt,n),l(e,oe,n),l(e,ct,n),l(e,re,n),l(e,dt,n),l(e,N,n),l(e,mt,n),l(e,se,n),l(e,pt,n),l(e,ae,n),l(e,ut,n),g(ie,e,n),l(e,ft,n),l(e,le,n),l(e,gt,n),l(e,ce,n),l(e,ht,n),g(de,e,n),l(e,_t,n),l(e,$,n),g(me,$,null),a($,Pt),a($,ze),a($,Lt),a($,We),a($,Qt),g(R,$,null),a($,Gt),a($,H),g(pe,H,null),a(H,Vt),a(H,Ze),l(e,bt,n),g(ue,e,n),l(e,yt,n),l(e,F,n),g(fe,F,null),a(F,Nt),a(F,qe),a(F,Rt),a(F,Pe),a(F,Ht),g(S,F,null),l(e,vt,n),g(ge,e,n),l(e,Mt,n),l(e,J,n),g(he,J,null),a(J,St),a(J,Le),a(J,Et),a(J,Qe),a(J,Xt),g(E,J,null),l(e,It,n),g(_e,e,n),l(e,Bt,n),l(e,C,n),g(be,C,null),a(C,Yt),a(C,Ge),a(C,At),a(C,Ve),a(C,Dt),a(C,X),g(ye,X,null),a(X,Ot),a(X,Ne),a(C,Kt),a(C,Y),g(ve,Y,null),a(Y,en),a(Y,Re),l(e,Tt,n),g(Me,e,n),l(e,wt,n),l(e,V,n),g(Ie,V,null),a(V,tn),a(V,L),g(Be,L,null),a(L,nn),a(L,He),a(L,on),g(A,L,null),l(e,$t,n),g(Te,e,n),l(e,Ct,n),l(e,Z,n),g(we,Z,null),a(Z,rn),a(Z,Se),a(Z,sn),a(Z,Q),g($e,Q,null),a(Q,an),a(Q,Ee),a(Q,ln),a(Q,Xe),l(e,xt,n),g(Ce,e,n),l(e,kt,n),l(e,T,n),g(xe,T,null),a(T,cn),a(T,Ye),a(T,dn),a(T,Ae),a(T,mn),a(T,De),a(T,pn),a(T,Oe),a(T,un),a(T,W),g(ke,W,null),a(W,fn),a(W,Ke),a(W,gn),g(D,W,null),a(W,hn),g(O,W,null),a(T,_n),a(T,K),g(je,K,null),a(K,bn),a(K,et),l(e,jt,n),g(Fe,e,n),l(e,Ft,n),l(e,st,n),Jt=!0},p(e,[n]){const U={};n&2&&(U.$$scope={dirty:n,ctx:e}),R.$set(U);const Je={};n&2&&(Je.$$scope={dirty:n,ctx:e}),S.$set(Je);const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),E.$set(q);const P={};n&2&&(P.$$scope={dirty:n,ctx:e}),A.$set(P);const z={};n&2&&(z.$$scope={dirty:n,ctx:e}),D.$set(z);const Ue={};n&2&&(Ue.$$scope={dirty:n,ctx:e}),O.$set(Ue)},i(e){Jt||(h(v.$$.fragment,e),h(te.$$.fragment,e),h(ie.$$.fragment,e),h(de.$$.fragment,e),h(me.$$.fragment,e),h(R.$$.fragment,e),h(pe.$$.fragment,e),h(ue.$$.fragment,e),h(fe.$$.fragment,e),h(S.$$.fragment,e),h(ge.$$.fragment,e),h(he.$$.fragment,e),h(E.$$.fragment,e),h(_e.$$.fragment,e),h(be.$$.fragment,e),h(ye.$$.fragment,e),h(ve.$$.fragment,e),h(Me.$$.fragment,e),h(Ie.$$.fragment,e),h(Be.$$.fragment,e),h(A.$$.fragment,e),h(Te.$$.fragment,e),h(we.$$.fragment,e),h($e.$$.fragment,e),h(Ce.$$.fragment,e),h(xe.$$.fragment,e),h(ke.$$.fragment,e),h(D.$$.fragment,e),h(O.$$.fragment,e),h(je.$$.fragment,e),h(Fe.$$.fragment,e),Jt=!0)},o(e){_(v.$$.fragment,e),_(te.$$.fragment,e),_(ie.$$.fragment,e),_(de.$$.fragment,e),_(me.$$.fragment,e),_(R.$$.fragment,e),_(pe.$$.fragment,e),_(ue.$$.fragment,e),_(fe.$$.fragment,e),_(S.$$.fragment,e),_(ge.$$.fragment,e),_(he.$$.fragment,e),_(E.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(ye.$$.fragment,e),_(ve.$$.fragment,e),_(Me.$$.fragment,e),_(Ie.$$.fragment,e),_(Be.$$.fragment,e),_(A.$$.fragment,e),_(Te.$$.fragment,e),_(we.$$.fragment,e),_($e.$$.fragment,e),_(Ce.$$.fragment,e),_(xe.$$.fragment,e),_(ke.$$.fragment,e),_(D.$$.fragment,e),_(O.$$.fragment,e),_(je.$$.fragment,e),_(Fe.$$.fragment,e),Jt=!1},d(e){e&&(t(I),t(p),t(m),t(s),t(M),t(at),t(it),t(ne),t(lt),t(oe),t(ct),t(re),t(dt),t(N),t(mt),t(se),t(pt),t(ae),t(ut),t(ft),t(le),t(gt),t(ce),t(ht),t(_t),t($),t(bt),t(yt),t(F),t(vt),t(Mt),t(J),t(It),t(Bt),t(C),t(Tt),t(wt),t(V),t($t),t(Ct),t(Z),t(xt),t(kt),t(T),t(jt),t(Ft),t(st)),t(i),b(v,e),b(te,e),b(ie,e),b(de,e),b(me),b(R),b(pe),b(ue,e),b(fe),b(S),b(ge,e),b(he),b(E),b(_e,e),b(be),b(ye),b(ve),b(Me,e),b(Ie),b(Be),b(A),b(Te,e),b(we),b($e),b(Ce,e),b(xe),b(ke),b(D),b(O),b(je),b(Fe,e)}}}const mo='{"title":"InstructBLIP","local":"instructblip","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"InstructBlipConfig","local":"transformers.InstructBlipConfig","sections":[],"depth":2},{"title":"InstructBlipVisionConfig","local":"transformers.InstructBlipVisionConfig","sections":[],"depth":2},{"title":"InstructBlipQFormerConfig","local":"transformers.InstructBlipQFormerConfig","sections":[],"depth":2},{"title":"InstructBlipProcessor","local":"transformers.InstructBlipProcessor","sections":[],"depth":2},{"title":"InstructBlipVisionModel","local":"transformers.InstructBlipVisionModel","sections":[],"depth":2},{"title":"InstructBlipQFormerModel","local":"transformers.InstructBlipQFormerModel","sections":[],"depth":2},{"title":"InstructBlipForConditionalGeneration","local":"transformers.InstructBlipForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function po(x){return On(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vo extends Kn{constructor(i){super(),eo(this,i,po,co,An,{})}}export{vo as component};
