import{s as ia,z as la,o as ca,n as No}from"../chunks/scheduler.18a86fab.js";import{S as da,i as ma,g as r,s as a,r as d,A as pa,h as i,f as o,c as s,j as $,u as m,x as c,k as y,y as l,a as n,v as p,d as h,t as g,w as f}from"../chunks/index.98837b22.js";import{T as sa}from"../chunks/Tip.77304350.js";import{D as z}from"../chunks/Docstring.6758ea23.js";import{C as G}from"../chunks/CodeBlock.8d0c2e8a.js";import{E as ra}from"../chunks/ExampleCodeBlock.0c42463f.js";import{P as ha}from"../chunks/PipelineTag.7749150e.js";import{H as J}from"../chunks/Heading.7e7e0c5b.js";import{E as ga}from"../chunks/index.499f366c.js";function fa(N){let u,M="Example:",v,T,b;return T=new G({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(){u=r("p"),u.textContent=M,v=a(),d(T.$$.fragment)},l(_){u=i(_,"P",{"data-svelte-h":!0}),c(u)!=="svelte-11lpom8"&&(u.textContent=M),v=s(_),m(T.$$.fragment,_)},m(_,I){n(_,u,I),n(_,v,I),p(T,_,I),b=!0},p:No,i(_){b||(h(T.$$.fragment,_),b=!0)},o(_){g(T.$$.fragment,_),b=!1},d(_){_&&(o(u),o(v)),f(T,_)}}}function ua(N){let u,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(){u=r("p"),u.innerHTML=M},l(v){u=i(v,"P",{"data-svelte-h":!0}),c(u)!=="svelte-fincs2"&&(u.innerHTML=M)},m(v,T){n(v,u,T)},p:No,d(v){v&&o(u)}}}function _a(N){let u,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(){u=r("p"),u.innerHTML=M},l(v){u=i(v,"P",{"data-svelte-h":!0}),c(u)!=="svelte-fincs2"&&(u.innerHTML=M)},m(v,T){n(v,u,T)},p:No,d(v){v&&o(u)}}}function va(N){let u,M="Example:",v,T,b;return T=new G({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(){u=r("p"),u.textContent=M,v=a(),d(T.$$.fragment)},l(_){u=i(_,"P",{"data-svelte-h":!0}),c(u)!=="svelte-11lpom8"&&(u.textContent=M),v=s(_),m(T.$$.fragment,_)},m(_,I){n(_,u,I),n(_,v,I),p(T,_,I),b=!0},p:No,i(_){b||(h(T.$$.fragment,_),b=!0)},o(_){g(T.$$.fragment,_),b=!1},d(_){_&&(o(u),o(v)),f(T,_)}}}function Ta(N){let u,M,v,T,b,_,I,gn='<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"/>',$t,K,Ct,ee,fn="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.",zt,te,un='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.',jt,oe,_n="The abstract from the paper is the following:",kt,ne,vn="<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>",qt,R,Tn,Ft,ae,yn='LLaVa architecture. Taken from the <a href="https://arxiv.org/abs/2304.08485">original paper.</a>',Nt,se,bn=`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>.`,Pt,re,Bt,ie,wn="<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>",Wt,le,Mn="<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>",Gt,ce,Zt,de,In="Each <strong>checkpoint</strong> is trained with a specific prompt format, depending on the underlying large language model backbone. To ensure correct formatting, use the processor’s <code>apply_chat_template</code> method.",St,me,Jn="<strong>Important:</strong>",Rt,pe,Ln="<li>You must construct a conversation history — passing a plain string won’t work.</li> <li>Each message should be a dictionary with <code>&quot;role&quot;</code> and <code>&quot;content&quot;</code> keys.</li> <li>The <code>&quot;content&quot;</code> should be a list of dictionaries for different modalities like <code>&quot;text&quot;</code> and <code>&quot;image&quot;</code>.</li>",Vt,he,Un=`Here’s an example of how to structure your input.
We will use <a href="https://huggingface.co/llava-hf/llava-1.5-7b-hf" rel="nofollow">llava-hf/llava-1.5-7b-hf</a> and a conversation history of text and image. Each content field has to be a list of dicts, as follows:`,Et,ge,Ht,fe,xn="<li>If you want to construct a chat prompt yourself, below is a list of prompt formats accepted by each llava checkpoint:</li>",Qt,ue,$n='<a href="https://huggingface.co/collections/llava-hf/llava-interleave-668e19a97da0036aad4a2f19" rel="nofollow">llava-interleave models</a> requires the following format:',At,_e,Xt,ve,Cn="For multiple turns conversation:",Dt,Te,Yt,ye,zn='<a href="https://huggingface.co/collections/llava-hf/llava-15-65f762d5b6941db5c2ba07e0" rel="nofollow">llava-1.5 models</a> requires the following format:',Ot,be,Kt,we,jn="For multiple turns conversation:",eo,Me,to,Ie,kn="🚀 <strong>Bonus:</strong> If you’re using <code>transformers&gt;=4.49.0</code>, you can also get a vectorized output from <code>apply_chat_template</code>. See the <strong>Usage Examples</strong> below for more details on how to use it.",oo,Je,no,Le,ao,Ue,so,xe,ro,$e,qn="LLaVa also supports batched inference. Here is how you can do it:",io,Ce,lo,ze,co,je,Fn='In order to match the logits of the <a href="https://github.com/haotian-liu/LLaVA/tree/main" rel="nofollow">original implementation</a>, one needs to additionally specify <code>do_pad=True</code> when instantiating <code>LLavaImageProcessor</code>:',mo,ke,po,qe,ho,Fe,Nn='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>.',go,Ne,fo,Pe,Pn="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BEiT.",uo,Be,_o,We,Bn='<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>',vo,Ge,To,L,Ze,Po,it,Wn=`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.`,Bo,lt,Gn='e.g. <a href="https://huggingface.co/llava-hf/llava-9b" rel="nofollow">llava-hf/llava-9b</a>',Wo,ct,Zn=`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.`,Go,V,yo,Se,bo,q,Re,Zo,dt,Sn="Constructs a LLaVa image processor.",So,E,Ve,Ro,mt,Rn="Preprocess an image or batch of images.",wo,Ee,Mo,F,He,Vo,pt,Vn="Constructs a fast Llava image processor.",Eo,ht,Qe,Io,Ae,Jo,U,Xe,Ho,gt,En="Constructs a LLaVa processor which wraps a LLaVa image processor and a LLaMa tokenizer into a single processor.",Qo,ft,Hn=`<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/llava#transformers.LlavaImageProcessor">LlavaImageProcessor</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.`,Ao,H,De,Xo,ut,Qn=`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.`,Do,Q,Ye,Yo,_t,An=`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.`,Lo,Oe,Uo,w,Ke,Oo,vt,Xn="The Llava model which consists of a vision backbone and a language model, without a language modeling head.",Ko,Tt,Dn=`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.)`,en,yt,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.`,tn,P,et,on,bt,On='The <a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaModel">LlavaModel</a> forward method, overrides the <code>__call__</code> special method.',nn,A,an,X,tt,sn,wt,Kn="Obtains image last hidden states from the vision tower and apply multimodal projection.",xo,ot,$o,x,nt,rn,Mt,ea="The LLAVA model which consists of a vision backbone and a language model.",ln,It,ta=`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.)`,cn,Jt,oa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,dn,j,at,mn,Lt,na='The <a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaForConditionalGeneration">LlavaForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',pn,D,hn,Y,Co,st,zo,xt,jo;return b=new J({props:{title:"LLaVa",local:"llava",headingTag:"h1"}}),K=new J({props:{title:"Overview",local:"overview",headingTag:"h2"}}),re=new J({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ce=new J({props:{title:"Formatting Prompts with Chat Templates",local:"formatting-prompts-with-chat-templates",headingTag:"h3"}}),ge=new G({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}}),_e=new G({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}}),Te=new G({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}}),be=new G({props:{code:"JTIyVVNFUiUzQSUyMCUzQ2ltYWdlJTNFJTVDbiUzQ3Byb21wdCUzRSUyMEFTU0lTVEFOVCUzQSUyMg==",highlighted:'<span class="hljs-string">&quot;USER: &lt;image&gt;\\n&lt;prompt&gt; ASSISTANT:&quot;</span>',wrap:!1}}),Me=new G({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}}),Je=new J({props:{title:"Usage examples",local:"usage-examples",headingTag:"h2"}}),Le=new J({props:{title:"Single input inference",local:"single-input-inference",headingTag:"h3"}}),Ue=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBJTIzJTIwTG9hZCUyMHRoZSUyMG1vZGVsJTIwaW4lMjBoYWxmLXByZWNpc2lvbiUwQW1vZGVsJTIwJTNEJTIwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmxsYXZhLWhmJTJGbGxhdmEtMS41LTdiLWhmJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIpJTBBJTBBY29udmVyc2F0aW9uJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hhdCUyMGlzJTIwc2hvd24lMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSU1RCUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMGNvbnZlcnNhdGlvbiUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKS50byhtb2RlbC5kZXZpY2UlMkMlMjB0b3JjaC5mbG9hdDE2KSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDMwKSUwQXByb2Nlc3Nvci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUp",highlighted:`<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>)

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;url&quot;</span>: <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&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>},
        ],
    },
]

inputs = processor.apply_chat_template(
    conversation,
    add_generation_prompt=<span class="hljs-literal">True</span>,
    tokenize=<span class="hljs-literal">True</span>,
    return_dict=<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}}),xe=new J({props:{title:"Batched inference",local:"batched-inference",headingTag:"h3"}}),Ce=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMExsYXZhRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBJTIzJTIwTG9hZCUyMHRoZSUyMG1vZGVsJTIwaW4lMjBoYWxmLXByZWNpc2lvbiUwQW1vZGVsJTIwJTNEJTIwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmxsYXZhLWhmJTJGbGxhdmEtMS41LTdiLWhmJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIpJTBBJTBBJTBBJTIzJTIwUHJlcGFyZSUyMGElMjBiYXRjaCUyMG9mJTIwdHdvJTIwcHJvbXB0cyUwQWNvbnZlcnNhdGlvbl8xJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZ3d3cuaWxhbmtlbG1hbi5vcmclMkZzdG9wc2lnbnMlMkZhdXN0cmFsaWEuanBnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hhdCUyMGlzJTIwc2hvd24lMjBpbiUyMHRoaXMlMjBpbWFnZSUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSU1RCUwQSUwQWNvbnZlcnNhdGlvbl8yJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoYXQlMjBpcyUyMHNob3duJTIwaW4lMjB0aGlzJTIwaW1hZ2UlM0YlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEElNUQlMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IuYXBwbHlfY2hhdF90ZW1wbGF0ZSglMEElMjAlMjAlMjAlMjAlNUJjb252ZXJzYXRpb25fMSUyQyUyMGNvbnZlcnNhdGlvbl8yJTVEJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl9kaWN0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSkudG8obW9kZWwuZGV2aWNlJTJDJTIwdG9yY2guZmxvYXQxNiklMEElMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QzMCklMEFwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<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"># 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;url&quot;</span>: <span class="hljs-string">&quot;https://www.ilankelman.org/stopsigns/australia.jpg&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;url&quot;</span>: <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&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>},
        ],
    },
]

inputs = processor.apply_chat_template(
    [conversation_1, conversation_2],
    add_generation_prompt=<span class="hljs-literal">True</span>,
    tokenize=<span class="hljs-literal">True</span>,
    return_dict=<span class="hljs-literal">True</span>,
    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}}),ze=new J({props:{title:"Note regarding reproducing original implementation",local:"note-regarding-reproducing-original-implementation",headingTag:"h2"}}),ke=new G({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExMYXZhSW1hZ2VQcm9jZXNzb3IlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBMTGF2YUltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGbGxhdmEtaGYlMkZsbGF2YS0xLjUtN2ItaGYlMjIlMkMlMjBkb19wYWQlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LLavaImageProcessor

image_processor = LLavaImageProcessor.from_pretrained(<span class="hljs-string">&quot;https://huggingface.co/llava-hf/llava-1.5-7b-hf&quot;</span>, do_pad=<span class="hljs-literal">True</span>)`,wrap:!1}}),qe=new J({props:{title:"Using Flash Attention 2",local:"using-flash-attention-2",headingTag:"h3"}}),Ne=new J({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Be=new ha({props:{pipeline:"image-to-text"}}),Ge=new J({props:{title:"LlavaConfig",local:"transformers.LlavaConfig",headingTag:"h2"}}),Ze=new z({props:{name:"class transformers.LlavaConfig",anchor:"transformers.LlavaConfig",parameters:[{name:"vision_config",val:" = None"},{name:"text_config",val:" = None"},{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.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>Union[int, List[int]]</code>, <em>optional</em>, defaults to -2) &#x2014;
The index of the layer to select the vision feature. If multiple indices are provided,
the vision feature of the corresponding indices will be concatenated to form the
vision features.`,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"}}),V=new ra({props:{anchor:"transformers.LlavaConfig.example",$$slots:{default:[fa]},$$scope:{ctx:N}}}),Se=new J({props:{title:"LlavaImageProcessor",local:"transformers.LlavaImageProcessor",headingTag:"h2"}}),Re=new z({props:{name:"class transformers.LlavaImageProcessor",anchor:"transformers.LlavaImageProcessor",parameters:[{name:"do_pad",val:": bool = False"},{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlavaImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to pad the image to a square based on the longest edge.
The padding value is determined by the <code>image_mean</code> parameter.
Can be overridden by <code>do_pad</code> in the <code>preprocess</code> method.`,name:"do_pad"},{anchor:"transformers.LlavaImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.LlavaImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.LlavaImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.LlavaImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image to the specified <code>crop_size</code>. Can be overridden by <code>do_center_crop</code> in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.LlavaImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to 224) &#x2014;
Size of the output image after applying <code>center_crop</code>. Can be overridden by <code>crop_size</code> in the <code>preprocess</code>
method.`,name:"crop_size"},{anchor:"transformers.LlavaImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.LlavaImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.LlavaImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.LlavaImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.LlavaImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.LlavaImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/image_processing_llava.py#L53"}}),Ve=new z({props:{name:"preprocess",anchor:"transformers.LlavaImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"resample",val:": typing.Optional[PIL.Image.Resampling] = None"},{name:"do_center_crop",val:": typing.Optional[bool] = None"},{name:"crop_size",val:": typing.Optional[int] = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_convert_rgb",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlavaImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_pad</code>) &#x2014;
Whether to pad the image to a square based on the longest edge.
The padding value is determined by the <code>image_mean</code> parameter.`,name:"do_pad"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.LlavaImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.LlavaImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.LlavaImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.LlavaImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.LlavaImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.LlavaImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.LlavaImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_convert_rgb</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.LlavaImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.LlavaImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.LlavaImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/image_processing_llava.py#L279"}}),Ee=new J({props:{title:"LlavaImageProcessorFast",local:"transformers.LlavaImageProcessorFast",headingTag:"h2"}}),He=new z({props:{name:"class transformers.LlavaImageProcessorFast",anchor:"transformers.LlavaImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.llava.image_processing_llava_fast.LlavaFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.LlavaImageProcessorFast.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.LlavaImageProcessorFast.size",description:`<strong>size</strong> (<code>dict[str, int]</code>, <em>optional</em>, defaults to <code>{&apos;shortest_edge&apos; -- 224}</code>):
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.LlavaImageProcessorFast.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.LlavaImageProcessorFast.resample",description:`<strong>resample</strong> (<code>Union[PILImageResampling, F.InterpolationMode, NoneType]</code>, defaults to <code>Resampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.LlavaImageProcessorFast.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.LlavaImageProcessorFast.crop_size",description:`<strong>crop_size</strong> (<code>dict[str, int]</code>, <em>optional</em>, defaults to <code>{&apos;height&apos; -- 224, &apos;width&apos;: 224}</code>):
Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.LlavaImageProcessorFast.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.LlavaImageProcessorFast.rescale_factor",description:`<strong>rescale_factor</strong> (<code>Union[int, float, NoneType]</code>, defaults to <code>0.00392156862745098</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.LlavaImageProcessorFast.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.LlavaImageProcessorFast.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], NoneType]</code>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.LlavaImageProcessorFast.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], NoneType]</code>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.LlavaImageProcessorFast.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.LlavaImageProcessorFast.return_tensors",description:"<strong>return_tensors</strong> (<code>Union[str, ~utils.generic.TensorType, NoneType]</code>, defaults to <code>None</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.LlavaImageProcessorFast.data_format",description:`<strong>data_format</strong> (<code>~image_utils.ChannelDimension</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.LlavaImageProcessorFast.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[~image_utils.ChannelDimension, str, NoneType]</code>, defaults to <code>None</code>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"},{anchor:"transformers.LlavaImageProcessorFast.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.LlavaImageProcessorFast.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to pad the image to a square based on the longest edge.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/image_processing_llava_fast.py#L71"}}),Qe=new z({props:{name:"preprocess",anchor:"transformers.LlavaImageProcessorFast.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.llava.image_processing_llava_fast.LlavaFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.LlavaImageProcessorFast.preprocess.images",description:`<strong>images</strong> (<code>Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[&apos;PIL.Image.Image&apos;], list[numpy.ndarray], list[&apos;torch.Tensor&apos;]]</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.size",description:`<strong>size</strong> (<code>dict[str, int]</code>, <em>optional</em>) &#x2014;
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.resample",description:`<strong>resample</strong> (<code>Union[PILImageResampling, F.InterpolationMode, NoneType]</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>dict[str, int]</code>, <em>optional</em>) &#x2014;
Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>Union[int, float, NoneType]</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], NoneType]</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], NoneType]</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.return_tensors",description:"<strong>return_tensors</strong> (<code>Union[str, ~utils.generic.TensorType, NoneType]</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.data_format",description:`<strong>data_format</strong> (<code>~image_utils.ChannelDimension</code>, <em>optional</em>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[~image_utils.ChannelDimension, str, NoneType]</code>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.LlavaImageProcessorFast.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to pad the image to a square based on the longest edge.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/image_processing_llava_fast.py#L90",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><strong>data</strong> (<code>dict</code>) — Dictionary of lists/arrays/tensors returned by the <strong>call</strong> method (‘pixel_values’, etc.).</li>
<li><strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) — You can give a tensor_type here to convert the lists of integers in PyTorch/TensorFlow/Numpy Tensors at
initialization.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>&lt;class 'transformers.image_processing_base.BatchFeature'&gt;</code></p>
`}}),Ae=new J({props:{title:"LlavaProcessor",local:"transformers.LlavaProcessor",headingTag:"h2"}}),Xe=new z({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/llava#transformers.LlavaImageProcessor">LlavaImageProcessor</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.
Should 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"}}),De=new z({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#L182"}}),Ye=new z({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#L190"}}),Oe=new J({props:{title:"LlavaModel",local:"transformers.LlavaModel",headingTag:"h2"}}),Ke=new z({props:{name:"class transformers.LlavaModel",anchor:"transformers.LlavaModel",parameters:[{name:"config",val:": LlavaConfig"}],parametersDescription:[{anchor:"transformers.LlavaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/llava#transformers.LlavaConfig">LlavaConfig</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/llava/modeling_llava.py#L161"}}),et=new z({props:{name:"forward",anchor:"transformers.LlavaModel.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.Union[int, typing.List[int], NoneType] = None"},{name:"vision_feature_select_strategy",val:": typing.Optional[str] = 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:"image_sizes",val:": Tensor = None"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.modeling_flash_attention_utils.FlashAttentionKwargs]"}],parametersDescription:[{anchor:"transformers.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.forward.vision_feature_layer",description:`<strong>vision_feature_layer</strong> (<code>Union[int, List[int], NoneType]</code>) &#x2014;
The index of the layer to select the vision feature. If multiple indices are provided,
the vision feature of the corresponding indices will be concatenated to form the
vision features.`,name:"vision_feature_layer"},{anchor:"transformers.LlavaModel.forward.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.
Can be one of <code>&quot;default&quot;</code> or <code>&quot;full&quot;</code>.`,name:"vision_feature_select_strategy"},{anchor:"transformers.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.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.LlavaModel.forward.image_sizes",description:`<strong>image_sizes</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, 2)</code>) &#x2014;
The sizes of the images in the batch, being (height, width) for each image.`,name:"image_sizes"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/modeling_llava.py#L229",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.llava.modeling_llava.LlavaModelOutputWithPast</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>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.llava.modeling_llava.LlavaModelOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),A=new sa({props:{$$slots:{default:[ua]},$$scope:{ctx:N}}}),tt=new z({props:{name:"get_image_features",anchor:"transformers.LlavaModel.get_image_features",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"vision_feature_layer",val:": typing.Union[int, typing.List[int]]"},{name:"vision_feature_select_strategy",val:": str"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlavaModel.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.LlavaModel.get_image_features.vision_feature_layer",description:`<strong>vision_feature_layer</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The index of the layer to select the vision feature. If multiple indices are provided,
the vision feature of the corresponding indices will be concatenated to form the
vision features.`,name:"vision_feature_layer"},{anchor:"transformers.LlavaModel.get_image_features.vision_feature_select_strategy",description:`<strong>vision_feature_select_strategy</strong> (<code>str</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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/modeling_llava.py#L183",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>
`}}),ot=new J({props:{title:"LlavaForConditionalGeneration",local:"transformers.LlavaForConditionalGeneration",headingTag:"h2"}}),nt=new z({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>) &#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#L321"}}),at=new z({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.Union[int, typing.List[int], NoneType] = 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:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"image_sizes",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.llava.modeling_llava.KwargsForCausalLM]"}],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.</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)</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.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>`,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>.</p>
<p><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>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.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>Union[int, List[int], NoneType]</code>) &#x2014;
The index of the layer to select the vision feature. If multiple indices are provided,
the vision feature of the corresponding indices will be concatenated to form the
vision features.`,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>) &#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.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.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.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"},{anchor:"transformers.LlavaForConditionalGeneration.forward.image_sizes",description:`<strong>image_sizes</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, 2)</code>, <em>optional</em>) &#x2014;
The sizes of the images in the batch, being (height, width) for each image.`,name:"image_sizes"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llava/modeling_llava.py#L366",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 <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.llava.modeling_llava.LlavaCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),D=new sa({props:{$$slots:{default:[_a]},$$scope:{ctx:N}}}),Y=new ra({props:{anchor:"transformers.LlavaForConditionalGeneration.forward.example",$$slots:{default:[va]},$$scope:{ctx:N}}}),st=new ga({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/llava.md"}}),{c(){u=r("meta"),M=a(),v=r("p"),T=a(),d(b.$$.fragment),_=a(),I=r("div"),I.innerHTML=gn,$t=a(),d(K.$$.fragment),Ct=a(),ee=r("p"),ee.textContent=fn,zt=a(),te=r("p"),te.innerHTML=un,jt=a(),oe=r("p"),oe.textContent=_n,kt=a(),ne=r("p"),ne.innerHTML=vn,qt=a(),R=r("img"),Ft=a(),ae=r("small"),ae.innerHTML=yn,Nt=a(),se=r("p"),se.innerHTML=bn,Pt=a(),d(re.$$.fragment),Bt=a(),ie=r("ul"),ie.innerHTML=wn,Wt=a(),le=r("blockquote"),le.innerHTML=Mn,Gt=a(),d(ce.$$.fragment),Zt=a(),de=r("p"),de.innerHTML=In,St=a(),me=r("p"),me.innerHTML=Jn,Rt=a(),pe=r("ul"),pe.innerHTML=Ln,Vt=a(),he=r("p"),he.innerHTML=Un,Et=a(),d(ge.$$.fragment),Ht=a(),fe=r("ul"),fe.innerHTML=xn,Qt=a(),ue=r("p"),ue.innerHTML=$n,At=a(),d(_e.$$.fragment),Xt=a(),ve=r("p"),ve.textContent=Cn,Dt=a(),d(Te.$$.fragment),Yt=a(),ye=r("p"),ye.innerHTML=zn,Ot=a(),d(be.$$.fragment),Kt=a(),we=r("p"),we.textContent=jn,eo=a(),d(Me.$$.fragment),to=a(),Ie=r("p"),Ie.innerHTML=kn,oo=a(),d(Je.$$.fragment),no=a(),d(Le.$$.fragment),ao=a(),d(Ue.$$.fragment),so=a(),d(xe.$$.fragment),ro=a(),$e=r("p"),$e.textContent=qn,io=a(),d(Ce.$$.fragment),lo=a(),d(ze.$$.fragment),co=a(),je=r("p"),je.innerHTML=Fn,mo=a(),d(ke.$$.fragment),po=a(),d(qe.$$.fragment),ho=a(),Fe=r("p"),Fe.innerHTML=Nn,go=a(),d(Ne.$$.fragment),fo=a(),Pe=r("p"),Pe.textContent=Pn,uo=a(),d(Be.$$.fragment),_o=a(),We=r("ul"),We.innerHTML=Bn,vo=a(),d(Ge.$$.fragment),To=a(),L=r("div"),d(Ze.$$.fragment),Po=a(),it=r("p"),it.innerHTML=Wn,Bo=a(),lt=r("p"),lt.innerHTML=Gn,Wo=a(),ct=r("p"),ct.innerHTML=Zn,Go=a(),d(V.$$.fragment),yo=a(),d(Se.$$.fragment),bo=a(),q=r("div"),d(Re.$$.fragment),Zo=a(),dt=r("p"),dt.textContent=Sn,So=a(),E=r("div"),d(Ve.$$.fragment),Ro=a(),mt=r("p"),mt.textContent=Rn,wo=a(),d(Ee.$$.fragment),Mo=a(),F=r("div"),d(He.$$.fragment),Vo=a(),pt=r("p"),pt.textContent=Vn,Eo=a(),ht=r("div"),d(Qe.$$.fragment),Io=a(),d(Ae.$$.fragment),Jo=a(),U=r("div"),d(Xe.$$.fragment),Ho=a(),gt=r("p"),gt.textContent=En,Qo=a(),ft=r("p"),ft.innerHTML=Hn,Ao=a(),H=r("div"),d(De.$$.fragment),Xo=a(),ut=r("p"),ut.innerHTML=Qn,Do=a(),Q=r("div"),d(Ye.$$.fragment),Yo=a(),_t=r("p"),_t.innerHTML=An,Lo=a(),d(Oe.$$.fragment),Uo=a(),w=r("div"),d(Ke.$$.fragment),Oo=a(),vt=r("p"),vt.textContent=Xn,Ko=a(),Tt=r("p"),Tt.innerHTML=Dn,en=a(),yt=r("p"),yt.innerHTML=Yn,tn=a(),P=r("div"),d(et.$$.fragment),on=a(),bt=r("p"),bt.innerHTML=On,nn=a(),d(A.$$.fragment),an=a(),X=r("div"),d(tt.$$.fragment),sn=a(),wt=r("p"),wt.textContent=Kn,xo=a(),d(ot.$$.fragment),$o=a(),x=r("div"),d(nt.$$.fragment),rn=a(),Mt=r("p"),Mt.textContent=ea,ln=a(),It=r("p"),It.innerHTML=ta,cn=a(),Jt=r("p"),Jt.innerHTML=oa,dn=a(),j=r("div"),d(at.$$.fragment),mn=a(),Lt=r("p"),Lt.innerHTML=na,pn=a(),d(D.$$.fragment),hn=a(),d(Y.$$.fragment),Co=a(),d(st.$$.fragment),zo=a(),xt=r("p"),this.h()},l(e){const t=pa("svelte-u9bgzb",document.head);u=i(t,"META",{name:!0,content:!0}),t.forEach(o),M=s(e),v=i(e,"P",{}),$(v).forEach(o),T=s(e),m(b.$$.fragment,e),_=s(e),I=i(e,"DIV",{class:!0,"data-svelte-h":!0}),c(I)!=="svelte-b95w5j"&&(I.innerHTML=gn),$t=s(e),m(K.$$.fragment,e),Ct=s(e),ee=i(e,"P",{"data-svelte-h":!0}),c(ee)!=="svelte-xhhjdz"&&(ee.textContent=fn),zt=s(e),te=i(e,"P",{"data-svelte-h":!0}),c(te)!=="svelte-iilyg8"&&(te.innerHTML=un),jt=s(e),oe=i(e,"P",{"data-svelte-h":!0}),c(oe)!=="svelte-vfdo9a"&&(oe.textContent=_n),kt=s(e),ne=i(e,"P",{"data-svelte-h":!0}),c(ne)!=="svelte-a2g4ox"&&(ne.innerHTML=vn),qt=s(e),R=i(e,"IMG",{src:!0,alt:!0,width:!0}),Ft=s(e),ae=i(e,"SMALL",{"data-svelte-h":!0}),c(ae)!=="svelte-16ml59q"&&(ae.innerHTML=yn),Nt=s(e),se=i(e,"P",{"data-svelte-h":!0}),c(se)!=="svelte-3u37is"&&(se.innerHTML=bn),Pt=s(e),m(re.$$.fragment,e),Bt=s(e),ie=i(e,"UL",{"data-svelte-h":!0}),c(ie)!=="svelte-1gvp0fc"&&(ie.innerHTML=wn),Wt=s(e),le=i(e,"BLOCKQUOTE",{"data-svelte-h":!0}),c(le)!=="svelte-nygwxc"&&(le.innerHTML=Mn),Gt=s(e),m(ce.$$.fragment,e),Zt=s(e),de=i(e,"P",{"data-svelte-h":!0}),c(de)!=="svelte-pavm2p"&&(de.innerHTML=In),St=s(e),me=i(e,"P",{"data-svelte-h":!0}),c(me)!=="svelte-1uqcr0x"&&(me.innerHTML=Jn),Rt=s(e),pe=i(e,"UL",{"data-svelte-h":!0}),c(pe)!=="svelte-imbcrg"&&(pe.innerHTML=Ln),Vt=s(e),he=i(e,"P",{"data-svelte-h":!0}),c(he)!=="svelte-1hj0jdv"&&(he.innerHTML=Un),Et=s(e),m(ge.$$.fragment,e),Ht=s(e),fe=i(e,"UL",{"data-svelte-h":!0}),c(fe)!=="svelte-rusc9d"&&(fe.innerHTML=xn),Qt=s(e),ue=i(e,"P",{"data-svelte-h":!0}),c(ue)!=="svelte-1qk1eny"&&(ue.innerHTML=$n),At=s(e),m(_e.$$.fragment,e),Xt=s(e),ve=i(e,"P",{"data-svelte-h":!0}),c(ve)!=="svelte-mnlzle"&&(ve.textContent=Cn),Dt=s(e),m(Te.$$.fragment,e),Yt=s(e),ye=i(e,"P",{"data-svelte-h":!0}),c(ye)!=="svelte-uxk0fh"&&(ye.innerHTML=zn),Ot=s(e),m(be.$$.fragment,e),Kt=s(e),we=i(e,"P",{"data-svelte-h":!0}),c(we)!=="svelte-mnlzle"&&(we.textContent=jn),eo=s(e),m(Me.$$.fragment,e),to=s(e),Ie=i(e,"P",{"data-svelte-h":!0}),c(Ie)!=="svelte-hqx9qk"&&(Ie.innerHTML=kn),oo=s(e),m(Je.$$.fragment,e),no=s(e),m(Le.$$.fragment,e),ao=s(e),m(Ue.$$.fragment,e),so=s(e),m(xe.$$.fragment,e),ro=s(e),$e=i(e,"P",{"data-svelte-h":!0}),c($e)!=="svelte-befb9w"&&($e.textContent=qn),io=s(e),m(Ce.$$.fragment,e),lo=s(e),m(ze.$$.fragment,e),co=s(e),je=i(e,"P",{"data-svelte-h":!0}),c(je)!=="svelte-1wciovq"&&(je.innerHTML=Fn),mo=s(e),m(ke.$$.fragment,e),po=s(e),m(qe.$$.fragment,e),ho=s(e),Fe=i(e,"P",{"data-svelte-h":!0}),c(Fe)!=="svelte-15nzlnu"&&(Fe.innerHTML=Nn),go=s(e),m(Ne.$$.fragment,e),fo=s(e),Pe=i(e,"P",{"data-svelte-h":!0}),c(Pe)!=="svelte-1bkfbxv"&&(Pe.textContent=Pn),uo=s(e),m(Be.$$.fragment,e),_o=s(e),We=i(e,"UL",{"data-svelte-h":!0}),c(We)!=="svelte-qnejrc"&&(We.innerHTML=Bn),vo=s(e),m(Ge.$$.fragment,e),To=s(e),L=i(e,"DIV",{class:!0});var C=$(L);m(Ze.$$.fragment,C),Po=s(C),it=i(C,"P",{"data-svelte-h":!0}),c(it)!=="svelte-1r3a7z"&&(it.innerHTML=Wn),Bo=s(C),lt=i(C,"P",{"data-svelte-h":!0}),c(lt)!=="svelte-d825u1"&&(lt.innerHTML=Gn),Wo=s(C),ct=i(C,"P",{"data-svelte-h":!0}),c(ct)!=="svelte-o55m63"&&(ct.innerHTML=Zn),Go=s(C),m(V.$$.fragment,C),C.forEach(o),yo=s(e),m(Se.$$.fragment,e),bo=s(e),q=i(e,"DIV",{class:!0});var Z=$(q);m(Re.$$.fragment,Z),Zo=s(Z),dt=i(Z,"P",{"data-svelte-h":!0}),c(dt)!=="svelte-bcnugk"&&(dt.textContent=Sn),So=s(Z),E=i(Z,"DIV",{class:!0});var rt=$(E);m(Ve.$$.fragment,rt),Ro=s(rt),mt=i(rt,"P",{"data-svelte-h":!0}),c(mt)!=="svelte-1x3yxsa"&&(mt.textContent=Rn),rt.forEach(o),Z.forEach(o),wo=s(e),m(Ee.$$.fragment,e),Mo=s(e),F=i(e,"DIV",{class:!0});var S=$(F);m(He.$$.fragment,S),Vo=s(S),pt=i(S,"P",{"data-svelte-h":!0}),c(pt)!=="svelte-1chufuc"&&(pt.textContent=Vn),Eo=s(S),ht=i(S,"DIV",{class:!0});var aa=$(ht);m(Qe.$$.fragment,aa),aa.forEach(o),S.forEach(o),Io=s(e),m(Ae.$$.fragment,e),Jo=s(e),U=i(e,"DIV",{class:!0});var B=$(U);m(Xe.$$.fragment,B),Ho=s(B),gt=i(B,"P",{"data-svelte-h":!0}),c(gt)!=="svelte-q5h2es"&&(gt.textContent=En),Qo=s(B),ft=i(B,"P",{"data-svelte-h":!0}),c(ft)!=="svelte-13p0v5j"&&(ft.innerHTML=Hn),Ao=s(B),H=i(B,"DIV",{class:!0});var ko=$(H);m(De.$$.fragment,ko),Xo=s(ko),ut=i(ko,"P",{"data-svelte-h":!0}),c(ut)!=="svelte-1o9eza"&&(ut.innerHTML=Qn),ko.forEach(o),Do=s(B),Q=i(B,"DIV",{class:!0});var qo=$(Q);m(Ye.$$.fragment,qo),Yo=s(qo),_t=i(qo,"P",{"data-svelte-h":!0}),c(_t)!=="svelte-kk16qw"&&(_t.innerHTML=An),qo.forEach(o),B.forEach(o),Lo=s(e),m(Oe.$$.fragment,e),Uo=s(e),w=i(e,"DIV",{class:!0});var k=$(w);m(Ke.$$.fragment,k),Oo=s(k),vt=i(k,"P",{"data-svelte-h":!0}),c(vt)!=="svelte-xujl0r"&&(vt.textContent=Xn),Ko=s(k),Tt=i(k,"P",{"data-svelte-h":!0}),c(Tt)!=="svelte-6pahdo"&&(Tt.innerHTML=Dn),en=s(k),yt=i(k,"P",{"data-svelte-h":!0}),c(yt)!=="svelte-hswkmf"&&(yt.innerHTML=Yn),tn=s(k),P=i(k,"DIV",{class:!0});var Ut=$(P);m(et.$$.fragment,Ut),on=s(Ut),bt=i(Ut,"P",{"data-svelte-h":!0}),c(bt)!=="svelte-yxfsh3"&&(bt.innerHTML=On),nn=s(Ut),m(A.$$.fragment,Ut),Ut.forEach(o),an=s(k),X=i(k,"DIV",{class:!0});var Fo=$(X);m(tt.$$.fragment,Fo),sn=s(Fo),wt=i(Fo,"P",{"data-svelte-h":!0}),c(wt)!=="svelte-1vzo9k5"&&(wt.textContent=Kn),Fo.forEach(o),k.forEach(o),xo=s(e),m(ot.$$.fragment,e),$o=s(e),x=i(e,"DIV",{class:!0});var W=$(x);m(nt.$$.fragment,W),rn=s(W),Mt=i(W,"P",{"data-svelte-h":!0}),c(Mt)!=="svelte-1d2owxz"&&(Mt.textContent=ea),ln=s(W),It=i(W,"P",{"data-svelte-h":!0}),c(It)!=="svelte-6pahdo"&&(It.innerHTML=ta),cn=s(W),Jt=i(W,"P",{"data-svelte-h":!0}),c(Jt)!=="svelte-hswkmf"&&(Jt.innerHTML=oa),dn=s(W),j=i(W,"DIV",{class:!0});var O=$(j);m(at.$$.fragment,O),mn=s(O),Lt=i(O,"P",{"data-svelte-h":!0}),c(Lt)!=="svelte-1n3tg9h"&&(Lt.innerHTML=na),pn=s(O),m(D.$$.fragment,O),hn=s(O),m(Y.$$.fragment,O),O.forEach(o),W.forEach(o),Co=s(e),m(st.$$.fragment,e),zo=s(e),xt=i(e,"P",{}),$(xt).forEach(o),this.h()},h(){y(u,"name","hf:doc:metadata"),y(u,"content",ya),y(I,"class","flex flex-wrap space-x-1"),la(R.src,Tn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/llava_architecture.jpg")||y(R,"src",Tn),y(R,"alt","drawing"),y(R,"width","600"),y(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(x,"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){l(document.head,u),n(e,M,t),n(e,v,t),n(e,T,t),p(b,e,t),n(e,_,t),n(e,I,t),n(e,$t,t),p(K,e,t),n(e,Ct,t),n(e,ee,t),n(e,zt,t),n(e,te,t),n(e,jt,t),n(e,oe,t),n(e,kt,t),n(e,ne,t),n(e,qt,t),n(e,R,t),n(e,Ft,t),n(e,ae,t),n(e,Nt,t),n(e,se,t),n(e,Pt,t),p(re,e,t),n(e,Bt,t),n(e,ie,t),n(e,Wt,t),n(e,le,t),n(e,Gt,t),p(ce,e,t),n(e,Zt,t),n(e,de,t),n(e,St,t),n(e,me,t),n(e,Rt,t),n(e,pe,t),n(e,Vt,t),n(e,he,t),n(e,Et,t),p(ge,e,t),n(e,Ht,t),n(e,fe,t),n(e,Qt,t),n(e,ue,t),n(e,At,t),p(_e,e,t),n(e,Xt,t),n(e,ve,t),n(e,Dt,t),p(Te,e,t),n(e,Yt,t),n(e,ye,t),n(e,Ot,t),p(be,e,t),n(e,Kt,t),n(e,we,t),n(e,eo,t),p(Me,e,t),n(e,to,t),n(e,Ie,t),n(e,oo,t),p(Je,e,t),n(e,no,t),p(Le,e,t),n(e,ao,t),p(Ue,e,t),n(e,so,t),p(xe,e,t),n(e,ro,t),n(e,$e,t),n(e,io,t),p(Ce,e,t),n(e,lo,t),p(ze,e,t),n(e,co,t),n(e,je,t),n(e,mo,t),p(ke,e,t),n(e,po,t),p(qe,e,t),n(e,ho,t),n(e,Fe,t),n(e,go,t),p(Ne,e,t),n(e,fo,t),n(e,Pe,t),n(e,uo,t),p(Be,e,t),n(e,_o,t),n(e,We,t),n(e,vo,t),p(Ge,e,t),n(e,To,t),n(e,L,t),p(Ze,L,null),l(L,Po),l(L,it),l(L,Bo),l(L,lt),l(L,Wo),l(L,ct),l(L,Go),p(V,L,null),n(e,yo,t),p(Se,e,t),n(e,bo,t),n(e,q,t),p(Re,q,null),l(q,Zo),l(q,dt),l(q,So),l(q,E),p(Ve,E,null),l(E,Ro),l(E,mt),n(e,wo,t),p(Ee,e,t),n(e,Mo,t),n(e,F,t),p(He,F,null),l(F,Vo),l(F,pt),l(F,Eo),l(F,ht),p(Qe,ht,null),n(e,Io,t),p(Ae,e,t),n(e,Jo,t),n(e,U,t),p(Xe,U,null),l(U,Ho),l(U,gt),l(U,Qo),l(U,ft),l(U,Ao),l(U,H),p(De,H,null),l(H,Xo),l(H,ut),l(U,Do),l(U,Q),p(Ye,Q,null),l(Q,Yo),l(Q,_t),n(e,Lo,t),p(Oe,e,t),n(e,Uo,t),n(e,w,t),p(Ke,w,null),l(w,Oo),l(w,vt),l(w,Ko),l(w,Tt),l(w,en),l(w,yt),l(w,tn),l(w,P),p(et,P,null),l(P,on),l(P,bt),l(P,nn),p(A,P,null),l(w,an),l(w,X),p(tt,X,null),l(X,sn),l(X,wt),n(e,xo,t),p(ot,e,t),n(e,$o,t),n(e,x,t),p(nt,x,null),l(x,rn),l(x,Mt),l(x,ln),l(x,It),l(x,cn),l(x,Jt),l(x,dn),l(x,j),p(at,j,null),l(j,mn),l(j,Lt),l(j,pn),p(D,j,null),l(j,hn),p(Y,j,null),n(e,Co,t),p(st,e,t),n(e,zo,t),n(e,xt,t),jo=!0},p(e,[t]){const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),V.$set(C);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),A.$set(Z);const rt={};t&2&&(rt.$$scope={dirty:t,ctx:e}),D.$set(rt);const S={};t&2&&(S.$$scope={dirty:t,ctx:e}),Y.$set(S)},i(e){jo||(h(b.$$.fragment,e),h(K.$$.fragment,e),h(re.$$.fragment,e),h(ce.$$.fragment,e),h(ge.$$.fragment,e),h(_e.$$.fragment,e),h(Te.$$.fragment,e),h(be.$$.fragment,e),h(Me.$$.fragment,e),h(Je.$$.fragment,e),h(Le.$$.fragment,e),h(Ue.$$.fragment,e),h(xe.$$.fragment,e),h(Ce.$$.fragment,e),h(ze.$$.fragment,e),h(ke.$$.fragment,e),h(qe.$$.fragment,e),h(Ne.$$.fragment,e),h(Be.$$.fragment,e),h(Ge.$$.fragment,e),h(Ze.$$.fragment,e),h(V.$$.fragment,e),h(Se.$$.fragment,e),h(Re.$$.fragment,e),h(Ve.$$.fragment,e),h(Ee.$$.fragment,e),h(He.$$.fragment,e),h(Qe.$$.fragment,e),h(Ae.$$.fragment,e),h(Xe.$$.fragment,e),h(De.$$.fragment,e),h(Ye.$$.fragment,e),h(Oe.$$.fragment,e),h(Ke.$$.fragment,e),h(et.$$.fragment,e),h(A.$$.fragment,e),h(tt.$$.fragment,e),h(ot.$$.fragment,e),h(nt.$$.fragment,e),h(at.$$.fragment,e),h(D.$$.fragment,e),h(Y.$$.fragment,e),h(st.$$.fragment,e),jo=!0)},o(e){g(b.$$.fragment,e),g(K.$$.fragment,e),g(re.$$.fragment,e),g(ce.$$.fragment,e),g(ge.$$.fragment,e),g(_e.$$.fragment,e),g(Te.$$.fragment,e),g(be.$$.fragment,e),g(Me.$$.fragment,e),g(Je.$$.fragment,e),g(Le.$$.fragment,e),g(Ue.$$.fragment,e),g(xe.$$.fragment,e),g(Ce.$$.fragment,e),g(ze.$$.fragment,e),g(ke.$$.fragment,e),g(qe.$$.fragment,e),g(Ne.$$.fragment,e),g(Be.$$.fragment,e),g(Ge.$$.fragment,e),g(Ze.$$.fragment,e),g(V.$$.fragment,e),g(Se.$$.fragment,e),g(Re.$$.fragment,e),g(Ve.$$.fragment,e),g(Ee.$$.fragment,e),g(He.$$.fragment,e),g(Qe.$$.fragment,e),g(Ae.$$.fragment,e),g(Xe.$$.fragment,e),g(De.$$.fragment,e),g(Ye.$$.fragment,e),g(Oe.$$.fragment,e),g(Ke.$$.fragment,e),g(et.$$.fragment,e),g(A.$$.fragment,e),g(tt.$$.fragment,e),g(ot.$$.fragment,e),g(nt.$$.fragment,e),g(at.$$.fragment,e),g(D.$$.fragment,e),g(Y.$$.fragment,e),g(st.$$.fragment,e),jo=!1},d(e){e&&(o(M),o(v),o(T),o(_),o(I),o($t),o(Ct),o(ee),o(zt),o(te),o(jt),o(oe),o(kt),o(ne),o(qt),o(R),o(Ft),o(ae),o(Nt),o(se),o(Pt),o(Bt),o(ie),o(Wt),o(le),o(Gt),o(Zt),o(de),o(St),o(me),o(Rt),o(pe),o(Vt),o(he),o(Et),o(Ht),o(fe),o(Qt),o(ue),o(At),o(Xt),o(ve),o(Dt),o(Yt),o(ye),o(Ot),o(Kt),o(we),o(eo),o(to),o(Ie),o(oo),o(no),o(ao),o(so),o(ro),o($e),o(io),o(lo),o(co),o(je),o(mo),o(po),o(ho),o(Fe),o(go),o(fo),o(Pe),o(uo),o(_o),o(We),o(vo),o(To),o(L),o(yo),o(bo),o(q),o(wo),o(Mo),o(F),o(Io),o(Jo),o(U),o(Lo),o(Uo),o(w),o(xo),o($o),o(x),o(Co),o(zo),o(xt)),o(u),f(b,e),f(K,e),f(re,e),f(ce,e),f(ge,e),f(_e,e),f(Te,e),f(be,e),f(Me,e),f(Je,e),f(Le,e),f(Ue,e),f(xe,e),f(Ce,e),f(ze,e),f(ke,e),f(qe,e),f(Ne,e),f(Be,e),f(Ge,e),f(Ze),f(V),f(Se,e),f(Re),f(Ve),f(Ee,e),f(He),f(Qe),f(Ae,e),f(Xe),f(De),f(Ye),f(Oe,e),f(Ke),f(et),f(A),f(tt),f(ot,e),f(nt),f(at),f(D),f(Y),f(st,e)}}}const ya='{"title":"LLaVa","local":"llava","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Formatting Prompts with Chat Templates","local":"formatting-prompts-with-chat-templates","sections":[],"depth":3}],"depth":2},{"title":"Usage examples","local":"usage-examples","sections":[{"title":"Single input inference","local":"single-input-inference","sections":[],"depth":3},{"title":"Batched inference","local":"batched-inference","sections":[],"depth":3}],"depth":2},{"title":"Note regarding reproducing original implementation","local":"note-regarding-reproducing-original-implementation","sections":[{"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":"LlavaImageProcessor","local":"transformers.LlavaImageProcessor","sections":[],"depth":2},{"title":"LlavaImageProcessorFast","local":"transformers.LlavaImageProcessorFast","sections":[],"depth":2},{"title":"LlavaProcessor","local":"transformers.LlavaProcessor","sections":[],"depth":2},{"title":"LlavaModel","local":"transformers.LlavaModel","sections":[],"depth":2},{"title":"LlavaForConditionalGeneration","local":"transformers.LlavaForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function ba(N){return ca(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class za extends da{constructor(u){super(),ma(this,u,ba,Ta,ia,{})}}export{za as component};
