import{s as Xt,o as Yt,n as tt}from"../chunks/scheduler.18a86fab.js";import{S as Qt,i as At,g as r,s as a,r as u,A as Dt,h as l,f as n,c as s,j as B,u as g,x as p,k as z,y as d,a as o,v as f,d as _,t as v,w as y}from"../chunks/index.98837b22.js";import{T as Rt}from"../chunks/Tip.77304350.js";import{D as xe}from"../chunks/Docstring.6758ea23.js";import{C as Ce}from"../chunks/CodeBlock.8d0c2e8a.js";import{E as St}from"../chunks/ExampleCodeBlock.0c42463f.js";import{H as Le}from"../chunks/Heading.7e7e0c5b.js";import{E as Ot}from"../chunks/index.92f616ba.js";function Kt(C){let i,M="Example:",m,h,b;return h=new Ce({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpcExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTIwVmlwTGxhdmFDb25maWclMkMlMjBDTElQVmlzaW9uQ29uZmlnJTJDJTIwTGxhbWFDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ0xJUC12aXNpb24lMjBjb25maWclMEF2aXNpb25fY29uZmlnJTIwJTNEJTIwQ0xJUFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMExsYW1hJTIwY29uZmlnJTBBdGV4dF9jb25maWclMjAlM0QlMjBMbGFtYUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZpcExsYXZhJTIwdmlwbGxhdmEtN2IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwVmlwTGxhdmFDb25maWcodmlzaW9uX2NvbmZpZyUyQyUyMHRleHRfY29uZmlnKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjB2aXBsbGF2YS03YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwVmlwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VipLlavaForConditionalGeneration, VipLlavaConfig, CLIPVisionConfig, LlamaConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CLIP-vision config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vision_config = CLIPVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Llama config</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text_config = LlamaConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a VipLlava vipllava-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = VipLlavaConfig(vision_config, text_config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the vipllava-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VipLlavaForConditionalGeneration(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=r("p"),i.textContent=M,m=a(),u(h.$$.fragment)},l(c){i=l(c,"P",{"data-svelte-h":!0}),p(i)!=="svelte-11lpom8"&&(i.textContent=M),m=s(c),g(h.$$.fragment,c)},m(c,w){o(c,i,w),o(c,m,w),f(h,c,w),b=!0},p:tt,i(c){b||(_(h.$$.fragment,c),b=!0)},o(c){v(h.$$.fragment,c),b=!1},d(c){c&&(n(i),n(m)),y(h,c)}}}function en(C){let i,M=`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=r("p"),i.innerHTML=M},l(m){i=l(m,"P",{"data-svelte-h":!0}),p(i)!=="svelte-fincs2"&&(i.innerHTML=M)},m(m,h){o(m,i,h)},p:tt,d(m){m&&n(i)}}}function tn(C){let i,M=`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=r("p"),i.innerHTML=M},l(m){i=l(m,"P",{"data-svelte-h":!0}),p(i)!=="svelte-fincs2"&&(i.innerHTML=M)},m(m,h){o(m,i,h)},p:tt,d(m){m&&n(i)}}}function nn(C){let i,M="Example:",m,h,b;return h=new Ce({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwVmlwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMFZpcExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJsbGF2YS1oZiUyRnZpcC1sbGF2YS03Yi1oZiUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmxsYXZhLWhmJTJGdmlwLWxsYXZhLTdiLWhmJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBjaGF0JTIwYmV0d2VlbiUyMGElMjBjdXJpb3VzJTIwaHVtYW4lMjBhbmQlMjBhbiUyMGFydGlmaWNpYWwlMjBpbnRlbGxpZ2VuY2UlMjBhc3Npc3RhbnQuJTIwVGhlJTIwYXNzaXN0YW50JTIwZ2l2ZXMlMjBoZWxwZnVsJTJDJTIwZGV0YWlsZWQlMkMlMjBhbmQlMjBwb2xpdGUlMjBhbnN3ZXJzJTIwdG8lMjB0aGUlMjBodW1hbidzJTIwcXVlc3Rpb25zLiUyMyUyMyUyM0h1bWFuJTNBJTIwJTNDaW1hZ2UlM0UlNUNuJTdCJTdEJTIzJTIzJTIzQXNzaXN0YW50JTNBJTIyJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJDYW4lMjB5b3UlMjBwbGVhc2UlMjBkZXNjcmliZSUyMHRoaXMlMjBpbWFnZSUzRiUyMiUwQXByb21wdCUyMCUzRCUyMHByb21wdC5mb3JtYXQocXVlc3Rpb24pJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGZGlmZnVzZXJzJTJGY29tcGVsLW5lZy5wbmclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHRleHQlMkMlMjBpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKDAlMkMlMjB0b3JjaC5mbG9hdDE2KSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDIwKSUwQXByb2Nlc3Nvci5kZWNvZGUoZ2VuZXJhdGVfaWRzJTVCMCU1RCU1QmxlbihpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlNUIwJTVEKSUzQSU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",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, VipLlavaForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = VipLlavaForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;llava-hf/vip-llava-7b-hf&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;llava-hf/vip-llava-7b-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human&#x27;s questions.###Human: &lt;image&gt;\\n{}###Assistant:&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;Can you please describe this image?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = prompt.<span class="hljs-built_in">format</span>(question)
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/compel-neg.png&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(text=text, images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-number">0</span>, torch.float16)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">20</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.decode(generate_ids[<span class="hljs-number">0</span>][<span class="hljs-built_in">len</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>]):], skip_special_tokens=<span class="hljs-literal">True</span>)
The image features a brown <span class="hljs-keyword">and</span> white cat sitting on a green surface, <span class="hljs-keyword">with</span> a red ball <span class="hljs-keyword">in</span> its`,wrap:!1}}),{c(){i=r("p"),i.textContent=M,m=a(),u(h.$$.fragment)},l(c){i=l(c,"P",{"data-svelte-h":!0}),p(i)!=="svelte-11lpom8"&&(i.textContent=M),m=s(c),g(h.$$.fragment,c)},m(c,w){o(c,i,w),o(c,m,w),f(h,c,w),b=!0},p:tt,i(c){b||(_(h.$$.fragment,c),b=!0)},o(c){v(h.$$.fragment,c),b=!1},d(c){c&&(n(i),n(m)),y(h,c)}}}function on(C){let i,M,m,h,b,c,w,Tt='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/> <img alt="FlashAttention" src="https://img.shields.io/badge/%E2%9A%A1%EF%B8%8E%20FlashAttention-eae0c8?style=flat"/> <img alt="SDPA" src="https://img.shields.io/badge/SDPA-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Ue,N,Ve,H,Mt='The VipLlava model was proposed in <a href="https://arxiv.org/abs/2312.00784" rel="nofollow">Making Large Multimodal Models Understand Arbitrary Visual Prompts</a> by Mu Cai, Haotian Liu, Siva Karthik Mustikovela, Gregory P. Meyer, Yuning Chai, Dennis Park, Yong Jae Lee.',Je,P,wt="VipLlava enhances the training protocol of Llava by marking images and interact with the model using natural cues like a “red bounding box” or “pointed arrow” during training.",ze,E,kt="The abstract from the paper is the following:",Fe,R,jt="<em>While existing large vision-language multimodal models focus on whole image understanding, there is a prominent gap in achieving region-specific comprehension. Current approaches that use textual coordinates or spatial encodings often fail to provide a user-friendly interface for visual prompting. To address this challenge, we introduce a novel multimodal model capable of decoding arbitrary visual prompts. This allows users to intuitively mark images and interact with the model using natural cues like a “red bounding box” or “pointed arrow”. Our simple design directly overlays visual markers onto the RGB image, eliminating the need for complex region encodings, yet achieves state-of-the-art performance on region-understanding tasks like Visual7W, PointQA, and Visual Commonsense Reasoning benchmark. Furthermore, we present ViP-Bench, a comprehensive benchmark to assess the capability of models in understanding visual prompts across multiple dimensions, enabling future research in this domain. Code, data, and model are publicly available.</em>",Ge,S,xt='The original code can be found <a href="https://github.com/mu-cai/ViP-LLaVA" rel="nofollow">here</a>.',qe,X,Lt='This model was contributed by <a href="https://huggingface.co/ybelkada" rel="nofollow">Younes Belkada</a>',Ie,Y,We,Q,$t="<li><p>The architecture is similar than llava architecture except that the multi-modal projector takes a set of concatenated vision hidden states and has an additional layernorm layer on that module.</p></li> <li><p>We advise users to use <code>padding_side=&quot;left&quot;</code> when computing batched generation as it leads to more accurate results. Simply make sure to call <code>processor.tokenizer.padding_side = &quot;left&quot;</code> before generating.</p></li> <li><p>Note the model has not been explicitly trained to process multiple images in the same prompt, although this is technically possible, you may experience inaccurate results.</p></li>",Ze,A,Ct="<p>[!NOTE]\nLLaVA models after release v4.46 will raise warnings about adding <code>processor.patch_size = {{patch_size}}</code>, <code>processor.num_additional_image_tokens = {{num_additional_image_tokens}}</code> and processor.vision_feature_select_strategy = {{vision_feature_select_strategy}}<code>. 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 LLaVA will try to infer the number of image tokens required per image and expand the text with as many </code>&lt;image&gt;<code>placeholders as there will be tokens. Usually it is around 500 tokens per image, so make sure that the text is not truncated as otherwise there will be failure when merging the embeddings. The attributes can be obtained from model config, as</code>model.config.vision_config.patch_size<code>or</code>model.config.vision_feature_select_strategy<code>. The </code>num_additional_image_tokens<code>should be</code>1<code>if the vision backbone adds a CLS token or</code>0` if nothing extra is added to the vision patches.</p>",Be,D,Ut="<li>For better results, we recommend users to use the processor’s <code>apply_chat_template()</code> method to format your prompt correctly. For that you need to construct a conversation history, passing in a plain string will not format your prompt. Each message in the conversation history for chat templates is a dictionary with keys “role” and “content”. The “content” should be a list of dictionaries, for “text” and “image” modalities, as follows:</li>",Ne,O,He,K,Vt="<li>If you want to construct a chat prompt yourself, below is a list of prompt formats accepted by VipLLaVa checkpoints:</li>",Pe,ee,Ee,te,Jt="For multiple turns conversation:",Re,ne,Se,oe,Xe,k,ae,nt,ue,zt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaForConditionalGeneration">VipLlavaForConditionalGeneration</a>. It is used to instantiate an
VipLlava 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 VipLlava-9B.`,ot,ge,Ft='e.g. <a href="https://huggingface.co/ybelkada/vip-llava-7b-hf" rel="nofollow">ybelkada/vip-llava-7b-hf</a>',at,fe,Gt=`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.`,st,F,Ye,se,Qe,T,ie,it,_e,qt="The VipLlava model which consists of a vision backbone and a language model, without a language modeling head.",rt,ve,It=`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.)`,lt,ye,Wt=`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.`,dt,U,re,ct,be,Zt='The <a href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaModel">VipLlavaModel</a> forward method, overrides the <code>__call__</code> special method.',pt,G,mt,q,le,ht,Te,Bt="Obtains image last hidden states from the vision tower and apply multimodal projection.",Ae,de,De,j,ce,ut,Me,Nt="The VIPLLAVA model which consists of a vision backbone and a language model.",gt,we,Ht=`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.)`,ft,ke,Pt=`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.`,_t,$,pe,vt,je,Et='The <a href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaForConditionalGeneration">VipLlavaForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',yt,I,bt,W,Oe,me,Ke,$e,et;return b=new Le({props:{title:"VipLlava",local:"vipllava",headingTag:"h1"}}),N=new Le({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Y=new Le({props:{title:"Usage tips:",local:"usage-tips",headingTag:"h2"}}),O=new Ce({props:{code:"JTBBJTBBJTBBJTBBJTBBJTIyJTIzJTIzJTIzSHVtYW4lM0ElMjAlM0NpbWFnZSUzRSU1Q25XaGF0JUUyJTgwJTk5cyUyMHNob3duJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjMlMjMlMjNBc3Npc3RhbnQlM0ElMjBUaGlzJTIwaW1hZ2UlMjBzaG93cyUyMGElMjByZWQlMjBzdG9wJTIwc2lnbi4lMjMlMjMlMjNIdW1hbiUzQSUyMERlc2NyaWJlJTIwdGhlJTIwaW1hZ2UlMjBpbiUyMG1vcmUlMjBkZXRhaWxzLiUyMyUyMyUyM0Fzc2lzdGFudCUzQSUyMg==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor

processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;llava-hf/vip-llava-7b-hf&quot;</span>)

conversation = [
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What’s shown in this image?&quot;</span>},
        ],
    },
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;assistant&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: [{<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;This image shows a red stop sign.&quot;</span>},]
    },
    {

        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;Describe the image in more details.&quot;</span>},
        ],
    },
]

text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Note that the template simply formats your prompt, you still have to tokenize it and obtain pixel values for your images</span>
<span class="hljs-built_in">print</span>(text_prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-string">&quot;###Human: &lt;image&gt;\\nWhat’s shown in this image?###Assistant: This image shows a red stop sign.###Human: Describe the image in more details.###Assistant:&quot;</span>`,wrap:!1}}),ee=new Ce({props:{code:"QSUyMGNoYXQlMjBiZXR3ZWVuJTIwYSUyMGN1cmlvdXMlMjBodW1hbiUyMGFuZCUyMGFuJTIwYXJ0aWZpY2lhbCUyMGludGVsbGlnZW5jZSUyMGFzc2lzdGFudC4lMjBUaGUlMjBhc3Npc3RhbnQlMjBnaXZlcyUyMGhlbHBmdWwlMkMlMjBkZXRhaWxlZCUyQyUyMGFuZCUyMHBvbGl0ZSUyMGFuc3dlcnMlMjB0byUyMHRoZSUyMGh1bWFuJ3MlMjBxdWVzdGlvbnMuJTIzJTIzJTIzSHVtYW4lM0ElMjAlM0NpbWFnZSUzRSU1Q24lM0Nwcm9tcHQlM0UlMjMlMjMlMjNBc3Npc3RhbnQlM0E=",highlighted:'A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human<span class="hljs-string">&#x27;s questions.###Human: &lt;image&gt;\\n&lt;prompt&gt;###Assistant:</span>',wrap:!1}}),ne=new Ce({props:{code:"QSUyMGNoYXQlMjBiZXR3ZWVuJTIwYSUyMGN1cmlvdXMlMjBodW1hbiUyMGFuZCUyMGFuJTIwYXJ0aWZpY2lhbCUyMGludGVsbGlnZW5jZSUyMGFzc2lzdGFudC4lMjBUaGUlMjBhc3Npc3RhbnQlMjBnaXZlcyUyMGhlbHBmdWwlMkMlMjBkZXRhaWxlZCUyQyUyMGFuZCUyMHBvbGl0ZSUyMGFuc3dlcnMlMjB0byUyMHRoZSUyMGh1bWFuJ3MlMjBxdWVzdGlvbnMuJTIzJTIzJTIzSHVtYW4lM0ElMjAlM0NpbWFnZSUzRSU1Q24lM0Nwcm9tcHQxJTNFJTIzJTIzJTIzQXNzaXN0YW50JTNBJTIwJTNDYW5zd2VyMSUzRSUyMyUyMyUyM0h1bWFuJTNBJTIwJTNDcHJvbXB0MiUzRSUyMyUyMyUyM0Fzc2lzdGFudCUzQQ==",highlighted:'A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human<span class="hljs-string">&#x27;s questions.###Human: &lt;image&gt;\\n&lt;prompt1&gt;###Assistant: &lt;answer1&gt;###Human: &lt;prompt2&gt;###Assistant:</span>',wrap:!1}}),oe=new Le({props:{title:"VipLlavaConfig",local:"transformers.VipLlavaConfig",headingTag:"h2"}}),ae=new xe({props:{name:"class transformers.VipLlavaConfig",anchor:"transformers.VipLlavaConfig",parameters:[{name:"vision_config",val:" = None"},{name:"text_config",val:" = None"},{name:"image_token_index",val:" = 32000"},{name:"projector_hidden_act",val:" = 'gelu'"},{name:"projector_layernorm_eps",val:" = 1e-05"},{name:"vision_feature_layers",val:" = [-2, -5, -8, -11, 6]"},{name:"image_seq_length",val:" = 576"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VipLlavaConfig.vision_config",description:`<strong>vision_config</strong> (<code>VipLlavaVisionConfig</code>,  <em>optional</em>) &#x2014;
Custom vision config or dict`,name:"vision_config"},{anchor:"transformers.VipLlavaConfig.text_config",description:`<strong>text_config</strong> (<code>Union[AutoConfig, dict]</code>, <em>optional</em>) &#x2014;
The config object of the text backbone. Can be any of <code>LlamaConfig</code> or <code>MistralConfig</code>.`,name:"text_config"},{anchor:"transformers.VipLlavaConfig.image_token_index",description:`<strong>image_token_index</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
The image token index to encode the image prompt.`,name:"image_token_index"},{anchor:"transformers.VipLlavaConfig.projector_hidden_act",description:`<strong>projector_hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The activation function used by the multimodal projector.`,name:"projector_hidden_act"},{anchor:"transformers.VipLlavaConfig.projector_layernorm_eps",description:`<strong>projector_layernorm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The layer norm epsilon of the projector layernorm`,name:"projector_layernorm_eps"},{anchor:"transformers.VipLlavaConfig.vision_feature_layers",description:`<strong>vision_feature_layers</strong> (<code>Union[int, List[int]]</code>, <em>optional</em>, defaults to <code>[-2, -5, -8, -11, 6]</code>) &#x2014;
The vision feature layer, or list of layers to select the vision features from.`,name:"vision_feature_layers"},{anchor:"transformers.VipLlavaConfig.image_seq_length",description:`<strong>image_seq_length</strong> (<code>int</code>, <em>optional</em>, defaults to 576) &#x2014;
Sequence length of one image embedding.`,name:"image_seq_length"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vipllava/configuration_vipllava.py#L24"}}),F=new St({props:{anchor:"transformers.VipLlavaConfig.example",$$slots:{default:[Kt]},$$scope:{ctx:C}}}),se=new Le({props:{title:"VipLlavaModel",local:"transformers.VipLlavaModel",headingTag:"h2"}}),ie=new xe({props:{name:"class transformers.VipLlavaModel",anchor:"transformers.VipLlavaModel",parameters:[{name:"config",val:": VipLlavaConfig"}],parametersDescription:[{anchor:"transformers.VipLlavaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaConfig">VipLlavaConfig</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/vipllava/modeling_vipllava.py#L162"}}),re=new xe({props:{name:"forward",anchor:"transformers.VipLlavaModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"pixel_values",val:": FloatTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"vision_feature_layers",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"**lm_kwargs",val:""}],parametersDescription:[{anchor:"transformers.VipLlavaModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.VipLlavaModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.VipLlavaModel.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.VipLlavaModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.VipLlavaModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>List[torch.FloatTensor]</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.VipLlavaModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.VipLlavaModel.forward.vision_feature_layers",description:`<strong>vision_feature_layers</strong> (<code>Union[int, List[int], NoneType]</code>, List[int]]\`, <em>optional</em>) &#x2014;
The vision feature layer, or the list of indexes of the layers to select
the vision feature.`,name:"vision_feature_layers"},{anchor:"transformers.VipLlavaModel.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.VipLlavaModel.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.VipLlavaModel.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.VipLlavaModel.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.VipLlavaModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vipllava/modeling_vipllava.py#L210",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vipllava.modeling_vipllava.VipLlavaModelOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaConfig"
>VipLlavaConfig</a>) 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>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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>
<li>
<p><strong>image_hidden_states</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — A <code>torch.FloatTensor</code> of size <code>(batch_size, num_images, sequence_length, hidden_size)</code>.
image_hidden_states of the model produced by the vision encoder and after projecting the last hidden state.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vipllava.modeling_vipllava.VipLlavaModelOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),G=new Rt({props:{$$slots:{default:[en]},$$scope:{ctx:C}}}),le=new xe({props:{name:"get_image_features",anchor:"transformers.VipLlavaModel.get_image_features",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"vision_feature_layers",val:": typing.Union[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.VipLlavaModel.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor]</code> of shape <code>(batch_size, channels, height, width)</code>) &#x2014;
The tensors corresponding to the input images.`,name:"pixel_values"},{anchor:"transformers.VipLlavaModel.get_image_features.vision_feature_layers",description:`<strong>vision_feature_layers</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The vision feature layer, or the list of indexes of the layers to select
the vision feature.`,name:"vision_feature_layers"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vipllava/modeling_vipllava.py#L184",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Image feature tensor of shape <code>(num_images, image_length, embed_dim)</code>).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>image_features (<code>torch.Tensor</code>)</p>
`}}),de=new Le({props:{title:"VipLlavaForConditionalGeneration",local:"transformers.VipLlavaForConditionalGeneration",headingTag:"h2"}}),ce=new xe({props:{name:"class transformers.VipLlavaForConditionalGeneration",anchor:"transformers.VipLlavaForConditionalGeneration",parameters:[{name:"config",val:": VipLlavaConfig"}],parametersDescription:[{anchor:"transformers.VipLlavaForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaConfig">VipLlavaConfig</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/vipllava/modeling_vipllava.py#L291"}}),pe=new xe({props:{name:"forward",anchor:"transformers.VipLlavaForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"pixel_values",val:": FloatTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"vision_feature_layers",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**lm_kwargs",val:""}],parametersDescription:[{anchor:"transformers.VipLlavaForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.VipLlavaForConditionalGeneration.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.VipLlavaForConditionalGeneration.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>List[torch.FloatTensor]</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.vision_feature_layers",description:`<strong>vision_feature_layers</strong> (<code>Union[int, List[int], NoneType]</code>, List[int]]\`, <em>optional</em>) &#x2014;
The vision feature layer, or the list of indexes of the layers to select
the vision feature.`,name:"vision_feature_layers"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.VipLlavaForConditionalGeneration.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.VipLlavaForConditionalGeneration.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.VipLlavaForConditionalGeneration.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.VipLlavaForConditionalGeneration.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.VipLlavaForConditionalGeneration.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.VipLlavaForConditionalGeneration.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>Union[int, torch.Tensor]</code>, defaults to <code>0</code>) &#x2014;
If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all
<code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension.
This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"logits_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vipllava/modeling_vipllava.py#L336",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vipllava.modeling_vipllava.VipLlavaCausalLMOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/vipllava#transformers.VipLlavaConfig"
>VipLlavaConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><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 (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</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>
<li>
<p><strong>image_hidden_states</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) — A <code>torch.FloatTensor</code> of size <code>(batch_size, num_images, sequence_length, hidden_size)</code>.
image_hidden_states of the model produced by the vision encoder and after projecting the last hidden state.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vipllava.modeling_vipllava.VipLlavaCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),I=new Rt({props:{$$slots:{default:[tn]},$$scope:{ctx:C}}}),W=new St({props:{anchor:"transformers.VipLlavaForConditionalGeneration.forward.example",$$slots:{default:[nn]},$$scope:{ctx:C}}}),me=new Ot({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/vipllava.md"}}),{c(){i=r("meta"),M=a(),m=r("p"),h=a(),u(b.$$.fragment),c=a(),w=r("div"),w.innerHTML=Tt,Ue=a(),u(N.$$.fragment),Ve=a(),H=r("p"),H.innerHTML=Mt,Je=a(),P=r("p"),P.textContent=wt,ze=a(),E=r("p"),E.textContent=kt,Fe=a(),R=r("p"),R.innerHTML=jt,Ge=a(),S=r("p"),S.innerHTML=xt,qe=a(),X=r("p"),X.innerHTML=Lt,Ie=a(),u(Y.$$.fragment),We=a(),Q=r("ul"),Q.innerHTML=$t,Ze=a(),A=r("blockquote"),A.innerHTML=Ct,Be=a(),D=r("ul"),D.innerHTML=Ut,Ne=a(),u(O.$$.fragment),He=a(),K=r("ul"),K.innerHTML=Vt,Pe=a(),u(ee.$$.fragment),Ee=a(),te=r("p"),te.textContent=Jt,Re=a(),u(ne.$$.fragment),Se=a(),u(oe.$$.fragment),Xe=a(),k=r("div"),u(ae.$$.fragment),nt=a(),ue=r("p"),ue.innerHTML=zt,ot=a(),ge=r("p"),ge.innerHTML=Ft,at=a(),fe=r("p"),fe.innerHTML=Gt,st=a(),u(F.$$.fragment),Ye=a(),u(se.$$.fragment),Qe=a(),T=r("div"),u(ie.$$.fragment),it=a(),_e=r("p"),_e.textContent=qt,rt=a(),ve=r("p"),ve.innerHTML=It,lt=a(),ye=r("p"),ye.innerHTML=Wt,dt=a(),U=r("div"),u(re.$$.fragment),ct=a(),be=r("p"),be.innerHTML=Zt,pt=a(),u(G.$$.fragment),mt=a(),q=r("div"),u(le.$$.fragment),ht=a(),Te=r("p"),Te.textContent=Bt,Ae=a(),u(de.$$.fragment),De=a(),j=r("div"),u(ce.$$.fragment),ut=a(),Me=r("p"),Me.textContent=Nt,gt=a(),we=r("p"),we.innerHTML=Ht,ft=a(),ke=r("p"),ke.innerHTML=Pt,_t=a(),$=r("div"),u(pe.$$.fragment),vt=a(),je=r("p"),je.innerHTML=Et,yt=a(),u(I.$$.fragment),bt=a(),u(W.$$.fragment),Oe=a(),u(me.$$.fragment),Ke=a(),$e=r("p"),this.h()},l(e){const t=Dt("svelte-u9bgzb",document.head);i=l(t,"META",{name:!0,content:!0}),t.forEach(n),M=s(e),m=l(e,"P",{}),B(m).forEach(n),h=s(e),g(b.$$.fragment,e),c=s(e),w=l(e,"DIV",{class:!0,"data-svelte-h":!0}),p(w)!=="svelte-b95w5j"&&(w.innerHTML=Tt),Ue=s(e),g(N.$$.fragment,e),Ve=s(e),H=l(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-7p4sji"&&(H.innerHTML=Mt),Je=s(e),P=l(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-9bd7s8"&&(P.textContent=wt),ze=s(e),E=l(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-vfdo9a"&&(E.textContent=kt),Fe=s(e),R=l(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-ym7i2j"&&(R.innerHTML=jt),Ge=s(e),S=l(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-14nivh0"&&(S.innerHTML=xt),qe=s(e),X=l(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-1q33811"&&(X.innerHTML=Lt),Ie=s(e),g(Y.$$.fragment,e),We=s(e),Q=l(e,"UL",{"data-svelte-h":!0}),p(Q)!=="svelte-1d63r4x"&&(Q.innerHTML=$t),Ze=s(e),A=l(e,"BLOCKQUOTE",{"data-svelte-h":!0}),p(A)!=="svelte-nygwxc"&&(A.innerHTML=Ct),Be=s(e),D=l(e,"UL",{"data-svelte-h":!0}),p(D)!=="svelte-s1gcn8"&&(D.innerHTML=Ut),Ne=s(e),g(O.$$.fragment,e),He=s(e),K=l(e,"UL",{"data-svelte-h":!0}),p(K)!=="svelte-c2nvp2"&&(K.innerHTML=Vt),Pe=s(e),g(ee.$$.fragment,e),Ee=s(e),te=l(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-mnlzle"&&(te.textContent=Jt),Re=s(e),g(ne.$$.fragment,e),Se=s(e),g(oe.$$.fragment,e),Xe=s(e),k=l(e,"DIV",{class:!0});var L=B(k);g(ae.$$.fragment,L),nt=s(L),ue=l(L,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-1pwp6tq"&&(ue.innerHTML=zt),ot=s(L),ge=l(L,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-1cp2sn1"&&(ge.innerHTML=Ft),at=s(L),fe=l(L,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-o55m63"&&(fe.innerHTML=Gt),st=s(L),g(F.$$.fragment,L),L.forEach(n),Ye=s(e),g(se.$$.fragment,e),Qe=s(e),T=l(e,"DIV",{class:!0});var x=B(T);g(ie.$$.fragment,x),it=s(x),_e=l(x,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-1f6fjiw"&&(_e.textContent=qt),rt=s(x),ve=l(x,"P",{"data-svelte-h":!0}),p(ve)!=="svelte-6pahdo"&&(ve.innerHTML=It),lt=s(x),ye=l(x,"P",{"data-svelte-h":!0}),p(ye)!=="svelte-hswkmf"&&(ye.innerHTML=Wt),dt=s(x),U=l(x,"DIV",{class:!0});var J=B(U);g(re.$$.fragment,J),ct=s(J),be=l(J,"P",{"data-svelte-h":!0}),p(be)!=="svelte-x4elke"&&(be.innerHTML=Zt),pt=s(J),g(G.$$.fragment,J),J.forEach(n),mt=s(x),q=l(x,"DIV",{class:!0});var he=B(q);g(le.$$.fragment,he),ht=s(he),Te=l(he,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-1vzo9k5"&&(Te.textContent=Bt),he.forEach(n),x.forEach(n),Ae=s(e),g(de.$$.fragment,e),De=s(e),j=l(e,"DIV",{class:!0});var V=B(j);g(ce.$$.fragment,V),ut=s(V),Me=l(V,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-1b0i2k4"&&(Me.textContent=Nt),gt=s(V),we=l(V,"P",{"data-svelte-h":!0}),p(we)!=="svelte-6pahdo"&&(we.innerHTML=Ht),ft=s(V),ke=l(V,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-hswkmf"&&(ke.innerHTML=Pt),_t=s(V),$=l(V,"DIV",{class:!0});var Z=B($);g(pe.$$.fragment,Z),vt=s(Z),je=l(Z,"P",{"data-svelte-h":!0}),p(je)!=="svelte-1e08quq"&&(je.innerHTML=Et),yt=s(Z),g(I.$$.fragment,Z),bt=s(Z),g(W.$$.fragment,Z),Z.forEach(n),V.forEach(n),Oe=s(e),g(me.$$.fragment,e),Ke=s(e),$e=l(e,"P",{}),B($e).forEach(n),this.h()},h(){z(i,"name","hf:doc:metadata"),z(i,"content",an),z(w,"class","flex flex-wrap space-x-1"),z(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(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,t){d(document.head,i),o(e,M,t),o(e,m,t),o(e,h,t),f(b,e,t),o(e,c,t),o(e,w,t),o(e,Ue,t),f(N,e,t),o(e,Ve,t),o(e,H,t),o(e,Je,t),o(e,P,t),o(e,ze,t),o(e,E,t),o(e,Fe,t),o(e,R,t),o(e,Ge,t),o(e,S,t),o(e,qe,t),o(e,X,t),o(e,Ie,t),f(Y,e,t),o(e,We,t),o(e,Q,t),o(e,Ze,t),o(e,A,t),o(e,Be,t),o(e,D,t),o(e,Ne,t),f(O,e,t),o(e,He,t),o(e,K,t),o(e,Pe,t),f(ee,e,t),o(e,Ee,t),o(e,te,t),o(e,Re,t),f(ne,e,t),o(e,Se,t),f(oe,e,t),o(e,Xe,t),o(e,k,t),f(ae,k,null),d(k,nt),d(k,ue),d(k,ot),d(k,ge),d(k,at),d(k,fe),d(k,st),f(F,k,null),o(e,Ye,t),f(se,e,t),o(e,Qe,t),o(e,T,t),f(ie,T,null),d(T,it),d(T,_e),d(T,rt),d(T,ve),d(T,lt),d(T,ye),d(T,dt),d(T,U),f(re,U,null),d(U,ct),d(U,be),d(U,pt),f(G,U,null),d(T,mt),d(T,q),f(le,q,null),d(q,ht),d(q,Te),o(e,Ae,t),f(de,e,t),o(e,De,t),o(e,j,t),f(ce,j,null),d(j,ut),d(j,Me),d(j,gt),d(j,we),d(j,ft),d(j,ke),d(j,_t),d(j,$),f(pe,$,null),d($,vt),d($,je),d($,yt),f(I,$,null),d($,bt),f(W,$,null),o(e,Oe,t),f(me,e,t),o(e,Ke,t),o(e,$e,t),et=!0},p(e,[t]){const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),F.$set(L);const x={};t&2&&(x.$$scope={dirty:t,ctx:e}),G.$set(x);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),I.$set(J);const he={};t&2&&(he.$$scope={dirty:t,ctx:e}),W.$set(he)},i(e){et||(_(b.$$.fragment,e),_(N.$$.fragment,e),_(Y.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(ne.$$.fragment,e),_(oe.$$.fragment,e),_(ae.$$.fragment,e),_(F.$$.fragment,e),_(se.$$.fragment,e),_(ie.$$.fragment,e),_(re.$$.fragment,e),_(G.$$.fragment,e),_(le.$$.fragment,e),_(de.$$.fragment,e),_(ce.$$.fragment,e),_(pe.$$.fragment,e),_(I.$$.fragment,e),_(W.$$.fragment,e),_(me.$$.fragment,e),et=!0)},o(e){v(b.$$.fragment,e),v(N.$$.fragment,e),v(Y.$$.fragment,e),v(O.$$.fragment,e),v(ee.$$.fragment,e),v(ne.$$.fragment,e),v(oe.$$.fragment,e),v(ae.$$.fragment,e),v(F.$$.fragment,e),v(se.$$.fragment,e),v(ie.$$.fragment,e),v(re.$$.fragment,e),v(G.$$.fragment,e),v(le.$$.fragment,e),v(de.$$.fragment,e),v(ce.$$.fragment,e),v(pe.$$.fragment,e),v(I.$$.fragment,e),v(W.$$.fragment,e),v(me.$$.fragment,e),et=!1},d(e){e&&(n(M),n(m),n(h),n(c),n(w),n(Ue),n(Ve),n(H),n(Je),n(P),n(ze),n(E),n(Fe),n(R),n(Ge),n(S),n(qe),n(X),n(Ie),n(We),n(Q),n(Ze),n(A),n(Be),n(D),n(Ne),n(He),n(K),n(Pe),n(Ee),n(te),n(Re),n(Se),n(Xe),n(k),n(Ye),n(Qe),n(T),n(Ae),n(De),n(j),n(Oe),n(Ke),n($e)),n(i),y(b,e),y(N,e),y(Y,e),y(O,e),y(ee,e),y(ne,e),y(oe,e),y(ae),y(F),y(se,e),y(ie),y(re),y(G),y(le),y(de,e),y(ce),y(pe),y(I),y(W),y(me,e)}}}const an='{"title":"VipLlava","local":"vipllava","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips:","local":"usage-tips","sections":[],"depth":2},{"title":"VipLlavaConfig","local":"transformers.VipLlavaConfig","sections":[],"depth":2},{"title":"VipLlavaModel","local":"transformers.VipLlavaModel","sections":[],"depth":2},{"title":"VipLlavaForConditionalGeneration","local":"transformers.VipLlavaForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function sn(C){return Yt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gn extends Qt{constructor(i){super(),At(this,i,sn,on,Xt,{})}}export{gn as component};
