import{s as bn,f as wn,o as Un,n as Qt}from"../chunks/scheduler.25b97de1.js";import{S as Jn,i as jn,g as l,s as o,r as m,A as Cn,h as r,f as n,c as s,j as W,u as h,x as d,k,y as p,a,v as u,d as g,t as f,w as _}from"../chunks/index.d9030fc9.js";import{T as $n}from"../chunks/Tip.baa67368.js";import{D as Ge}from"../chunks/Docstring.ffac8efa.js";import{C as V}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Tn}from"../chunks/ExampleCodeBlock.22dfe688.js";import{P as kn}from"../chunks/PipelineTag.5f100392.js";import{H as L,E as Ln}from"../chunks/EditOnGithub.91d95064.js";function In(I){let c,U="Example:",y,M,v;return M=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTIwTGxhdmFDb25maWclMkMlMjBDTElQVmlzaW9uQ29uZmlnJTJDJTIwTGxhbWFDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ0xJUC12aXNpb24lMjBjb25maWclMEF2aXNpb25fY29uZmlnJTIwJTNEJTIwQ0xJUFZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMExsYW1hJTIwY29uZmlnJTBBdGV4dF9jb25maWclMjAlM0QlMjBMbGFtYUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMExsYXZhJTIwbGxhdmEtMS41LTdiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMExsYXZhQ29uZmlnKHZpc2lvbl9jb25maWclMkMlMjB0ZXh0X2NvbmZpZyklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwbGxhdmEtMS41LTdiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBMbGF2YUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LlavaForConditionalGeneration, LlavaConfig, 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 Llava llava-1.5-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LlavaConfig(vision_config, text_config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the llava-1.5-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LlavaForConditionalGeneration(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(){c=l("p"),c.textContent=U,y=o(),m(M.$$.fragment)},l(i){c=r(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=U),y=s(i),h(M.$$.fragment,i)},m(i,T){a(i,c,T),a(i,y,T),u(M,i,T),v=!0},p:Qt,i(i){v||(g(M.$$.fragment,i),v=!0)},o(i){f(M.$$.fragment,i),v=!1},d(i){i&&(n(c),n(y)),_(M,i)}}}function xn(I){let c,U=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){c=l("p"),c.innerHTML=U},l(y){c=r(y,"P",{"data-svelte-h":!0}),d(c)!=="svelte-fincs2"&&(c.innerHTML=U)},m(y,M){a(y,c,M)},p:Qt,d(y){y&&n(c)}}}function zn(I){let c,U="Example:",y,M,v;return M=new V({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBMbGF2YUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIybGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyVVNFUiUzQSUyMCUzQ2ltYWdlJTNFJTVDbldoYXQncyUyMHRoZSUyMGNvbnRlbnQlMjBvZiUyMHRoZSUyMGltYWdlJTNGJTIwQVNTSVNUQU5UJTNBJTIyJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTUpJTBBcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LlavaForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = LlavaForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;llava-hf/llava-1.5-7b-hf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;llava-hf/llava-1.5-7b-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;USER: &lt;image&gt;\\nWhat&#x27;s the content of the image? ASSISTANT:&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

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

<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">15</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;USER:  \\nWhat&#x27;s the content of the image? ASSISTANT: The image features a busy city street with a stop sign prominently displayed&quot;</span>`,wrap:!1}}),{c(){c=l("p"),c.textContent=U,y=o(),m(M.$$.fragment)},l(i){c=r(i,"P",{"data-svelte-h":!0}),d(c)!=="svelte-11lpom8"&&(c.textContent=U),y=s(i),h(M.$$.fragment,i)},m(i,T){a(i,c,T),a(i,y,T),u(M,i,T),v=!0},p:Qt,i(i){v||(g(M.$$.fragment,i),v=!0)},o(i){f(M.$$.fragment,i),v=!1},d(i){i&&(n(c),n(y)),_(M,i)}}}function qn(I){let c,U,y,M,v,i,T,Ve,S,Ht="LLaVa is an open-source chatbot trained by fine-tuning LlamA/Vicuna on GPT-generated multimodal instruction-following data. It is an auto-regressive language model, based on the transformer architecture. In other words, it is an multi-modal version of LLMs fine-tuned for chat / instructions.",Se,E,Rt='The LLaVa model was proposed in <a href="https://arxiv.org/abs/2304.08485" rel="nofollow">Visual Instruction Tuning</a> and improved in <a href="https://arxiv.org/pdf/2310.03744" rel="nofollow">Improved Baselines with Visual Instruction Tuning</a> by Haotian Liu, Chunyuan Li, Yuheng Li and Yong Jae Lee.',Ee,Q,Xt="The abstract from the paper is the following:",Qe,H,Pt="<em>Large multimodal models (LMM) have recently shown encouraging progress with visual instruction tuning. In this note, we show that the fully-connected vision-language cross-modal connector in LLaVA is surprisingly powerful and data-efficient. With simple modifications to LLaVA, namely, using CLIP-ViT-L-336px with an MLP projection and adding academic-task-oriented VQA data with simple response formatting prompts, we establish stronger baselines that achieve state-of-the-art across 11 benchmarks. Our final 13B checkpoint uses merely 1.2M publicly available data, and finishes full training in ∼1 day on a single 8-A100 node. We hope this can make state-of-the-art LMM research more accessible. Code and model will be publicly available</em>",He,x,At,Re,R,Yt='LLaVa architecture. Taken from the <a href="https://arxiv.org/abs/2304.08485">original paper.</a>',Xe,X,Dt=`This model was contributed by <a href="https://huggingface.co/ArthurZ" rel="nofollow">ArthurZ</a> and <a href="https://huggingface.co/ybelkada" rel="nofollow">ybelkada</a>.
The original code can be found <a href="https://github.com/haotian-liu/LLaVA/tree/main/llava" rel="nofollow">here</a>.`,Pe,P,Ae,A,Ot="<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>",Ye,Y,Kt="<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>",De,D,Oe,O,en="For best 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:",Ke,K,et,ee,tt,te,tn="LLaVa also supports batched inference. Here is how you can do it:",nt,ne,at,ae,nn="<li>If you want to construct a chat prompt yourself, below is a list of prompt formats accepted by each llava checkpoint:</li>",ot,oe,an='<a href="https://huggingface.co/collections/llava-hf/llava-interleave-668e19a97da0036aad4a2f19" rel="nofollow">llava-interleave models</a> requires the following format:',st,se,lt,le,on="For multiple turns conversation:",rt,re,it,ie,sn='<a href="https://huggingface.co/collections/llava-hf/llava-15-65f762d5b6941db5c2ba07e0" rel="nofollow">llava-1.5 models</a> requires the following format:',ct,ce,dt,de,ln="For multiple turns conversation:",pt,pe,mt,me,ht,he,rn='Flash Attention 2 is an even faster, optimized version of the previous optimization, please refer to the <a href="https://huggingface.co/docs/transformers/perf_infer_gpu_one" rel="nofollow">Flash Attention 2 section of performance docs</a>.',ut,ue,gt,ge,cn="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BEiT.",ft,fe,_t,_e,dn='<li>A <a href="https://colab.research.google.com/drive/1qsl6cd2c8gGtEW1xV5io7S8NHh-Cp1TV?usp=sharing" rel="nofollow">Google Colab demo</a> on how to run Llava on a free-tier Google colab instance leveraging 4-bit inference.</li> <li>A <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LLaVa/Inference_with_LLaVa_for_multimodal_generation.ipynb" rel="nofollow">similar notebook</a> showcasing batched inference. 🌎</li>',Mt,Me,yt,b,ye,$t,ke,pn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaForConditionalGeneration">LlavaForConditionalGeneration</a>. It is used to instantiate an
Llava 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 Llava-9B.`,kt,Le,mn='e.g. <a href="https://huggingface.co/llava-hf/llava-9b" rel="nofollow">llava-hf/llava-9b</a>',Lt,Ie,hn=`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.`,It,z,vt,ve,Tt,w,Te,xt,xe,un="Constructs a Llava processor which wraps a Llava image processor and a Llava tokenizer into a single processor.",zt,ze,gn=`<a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaProcessor">LlavaProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaProcessor.decode">decode()</a> for more information.`,qt,q,be,Ft,qe,fn=`This method forwards all its arguments to LlamaTokenizerFast’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.`,Bt,F,we,Nt,Fe,_n=`This method forwards all its arguments to LlamaTokenizerFast’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.`,bt,Ue,wt,J,Je,Zt,Be,Mn=`The LLAVA model which consists of a vision backbone and a language model.
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.)`,Gt,Ne,yn=`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.`,Wt,$,je,Vt,Ze,vn='The <a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaForConditionalGeneration">LlavaForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',St,B,Et,N,Ut,Ce,Jt,We,jt;return v=new L({props:{title:"LLaVa",local:"llava",headingTag:"h1"}}),T=new L({props:{title:"Overview",local:"overview",headingTag:"h2"}}),P=new L({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),D=new L({props:{title:"Single image inference",local:"single-image-inference",headingTag:"h3"}}),K=new V({props:{code:"JTBBJTBBJTBBJTBBJTBBJTIyVVNFUiUzQSUyMCUzQ2ltYWdlJTNFJTVDbiUzQ1doYXQlRTIlODAlOTlzJTIwc2hvd24lMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUyMEFTU0lTVEFOVCUzQSUyMFRoaXMlMjBpbWFnZSUyMHNob3dzJTIwYSUyMHJlZCUyMHN0b3AlMjBzaWduLiUzQyUyRnMlM0VVU0VSJTNBJTIwRGVzY3JpYmUlMjB0aGUlMjBpbWFnZSUyMGluJTIwbW9yZSUyMGRldGFpbHMuJTIwQVNTSVNUQU5UJTNBJTIy",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/llava-1.5-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;USER: &lt;image&gt;\\n&lt;What’s shown in this image? ASSISTANT: This image shows a red stop sign.&lt;/s&gt;USER: Describe the image in more details. ASSISTANT:&quot;</span>`,wrap:!1}}),ee=new L({props:{title:"Batched inference",local:"batched-inference",headingTag:"h3"}}),ne=new V({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEElMjMlMjBMb2FkJTIwdGhlJTIwbW9kZWwlMjBpbiUyMGhhbGYtcHJlY2lzaW9uJTBBbW9kZWwlMjAlM0QlMjBMbGF2YUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIybGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJsbGF2YS1oZiUyRmxsYXZhLTEuNS03Yi1oZiUyMiklMEElMEElMjMlMjBHZXQlMjB0d28lMjBkaWZmZXJlbnQlMjBpbWFnZXMlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnd3dy5pbGFua2VsbWFuLm9yZyUyRnN0b3BzaWducyUyRmF1c3RyYWxpYS5qcGclMjIlMEFpbWFnZV9zdG9wJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZV9jYXRzJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQSUyMyUyMFByZXBhcmUlMjBhJTIwYmF0Y2glMjBvZiUyMHR3byUyMHByb21wdHMlMEFjb252ZXJzYXRpb25fMSUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoYXQlMjBpcyUyMHNob3duJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElNUQlMEElMEFjb252ZXJzYXRpb25fMiUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoYXQlMjBpcyUyMHNob3duJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElNUQlMEElMEFwcm9tcHRfMSUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKGNvbnZlcnNhdGlvbl8xJTJDJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSklMEFwcm9tcHRfMiUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKGNvbnZlcnNhdGlvbl8yJTJDJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSklMEFwcm9tcHRzJTIwJTNEJTIwJTVCcHJvbXB0XzElMkMlMjBwcm9tcHRfMiU1RCUwQSUwQSUyMyUyMFdlJTIwY2FuJTIwc2ltcGx5JTIwZmVlZCUyMGltYWdlcyUyMGluJTIwdGhlJTIwb3JkZXIlMjB0aGV5JTIwaGF2ZSUyMHRvJTIwYmUlMjB1c2VkJTIwaW4lMjB0aGUlMjB0ZXh0JTIwcHJvbXB0JTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRCU1QmltYWdlX3N0b3AlMkMlMjBpbWFnZV9jYXRzJTVEJTJDJTIwdGV4dCUzRHByb21wdHMlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKG1vZGVsLmRldmljZSUyQyUyMHRvcmNoLmZsb2F0MTYpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMzApJTBBcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSk=",highlighted:`<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LlavaForConditionalGeneration

<span class="hljs-comment"># Load the model in half-precision</span>
model = LlavaForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;llava-hf/llava-1.5-7b-hf&quot;</span>, torch_dtype=torch.float16, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;llava-hf/llava-1.5-7b-hf&quot;</span>)

<span class="hljs-comment"># Get two different images</span>
url = <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&quot;</span>
image_stop = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

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

<span class="hljs-comment"># Prepare a batch of two prompts</span>
conversation_1 = [
    {
        <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 is shown in this image?&quot;</span>},
        ],
    },
]

conversation_2 = [
    {
        <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 is shown in this image?&quot;</span>},
        ],
    },
]

prompt_1 = processor.apply_chat_template(conversation_1, add_generation_prompt=<span class="hljs-literal">True</span>)
prompt_2 = processor.apply_chat_template(conversation_2, add_generation_prompt=<span class="hljs-literal">True</span>)
prompts = [prompt_1, prompt_2]

<span class="hljs-comment"># We can simply feed images in the order they have to be used in the text prompt</span>
inputs = processor(images=[image_stop, image_cats], text=prompts, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device, torch.float16)

<span class="hljs-comment"># Generate</span>
generate_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">30</span>)
processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>)`,wrap:!1}}),se=new V({props:{code:"JTIyJTNDJTdDaW1fc3RhcnQlN0MlM0V1c2VyJTIwJTNDaW1hZ2UlM0UlNUNuV2hhdCUyMGlzJTIwc2hvd24lMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUzQyU3Q2ltX2VuZCU3QyUzRSUzQyU3Q2ltX3N0YXJ0JTdDJTNFYXNzaXN0YW50JTIy",highlighted:'<span class="hljs-string">&quot;&lt;|im_start|&gt;user &lt;image&gt;\\nWhat is shown in this image?&lt;|im_end|&gt;&lt;|im_start|&gt;assistant&quot;</span>',wrap:!1}}),re=new V({props:{code:"JTIyJTNDJTdDaW1fc3RhcnQlN0MlM0V1c2VyJTIwJTNDaW1hZ2UlM0UlNUNuJTNDcHJvbXB0MSUzRSUzQyU3Q2ltX2VuZCU3QyUzRSUzQyU3Q2ltX3N0YXJ0JTdDJTNFYXNzaXN0YW50JTIwJTNDYW5zd2VyMSUzRSUzQyU3Q2ltX2VuZCU3QyUzRSUzQyU3Q2ltX3N0YXJ0JTdDJTNFdXNlciUyMCUzQ2ltYWdlJTNFJTVDbiUzQ3Byb21wdDElM0UlM0MlN0NpbV9lbmQlN0MlM0UlM0MlN0NpbV9zdGFydCU3QyUzRWFzc2lzdGFudCUyMCUyMg==",highlighted:'<span class="hljs-string">&quot;&lt;|im_start|&gt;user &lt;image&gt;\\n&lt;prompt1&gt;&lt;|im_end|&gt;&lt;|im_start|&gt;assistant &lt;answer1&gt;&lt;|im_end|&gt;&lt;|im_start|&gt;user &lt;image&gt;\\n&lt;prompt1&gt;&lt;|im_end|&gt;&lt;|im_start|&gt;assistant &quot;</span>',wrap:!1}}),ce=new V({props:{code:"JTIyVVNFUiUzQSUyMCUzQ2ltYWdlJTNFJTVDbiUzQ3Byb21wdCUzRSUyMEFTU0lTVEFOVCUzQSUyMg==",highlighted:'<span class="hljs-string">&quot;USER: &lt;image&gt;\\n&lt;prompt&gt; ASSISTANT:&quot;</span>',wrap:!1}}),pe=new V({props:{code:"JTIyVVNFUiUzQSUyMCUzQ2ltYWdlJTNFJTVDbiUzQ3Byb21wdDElM0UlMjBBU1NJU1RBTlQlM0ElMjAlM0NhbnN3ZXIxJTNFJTNDJTJGcyUzRVVTRVIlM0ElMjAlM0Nwcm9tcHQyJTNFJTIwQVNTSVNUQU5UJTNBJTIwJTNDYW5zd2VyMiUzRSUzQyUyRnMlM0VVU0VSJTNBJTIwJTNDcHJvbXB0MyUzRSUyMEFTU0lTVEFOVCUzQSUyMg==",highlighted:'<span class="hljs-string">&quot;USER: &lt;image&gt;\\n&lt;prompt1&gt; ASSISTANT: &lt;answer1&gt;&lt;/s&gt;USER: &lt;prompt2&gt; ASSISTANT: &lt;answer2&gt;&lt;/s&gt;USER: &lt;prompt3&gt; ASSISTANT:&quot;</span>',wrap:!1}}),me=new L({props:{title:"Using Flash Attention 2",local:"using-flash-attention-2",headingTag:"h3"}}),ue=new L({props:{title:"Resources",local:"resources",headingTag:"h2"}}),fe=new kn({props:{pipeline:"image-to-text"}}),Me=new L({props:{title:"LlavaConfig",local:"transformers.LlavaConfig",headingTag:"h2"}}),ye=new Ge({props:{name:"class transformers.LlavaConfig",anchor:"transformers.LlavaConfig",parameters:[{name:"vision_config",val:" = None"},{name:"text_config",val:" = None"},{name:"ignore_index",val:" = -100"},{name:"image_token_index",val:" = 32000"},{name:"projector_hidden_act",val:" = 'gelu'"},{name:"vision_feature_select_strategy",val:" = 'default'"},{name:"vision_feature_layer",val:" = -2"},{name:"image_seq_length",val:" = 576"},{name:"multimodal_projector_bias",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlavaConfig.vision_config",description:`<strong>vision_config</strong> (<code>Union[AutoConfig, dict]</code>,  <em>optional</em>, defaults to <code>CLIPVisionConfig</code>) &#x2014;
The config object or dictionary of the vision backbone.`,name:"vision_config"},{anchor:"transformers.LlavaConfig.text_config",description:`<strong>text_config</strong> (<code>Union[AutoConfig, dict]</code>, <em>optional</em>, defaults to <code>LlamaConfig</code>) &#x2014;
The config object or dictionary of the text backbone.`,name:"text_config"},{anchor:"transformers.LlavaConfig.ignore_index",description:`<strong>ignore_index</strong> (<code>int</code>, <em>optional</em>, defaults to -100) &#x2014;
The ignore index for the loss function.`,name:"ignore_index"},{anchor:"transformers.LlavaConfig.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.LlavaConfig.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.LlavaConfig.vision_feature_select_strategy",description:`<strong>vision_feature_select_strategy</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;default&quot;</code>) &#x2014;
The feature selection strategy used to select the vision feature from the vision backbone.
Can be one of <code>&quot;default&quot;</code> or <code>&quot;full&quot;</code>.`,name:"vision_feature_select_strategy"},{anchor:"transformers.LlavaConfig.vision_feature_layer",description:`<strong>vision_feature_layer</strong> (<code>int</code>, <em>optional</em>, defaults to -2) &#x2014;
The index of the layer to select the vision feature.`,name:"vision_feature_layer"},{anchor:"transformers.LlavaConfig.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"},{anchor:"transformers.LlavaConfig.multimodal_projector_bias",description:`<strong>multimodal_projector_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use bias in the multimodal projector.`,name:"multimodal_projector_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/configuration_llava.py#L24"}}),z=new Tn({props:{anchor:"transformers.LlavaConfig.example",$$slots:{default:[In]},$$scope:{ctx:I}}}),ve=new L({props:{title:"LlavaProcessor",local:"transformers.LlavaProcessor",headingTag:"h2"}}),Te=new Ge({props:{name:"class transformers.LlavaProcessor",anchor:"transformers.LlavaProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"patch_size",val:" = None"},{name:"vision_feature_select_strategy",val:" = None"},{name:"chat_template",val:" = None"},{name:"image_token",val:" = '<image>'"},{name:"num_additional_image_tokens",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlavaProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.LlavaProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.LlavaProcessor.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Patch size from the vision tower.`,name:"patch_size"},{anchor:"transformers.LlavaProcessor.vision_feature_select_strategy",description:`<strong>vision_feature_select_strategy</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The feature selection strategy used to select the vision feature from the vision backbone.
Shoudl be same as in model&#x2019;s config`,name:"vision_feature_select_strategy"},{anchor:"transformers.LlavaProcessor.chat_template",description:`<strong>chat_template</strong> (<code>str</code>, <em>optional</em>) &#x2014; A Jinja template which will be used to convert lists of messages
in a chat into a tokenizable string.`,name:"chat_template"},{anchor:"transformers.LlavaProcessor.image_token",description:`<strong>image_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;image&gt;&quot;</code>) &#x2014;
Special token used to denote image location.`,name:"image_token"},{anchor:"transformers.LlavaProcessor.num_additional_image_tokens",description:`<strong>num_additional_image_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of additional tokens added to the image embeddings, such as CLS (+1). If the backbone has no CLS or other
extra tokens appended, no need to set this arg.`,name:"num_additional_image_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/processing_llava.py#L40"}}),be=new Ge({props:{name:"batch_decode",anchor:"transformers.LlavaProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/processing_llava.py#L175"}}),we=new Ge({props:{name:"decode",anchor:"transformers.LlavaProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/processing_llava.py#L183"}}),Ue=new L({props:{title:"LlavaForConditionalGeneration",local:"transformers.LlavaForConditionalGeneration",headingTag:"h2"}}),Je=new Ge({props:{name:"class transformers.LlavaForConditionalGeneration",anchor:"transformers.LlavaForConditionalGeneration",parameters:[{name:"config",val:": LlavaConfig"}],parametersDescription:[{anchor:"transformers.LlavaForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaConfig">LlavaConfig</a> or <code>LlavaVisionConfig</code>) &#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/llava/modeling_llava.py#L233"}}),je=new Ge({props:{name:"forward",anchor:"transformers.LlavaForConditionalGeneration.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_layer",val:": typing.Optional[int] = None"},{name:"vision_feature_select_strategy",val:": typing.Optional[str] = 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:"num_logits_to_keep",val:": int = 0"}],parametersDescription:[{anchor:"transformers.LlavaForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/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.LlavaForConditionalGeneration.forward.pixel_values",description:'<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)) -- The tensors corresponding to the input images. Pixel values can be obtained using [AutoImageProcessor](/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor). See [CLIPImageProcessor.__call__()](/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__) for details ([]</code>LlavaProcessor`] uses\n<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> for processing images).',name:"pixel_values"},{anchor:"transformers.LlavaForConditionalGeneration.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></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>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.LlavaForConditionalGeneration.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>. <a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.LlavaForConditionalGeneration.forward.past_key_values",description:`<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>) &#x2014;
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>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.forward.vision_feature_layer",description:`<strong>vision_feature_layer</strong> (<code>int</code>, <em>optional</em>, defaults to -2) &#x2014;
The index of the layer to select the vision feature.`,name:"vision_feature_layer"},{anchor:"transformers.LlavaForConditionalGeneration.forward.vision_feature_select_strategy",description:`<strong>vision_feature_select_strategy</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;default&quot;</code>) &#x2014;
The feature selection strategy used to select the vision feature from the vision backbone.
Can be one of <code>&quot;default&quot;</code> or <code>&quot;full&quot;</code>.`,name:"vision_feature_select_strategy"},{anchor:"transformers.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.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.LlavaForConditionalGeneration.forward.Args",description:`<strong>Args</strong> &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
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>.</p>
<p>num_logits_to_keep (<code>int</code>, <em>optional</em>):
Calculate logits for the last <code>num_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.`,name:"Args"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/modeling_llava.py#L383",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.llava.modeling_llava.LlavaCausalLMOutputWithPast</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/llava#transformers.LlavaConfig"
>LlavaConfig</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 (batch_size, num_images, sequence_length, hidden_size)\`.
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.llava.modeling_llava.LlavaCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),B=new $n({props:{$$slots:{default:[xn]},$$scope:{ctx:I}}}),N=new Tn({props:{anchor:"transformers.LlavaForConditionalGeneration.forward.example",$$slots:{default:[zn]},$$scope:{ctx:I}}}),Ce=new Ln({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/llava.md"}}),{c(){c=l("meta"),U=o(),y=l("p"),M=o(),m(v.$$.fragment),i=o(),m(T.$$.fragment),Ve=o(),S=l("p"),S.textContent=Ht,Se=o(),E=l("p"),E.innerHTML=Rt,Ee=o(),Q=l("p"),Q.textContent=Xt,Qe=o(),H=l("p"),H.innerHTML=Pt,He=o(),x=l("img"),Re=o(),R=l("small"),R.innerHTML=Yt,Xe=o(),X=l("p"),X.innerHTML=Dt,Pe=o(),m(P.$$.fragment),Ae=o(),A=l("ul"),A.innerHTML=Ot,Ye=o(),Y=l("blockquote"),Y.innerHTML=Kt,De=o(),m(D.$$.fragment),Oe=o(),O=l("p"),O.innerHTML=en,Ke=o(),m(K.$$.fragment),et=o(),m(ee.$$.fragment),tt=o(),te=l("p"),te.textContent=tn,nt=o(),m(ne.$$.fragment),at=o(),ae=l("ul"),ae.innerHTML=nn,ot=o(),oe=l("p"),oe.innerHTML=an,st=o(),m(se.$$.fragment),lt=o(),le=l("p"),le.textContent=on,rt=o(),m(re.$$.fragment),it=o(),ie=l("p"),ie.innerHTML=sn,ct=o(),m(ce.$$.fragment),dt=o(),de=l("p"),de.textContent=ln,pt=o(),m(pe.$$.fragment),mt=o(),m(me.$$.fragment),ht=o(),he=l("p"),he.innerHTML=rn,ut=o(),m(ue.$$.fragment),gt=o(),ge=l("p"),ge.textContent=cn,ft=o(),m(fe.$$.fragment),_t=o(),_e=l("ul"),_e.innerHTML=dn,Mt=o(),m(Me.$$.fragment),yt=o(),b=l("div"),m(ye.$$.fragment),$t=o(),ke=l("p"),ke.innerHTML=pn,kt=o(),Le=l("p"),Le.innerHTML=mn,Lt=o(),Ie=l("p"),Ie.innerHTML=hn,It=o(),m(z.$$.fragment),vt=o(),m(ve.$$.fragment),Tt=o(),w=l("div"),m(Te.$$.fragment),xt=o(),xe=l("p"),xe.textContent=un,zt=o(),ze=l("p"),ze.innerHTML=gn,qt=o(),q=l("div"),m(be.$$.fragment),Ft=o(),qe=l("p"),qe.innerHTML=fn,Bt=o(),F=l("div"),m(we.$$.fragment),Nt=o(),Fe=l("p"),Fe.innerHTML=_n,bt=o(),m(Ue.$$.fragment),wt=o(),J=l("div"),m(Je.$$.fragment),Zt=o(),Be=l("p"),Be.innerHTML=Mn,Gt=o(),Ne=l("p"),Ne.innerHTML=yn,Wt=o(),$=l("div"),m(je.$$.fragment),Vt=o(),Ze=l("p"),Ze.innerHTML=vn,St=o(),m(B.$$.fragment),Et=o(),m(N.$$.fragment),Ut=o(),m(Ce.$$.fragment),Jt=o(),We=l("p"),this.h()},l(e){const t=Cn("svelte-u9bgzb",document.head);c=r(t,"META",{name:!0,content:!0}),t.forEach(n),U=s(e),y=r(e,"P",{}),W(y).forEach(n),M=s(e),h(v.$$.fragment,e),i=s(e),h(T.$$.fragment,e),Ve=s(e),S=r(e,"P",{"data-svelte-h":!0}),d(S)!=="svelte-xhhjdz"&&(S.textContent=Ht),Se=s(e),E=r(e,"P",{"data-svelte-h":!0}),d(E)!=="svelte-iilyg8"&&(E.innerHTML=Rt),Ee=s(e),Q=r(e,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-vfdo9a"&&(Q.textContent=Xt),Qe=s(e),H=r(e,"P",{"data-svelte-h":!0}),d(H)!=="svelte-a2g4ox"&&(H.innerHTML=Pt),He=s(e),x=r(e,"IMG",{src:!0,alt:!0,width:!0}),Re=s(e),R=r(e,"SMALL",{"data-svelte-h":!0}),d(R)!=="svelte-16ml59q"&&(R.innerHTML=Yt),Xe=s(e),X=r(e,"P",{"data-svelte-h":!0}),d(X)!=="svelte-3u37is"&&(X.innerHTML=Dt),Pe=s(e),h(P.$$.fragment,e),Ae=s(e),A=r(e,"UL",{"data-svelte-h":!0}),d(A)!=="svelte-1gvp0fc"&&(A.innerHTML=Ot),Ye=s(e),Y=r(e,"BLOCKQUOTE",{"data-svelte-h":!0}),d(Y)!=="svelte-nygwxc"&&(Y.innerHTML=Kt),De=s(e),h(D.$$.fragment,e),Oe=s(e),O=r(e,"P",{"data-svelte-h":!0}),d(O)!=="svelte-1awenn5"&&(O.innerHTML=en),Ke=s(e),h(K.$$.fragment,e),et=s(e),h(ee.$$.fragment,e),tt=s(e),te=r(e,"P",{"data-svelte-h":!0}),d(te)!=="svelte-befb9w"&&(te.textContent=tn),nt=s(e),h(ne.$$.fragment,e),at=s(e),ae=r(e,"UL",{"data-svelte-h":!0}),d(ae)!=="svelte-rusc9d"&&(ae.innerHTML=nn),ot=s(e),oe=r(e,"P",{"data-svelte-h":!0}),d(oe)!=="svelte-1qk1eny"&&(oe.innerHTML=an),st=s(e),h(se.$$.fragment,e),lt=s(e),le=r(e,"P",{"data-svelte-h":!0}),d(le)!=="svelte-mnlzle"&&(le.textContent=on),rt=s(e),h(re.$$.fragment,e),it=s(e),ie=r(e,"P",{"data-svelte-h":!0}),d(ie)!=="svelte-uxk0fh"&&(ie.innerHTML=sn),ct=s(e),h(ce.$$.fragment,e),dt=s(e),de=r(e,"P",{"data-svelte-h":!0}),d(de)!=="svelte-mnlzle"&&(de.textContent=ln),pt=s(e),h(pe.$$.fragment,e),mt=s(e),h(me.$$.fragment,e),ht=s(e),he=r(e,"P",{"data-svelte-h":!0}),d(he)!=="svelte-15nzlnu"&&(he.innerHTML=rn),ut=s(e),h(ue.$$.fragment,e),gt=s(e),ge=r(e,"P",{"data-svelte-h":!0}),d(ge)!=="svelte-1bkfbxv"&&(ge.textContent=cn),ft=s(e),h(fe.$$.fragment,e),_t=s(e),_e=r(e,"UL",{"data-svelte-h":!0}),d(_e)!=="svelte-qnejrc"&&(_e.innerHTML=dn),Mt=s(e),h(Me.$$.fragment,e),yt=s(e),b=r(e,"DIV",{class:!0});var j=W(b);h(ye.$$.fragment,j),$t=s(j),ke=r(j,"P",{"data-svelte-h":!0}),d(ke)!=="svelte-1r3a7z"&&(ke.innerHTML=pn),kt=s(j),Le=r(j,"P",{"data-svelte-h":!0}),d(Le)!=="svelte-d825u1"&&(Le.innerHTML=mn),Lt=s(j),Ie=r(j,"P",{"data-svelte-h":!0}),d(Ie)!=="svelte-o55m63"&&(Ie.innerHTML=hn),It=s(j),h(z.$$.fragment,j),j.forEach(n),vt=s(e),h(ve.$$.fragment,e),Tt=s(e),w=r(e,"DIV",{class:!0});var C=W(w);h(Te.$$.fragment,C),xt=s(C),xe=r(C,"P",{"data-svelte-h":!0}),d(xe)!=="svelte-api29h"&&(xe.textContent=un),zt=s(C),ze=r(C,"P",{"data-svelte-h":!0}),d(ze)!=="svelte-1qpkvbj"&&(ze.innerHTML=gn),qt=s(C),q=r(C,"DIV",{class:!0});var $e=W(q);h(be.$$.fragment,$e),Ft=s($e),qe=r($e,"P",{"data-svelte-h":!0}),d(qe)!=="svelte-1o9eza"&&(qe.innerHTML=fn),$e.forEach(n),Bt=s(C),F=r(C,"DIV",{class:!0});var Ct=W(F);h(we.$$.fragment,Ct),Nt=s(Ct),Fe=r(Ct,"P",{"data-svelte-h":!0}),d(Fe)!=="svelte-kk16qw"&&(Fe.innerHTML=_n),Ct.forEach(n),C.forEach(n),bt=s(e),h(Ue.$$.fragment,e),wt=s(e),J=r(e,"DIV",{class:!0});var Z=W(J);h(Je.$$.fragment,Z),Zt=s(Z),Be=r(Z,"P",{"data-svelte-h":!0}),d(Be)!=="svelte-1ox7dlx"&&(Be.innerHTML=Mn),Gt=s(Z),Ne=r(Z,"P",{"data-svelte-h":!0}),d(Ne)!=="svelte-hswkmf"&&(Ne.innerHTML=yn),Wt=s(Z),$=r(Z,"DIV",{class:!0});var G=W($);h(je.$$.fragment,G),Vt=s(G),Ze=r(G,"P",{"data-svelte-h":!0}),d(Ze)!=="svelte-1n3tg9h"&&(Ze.innerHTML=vn),St=s(G),h(B.$$.fragment,G),Et=s(G),h(N.$$.fragment,G),G.forEach(n),Z.forEach(n),Ut=s(e),h(Ce.$$.fragment,e),Jt=s(e),We=r(e,"P",{}),W(We).forEach(n),this.h()},h(){k(c,"name","hf:doc:metadata"),k(c,"content",Fn),wn(x.src,At="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/llava_architecture.jpg")||k(x,"src",At),k(x,"alt","drawing"),k(x,"width","600"),k(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(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){p(document.head,c),a(e,U,t),a(e,y,t),a(e,M,t),u(v,e,t),a(e,i,t),u(T,e,t),a(e,Ve,t),a(e,S,t),a(e,Se,t),a(e,E,t),a(e,Ee,t),a(e,Q,t),a(e,Qe,t),a(e,H,t),a(e,He,t),a(e,x,t),a(e,Re,t),a(e,R,t),a(e,Xe,t),a(e,X,t),a(e,Pe,t),u(P,e,t),a(e,Ae,t),a(e,A,t),a(e,Ye,t),a(e,Y,t),a(e,De,t),u(D,e,t),a(e,Oe,t),a(e,O,t),a(e,Ke,t),u(K,e,t),a(e,et,t),u(ee,e,t),a(e,tt,t),a(e,te,t),a(e,nt,t),u(ne,e,t),a(e,at,t),a(e,ae,t),a(e,ot,t),a(e,oe,t),a(e,st,t),u(se,e,t),a(e,lt,t),a(e,le,t),a(e,rt,t),u(re,e,t),a(e,it,t),a(e,ie,t),a(e,ct,t),u(ce,e,t),a(e,dt,t),a(e,de,t),a(e,pt,t),u(pe,e,t),a(e,mt,t),u(me,e,t),a(e,ht,t),a(e,he,t),a(e,ut,t),u(ue,e,t),a(e,gt,t),a(e,ge,t),a(e,ft,t),u(fe,e,t),a(e,_t,t),a(e,_e,t),a(e,Mt,t),u(Me,e,t),a(e,yt,t),a(e,b,t),u(ye,b,null),p(b,$t),p(b,ke),p(b,kt),p(b,Le),p(b,Lt),p(b,Ie),p(b,It),u(z,b,null),a(e,vt,t),u(ve,e,t),a(e,Tt,t),a(e,w,t),u(Te,w,null),p(w,xt),p(w,xe),p(w,zt),p(w,ze),p(w,qt),p(w,q),u(be,q,null),p(q,Ft),p(q,qe),p(w,Bt),p(w,F),u(we,F,null),p(F,Nt),p(F,Fe),a(e,bt,t),u(Ue,e,t),a(e,wt,t),a(e,J,t),u(Je,J,null),p(J,Zt),p(J,Be),p(J,Gt),p(J,Ne),p(J,Wt),p(J,$),u(je,$,null),p($,Vt),p($,Ze),p($,St),u(B,$,null),p($,Et),u(N,$,null),a(e,Ut,t),u(Ce,e,t),a(e,Jt,t),a(e,We,t),jt=!0},p(e,[t]){const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),z.$set(j);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),B.$set(C);const $e={};t&2&&($e.$$scope={dirty:t,ctx:e}),N.$set($e)},i(e){jt||(g(v.$$.fragment,e),g(T.$$.fragment,e),g(P.$$.fragment,e),g(D.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(re.$$.fragment,e),g(ce.$$.fragment,e),g(pe.$$.fragment,e),g(me.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(Me.$$.fragment,e),g(ye.$$.fragment,e),g(z.$$.fragment,e),g(ve.$$.fragment,e),g(Te.$$.fragment,e),g(be.$$.fragment,e),g(we.$$.fragment,e),g(Ue.$$.fragment,e),g(Je.$$.fragment,e),g(je.$$.fragment,e),g(B.$$.fragment,e),g(N.$$.fragment,e),g(Ce.$$.fragment,e),jt=!0)},o(e){f(v.$$.fragment,e),f(T.$$.fragment,e),f(P.$$.fragment,e),f(D.$$.fragment,e),f(K.$$.fragment,e),f(ee.$$.fragment,e),f(ne.$$.fragment,e),f(se.$$.fragment,e),f(re.$$.fragment,e),f(ce.$$.fragment,e),f(pe.$$.fragment,e),f(me.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f(Me.$$.fragment,e),f(ye.$$.fragment,e),f(z.$$.fragment,e),f(ve.$$.fragment,e),f(Te.$$.fragment,e),f(be.$$.fragment,e),f(we.$$.fragment,e),f(Ue.$$.fragment,e),f(Je.$$.fragment,e),f(je.$$.fragment,e),f(B.$$.fragment,e),f(N.$$.fragment,e),f(Ce.$$.fragment,e),jt=!1},d(e){e&&(n(U),n(y),n(M),n(i),n(Ve),n(S),n(Se),n(E),n(Ee),n(Q),n(Qe),n(H),n(He),n(x),n(Re),n(R),n(Xe),n(X),n(Pe),n(Ae),n(A),n(Ye),n(Y),n(De),n(Oe),n(O),n(Ke),n(et),n(tt),n(te),n(nt),n(at),n(ae),n(ot),n(oe),n(st),n(lt),n(le),n(rt),n(it),n(ie),n(ct),n(dt),n(de),n(pt),n(mt),n(ht),n(he),n(ut),n(gt),n(ge),n(ft),n(_t),n(_e),n(Mt),n(yt),n(b),n(vt),n(Tt),n(w),n(bt),n(wt),n(J),n(Ut),n(Jt),n(We)),n(c),_(v,e),_(T,e),_(P,e),_(D,e),_(K,e),_(ee,e),_(ne,e),_(se,e),_(re,e),_(ce,e),_(pe,e),_(me,e),_(ue,e),_(fe,e),_(Me,e),_(ye),_(z),_(ve,e),_(Te),_(be),_(we),_(Ue,e),_(Je),_(je),_(B),_(N),_(Ce,e)}}}const Fn='{"title":"LLaVa","local":"llava","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Single image inference","local":"single-image-inference","sections":[],"depth":3},{"title":"Batched inference","local":"batched-inference","sections":[],"depth":3},{"title":"Using Flash Attention 2","local":"using-flash-attention-2","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"LlavaConfig","local":"transformers.LlavaConfig","sections":[],"depth":2},{"title":"LlavaProcessor","local":"transformers.LlavaProcessor","sections":[],"depth":2},{"title":"LlavaForConditionalGeneration","local":"transformers.LlavaForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function Bn(I){return Un(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hn extends Jn{constructor(c){super(),jn(this,c,Bn,qn,bn,{})}}export{Hn as component};
