import{s as en,A as tn,o as on,n as Uo}from"../chunks/scheduler.01eeda35.js";import{S as nn,i as sn,g as r,s,r as i,A as an,h as l,f as o,c as a,j as U,u as d,x as f,k as w,y as g,a as n,v as c,d as m,t as p,w as h}from"../chunks/index.6dd51b66.js";import{T as rn}from"../chunks/Tip.de9bae2b.js";import{D as v}from"../chunks/Docstring.cb556860.js";import{C as Z}from"../chunks/CodeBlock.19ec9b8c.js";import{E as Ko}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as I,E as ln}from"../chunks/index.58fe8f9d.js";function dn(R){let u,_;return u=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yVkxGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBRd2VuMlZMQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFF3ZW4yVkwlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUXdlbjJWTENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMFF3ZW4yLVZMLTdCJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBRd2VuMlZMRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2VLForConditionalGeneration, Qwen2VLConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2VL style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Qwen2VLConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the Qwen2-VL-7B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2VLForConditionalGeneration(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){i(u.$$.fragment)},l(y){d(u.$$.fragment,y)},m(y,T){c(u,y,T),_=!0},p:Uo,i(y){_||(m(u.$$.fragment,y),_=!0)},o(y){p(u.$$.fragment,y),_=!1},d(y){h(u,y)}}}function cn(R){let u,_=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){u=r("p"),u.innerHTML=_},l(y){u=l(y,"P",{"data-svelte-h":!0}),f(u)!=="svelte-fincs2"&&(u.innerHTML=_)},m(y,T){n(y,u,T)},p:Uo,d(y){y&&o(u)}}}function mn(R){let u,_="Example:",y,T,C;return T=new Z({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyMFF3ZW4yVkxGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMFF3ZW4yVkxGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMlF3ZW4lMkZRd2VuMi1WTC03Qi1JbnN0cnVjdCUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjItVkwtN0ItSW5zdHJ1Y3QlMjIpJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnd3dy5pbGFua2VsbWFuLm9yZyUyRnN0b3BzaWducyUyRmF1c3RyYWxpYS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEF0ZXh0JTIwJTNEJTIwcHJvY2Vzc29yLmFwcGx5X2NoYXRfdGVtcGxhdGUobWVzc2FnZXMlMkMlMjB0b2tlbml6ZSUzREZhbHNlJTJDJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRCU1QnRleHQlNUQlMkMlMjBpbWFnZXMlM0QlNUJpbWFnZSU1RCUyQyUyMHZpc2lvbl9pbmZvcyUzRCU1QnZpc2lvbl9pbmZvcyU1RCklMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cy5pbnB1dF9pZHMlMkMlMjBtYXhfbGVuZ3RoJTNEMzApJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",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, Qwen2VLForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2VLForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [
    {
        <span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>,
        <span class="hljs-string">&quot;content&quot;</span>: [
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;What is shown in this image?&quot;</span>},
        ],
    },
]
<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>text = processor.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>, add_generation_prompt=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=[text], images=[image], vision_infos=[vision_infos])

<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.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.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;The image shows a street scene with a red stop sign in the foreground. In the background, there is a large red gate with Chinese characters ...&quot;</span>`,wrap:!1}}),{c(){u=r("p"),u.textContent=_,y=s(),i(T.$$.fragment)},l(M){u=l(M,"P",{"data-svelte-h":!0}),f(u)!=="svelte-11lpom8"&&(u.textContent=_),y=a(M),d(T.$$.fragment,M)},m(M,Q){n(M,u,Q),n(M,y,Q),c(T,M,Q),C=!0},p:Uo,i(M){C||(m(T.$$.fragment,M),C=!0)},o(M){p(T.$$.fragment,M),C=!1},d(M){M&&(o(u),o(y)),h(T,M)}}}function pn(R){let u,_,y,T,C,M,Q,Io='<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"/>',rt,P,lt,H,bo='The <a href="https://qwenlm.github.io/blog/qwen2-vl/" rel="nofollow">Qwen2-VL</a> model is a major update to <a href="https://arxiv.org/pdf/2308.12966" rel="nofollow">Qwen-VL</a> from the Qwen team at Alibaba Research.',it,Y,jo="The abstract from the blog is the following:",dt,D,vo="<em>This blog introduces Qwen2-VL, an advanced version of the Qwen-VL model that has undergone significant enhancements over the past year. Key improvements include enhanced image comprehension, advanced video understanding, integrated visual agent functionality, and expanded multilingual support. The model architecture has been optimized for handling arbitrary image resolutions through Naive Dynamic Resolution support and utilizes Multimodal Rotary Position Embedding (M-ROPE) to effectively process both 1D textual and multi-dimensional visual data. This updated model demonstrates competitive performance against leading AI systems like GPT-4o and Claude 3.5 Sonnet in vision-related tasks and ranks highly among open-source models in text capabilities. These advancements make Qwen2-VL a versatile tool for various applications requiring robust multimodal processing and reasoning abilities.</em>",ct,W,Co,mt,O,Qo='Qwen2-VL architecture. Taken from the <a href="https://qwenlm.github.io/blog/qwen2-vl/">blog post.</a>',pt,K,Vo='This model was contributed by <a href="https://huggingface.co/simonJJJ" rel="nofollow">simonJJJ</a>.',ht,ee,gt,te,ut,oe,xo="The model can accept both images and videos as input. Here’s an example code for inference.",ft,ne,yt,se,Mt,ae,zo="The model can batch inputs composed of mixed samples of various types such as images, videos, and text. Here is an example.",wt,re,Tt,le,_t,ie,Jt,de,No="The model supports a wide range of resolution inputs. By default, it uses the native resolution for input, but higher resolutions can enhance performance at the cost of more computation. Users can set the minimum and maximum number of pixels to achieve an optimal configuration for their needs.",Ut,ce,It,me,Bo="In case of limited GPU RAM, one can reduce the resolution as follows:",bt,pe,jt,he,qo="This ensures each image gets encoded using a number between 256-1024 tokens. The 28 comes from the fact that the model uses a patch size of 14 and a temporal patch size of 2 (14 x 2 = 28).",vt,ge,Ct,ue,Lo="By default, images and video content are directly included in the conversation. When handling multiple images, it’s helpful to add labels to the images and videos for better reference. Users can control this behavior with the following settings:",Qt,fe,Vt,ye,xt,Me,Zo="First, make sure to install the latest version of Flash Attention 2:",zt,we,Nt,Te,Ro='Also, you should have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of the <a href="https://github.com/Dao-AILab/flash-attention" rel="nofollow">flash attention repository</a>. FlashAttention-2 can only be used when a model is loaded in <code>torch.float16</code> or <code>torch.bfloat16</code>.',Bt,_e,Wo="To load and run a model using Flash Attention-2, simply add <code>attn_implementation=&quot;flash_attention_2&quot;</code> when loading the model as follows:",qt,Je,Lt,Ue,Zt,b,Ie,to,$e,ko=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLModel">Qwen2VLModel</a>. It is used to instantiate a
Qwen2-VL model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of
Qwen2-VL-7B-Instruct <a href="https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct" rel="nofollow">Qwen/Qwen2-VL-7B-Instruct</a>.`,oo,Xe,Go=`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.`,no,k,Rt,be,Wt,x,je,so,Ae,Fo="Constructs a Qwen2-VL image processor that dynamically resizes images based on the original images.",ao,Ee,ve,kt,Ce,Gt,z,Qe,ro,Se,$o="Constructs a fast Qwen2-VL image processor that dynamically resizes images based on the original images.",lo,Pe,Ve,Ft,xe,$t,J,ze,io,He,Xo=`Constructs a Qwen2-VL processor which wraps a Qwen2-VL image processor and a Qwen2 tokenizer into a single processor.
<a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLProcessor">Qwen2VLProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor">Qwen2VLImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2TokenizerFast">Qwen2TokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLProcessor.decode">decode()</a> for more information.`,co,G,Ne,mo,Ye,Ao=`This method forwards all its arguments to Qwen2TokenizerFast’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.`,po,F,Be,ho,De,Eo=`This method forwards all its arguments to Qwen2TokenizerFast’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.`,go,$,qe,uo,Oe,So="Post-process the output of the model to decode the text.",Xt,Le,At,j,Ze,fo,Ke,Po=`The bare Qwen2VL Model outputting raw hidden-states without any specific head on top.
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.)`,yo,et,Ho=`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.`,Mo,tt,Re,Et,We,St,q,ke,wo,V,Ge,To,ot,Yo='The <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLForConditionalGeneration">Qwen2VLForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',_o,X,Jo,A,Pt,Fe,Ht,st,Yt;return C=new I({props:{title:"Qwen2-VL",local:"qwen2-vl",headingTag:"h1"}}),P=new I({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ee=new I({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),te=new I({props:{title:"Single Media inference",local:"single-media-inference",headingTag:"h3"}}),ne=new Z({props:{code:" ",highlighted:`
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor

<span class="hljs-comment"># Load the model in half-precision on the available device(s)</span>
model = Qwen2VLForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&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://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg&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 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)

<span class="hljs-comment"># Inference: Generation of the output</span>
output_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">128</span>)
generated_ids = [output_ids[<span class="hljs-built_in">len</span>(input_ids):] <span class="hljs-keyword">for</span> input_ids, output_ids <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(inputs.input_ids, output_ids)]
output_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">True</span>)
<span class="hljs-built_in">print</span>(output_text)



<span class="hljs-comment"># Video</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;video&quot;</span>, <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;/path/to/video.mp4&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 happened in the video?&quot;</span>},
        ],
    }
]

inputs = processor.apply_chat_template(
    conversation,
    video_fps=<span class="hljs-number">1</span>,
    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)


<span class="hljs-comment"># Inference: Generation of the output</span>
output_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">128</span>)
generated_ids = [output_ids[<span class="hljs-built_in">len</span>(input_ids):] <span class="hljs-keyword">for</span> input_ids, output_ids <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(inputs.input_ids, output_ids)]
output_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">True</span>)
<span class="hljs-built_in">print</span>(output_text)`,wrap:!1}}),se=new I({props:{title:"Batch Mixed Media Inference",local:"batch-mixed-media-inference",headingTag:"h3"}}),re=new Z({props:{code:"JTBBJTIzJTIwQ29udmVyc2F0aW9uJTIwZm9yJTIwdGhlJTIwZmlyc3QlMjBpbWFnZSUwQWNvbnZlcnNhdGlvbjElMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJwYXRoJTIyJTNBJTIwJTIyJTJGcGF0aCUyRnRvJTJGaW1hZ2UxLmpwZyUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMkRlc2NyaWJlJTIwdGhpcyUyMGltYWdlLiUyMiU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQSUyMyUyMENvbnZlcnNhdGlvbiUyMHdpdGglMjB0d28lMjBpbWFnZXMlMEFjb252ZXJzYXRpb24yJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycm9sZSUyMiUzQSUyMCUyMnVzZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJjb250ZW50JTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIycGF0aCUyMiUzQSUyMCUyMiUyRnBhdGglMkZ0byUyRmltYWdlMi5qcGclMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJwYXRoJTIyJTNBJTIwJTIyJTJGcGF0aCUyRnRvJTJGaW1hZ2UzLmpwZyUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoYXQlMjBpcyUyMHdyaXR0ZW4lMjBpbiUyMHRoZSUyMHBpY3R1cmVzJTNGJTIyJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTVEJTBBJTBBJTIzJTIwQ29udmVyc2F0aW9uJTIwd2l0aCUyMHB1cmUlMjB0ZXh0JTBBY29udmVyc2F0aW9uMyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMndobyUyMGFyZSUyMHlvdSUzRiUyMiUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQSUwQSUyMyUyMENvbnZlcnNhdGlvbiUyMHdpdGglMjBtaXhlZCUyMG1pZGlhJTBBY29udmVyc2F0aW9uNCUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiUyQyUyMCUyMnBhdGglMjIlM0ElMjAlMjIlMkZwYXRoJTJGdG8lMkZpbWFnZTMuanBnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIycGF0aCUyMiUzQSUyMCUyMiUyRnBhdGglMkZ0byUyRmltYWdlNC5qcGclMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIydmlkZW8lMjIlMkMlMjAlMjJwYXRoJTIyJTNBJTIwJTIyJTJGcGF0aCUyRnRvJTJGdmlkZW8uanBnJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMnRleHQlMjIlMkMlMjAlMjJ0ZXh0JTIyJTNBJTIwJTIyV2hhdCUyMGFyZSUyMHRoZSUyMGNvbW1vbiUyMGVsZW1lbnRzJTIwaW4lMjB0aGVzZSUyMG1lZGlhcyUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQWNvbnZlcnNhdGlvbnMlMjAlM0QlMjAlNUJjb252ZXJzYXRpb24xJTJDJTIwY29udmVyc2F0aW9uMiUyQyUyMGNvbnZlcnNhdGlvbjMlMkMlMjBjb252ZXJzYXRpb240JTVEJTBBJTIzJTIwUHJlcGFyYXRpb24lMjBmb3IlMjBiYXRjaCUyMGluZmVyZW5jZSUwQWlwbnV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMGNvbnZlcnNhdGlvbnMlMkMlMEElMjAlMjAlMjAlMjB2aWRlb19mcHMlM0QxJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl9kaWN0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpLnRvKG1vZGVsLmRldmljZSklMEElMEElMEElMjMlMjBCYXRjaCUyMEluZmVyZW5jZSUwQW91dHB1dF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTI4KSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjAlNUJvdXRwdXRfaWRzJTVCbGVuKGlucHV0X2lkcyklM0ElNUQlMjBmb3IlMjBpbnB1dF9pZHMlMkMlMjBvdXRwdXRfaWRzJTIwaW4lMjB6aXAoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG91dHB1dF9pZHMpJTVEJTBBb3V0cHV0X3RleHQlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RUcnVlKSUwQXByaW50KG91dHB1dF90ZXh0KQ==",highlighted:`
<span class="hljs-comment"># Conversation for the first image</span>
conversation1 = [
    {
        <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;path&quot;</span>: <span class="hljs-string">&quot;/path/to/image1.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;Describe this image.&quot;</span>}
        ]
    }
]

<span class="hljs-comment"># Conversation with two images</span>
conversation2 = [
    {
        <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;path&quot;</span>: <span class="hljs-string">&quot;/path/to/image2.jpg&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;/path/to/image3.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 written in the pictures?&quot;</span>}
        ]
    }
]

<span class="hljs-comment"># Conversation with pure text</span>
conversation3 = [
    {
        <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;who are you?&quot;</span>
    }
]


<span class="hljs-comment"># Conversation with mixed midia</span>
conversation4 = [
    {
        <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;path&quot;</span>: <span class="hljs-string">&quot;/path/to/image3.jpg&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;/path/to/image4.jpg&quot;</span>},
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;video&quot;</span>, <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;/path/to/video.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 are the common elements in these medias?&quot;</span>},
        ],
    }
]

conversations = [conversation1, conversation2, conversation3, conversation4]
<span class="hljs-comment"># Preparation for batch inference</span>
ipnuts = processor.apply_chat_template(
    conversations,
    video_fps=<span class="hljs-number">1</span>,
    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)


<span class="hljs-comment"># Batch Inference</span>
output_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">128</span>)
generated_ids = [output_ids[<span class="hljs-built_in">len</span>(input_ids):] <span class="hljs-keyword">for</span> input_ids, output_ids <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(inputs.input_ids, output_ids)]
output_text = processor.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">True</span>)
<span class="hljs-built_in">print</span>(output_text)`,wrap:!1}}),le=new I({props:{title:"Usage Tips",local:"usage-tips",headingTag:"h3"}}),ie=new I({props:{title:"Image Resolution trade-off",local:"image-resolution-trade-off",headingTag:"h4"}}),ce=new Z({props:{code:"bWluX3BpeGVscyUyMCUzRCUyMDIyNCoyMjQlMEFtYXhfcGl4ZWxzJTIwJTNEJTIwMjA0OCoyMDQ4JTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLVZMLTdCLUluc3RydWN0JTIyJTJDJTIwbWluX3BpeGVscyUzRG1pbl9waXhlbHMlMkMlMjBtYXhfcGl4ZWxzJTNEbWF4X3BpeGVscyk=",highlighted:`min_pixels = <span class="hljs-number">224</span>*<span class="hljs-number">224</span>
max_pixels = <span class="hljs-number">2048</span>*<span class="hljs-number">2048</span>
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>, min_pixels=min_pixels, max_pixels=max_pixels)`,wrap:!1}}),pe=new Z({props:{code:"bWluX3BpeGVscyUyMCUzRCUyMDI1NioyOCoyOCUwQW1heF9waXhlbHMlMjAlM0QlMjAxMDI0KjI4KjI4JTIwJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4yLVZMLTdCLUluc3RydWN0JTIyJTJDJTIwbWluX3BpeGVscyUzRG1pbl9waXhlbHMlMkMlMjBtYXhfcGl4ZWxzJTNEbWF4X3BpeGVscyk=",highlighted:`min_pixels = <span class="hljs-number">256</span>*<span class="hljs-number">28</span>*<span class="hljs-number">28</span>
max_pixels = <span class="hljs-number">1024</span>*<span class="hljs-number">28</span>*<span class="hljs-number">28</span> 
processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>, min_pixels=min_pixels, max_pixels=max_pixels)`,wrap:!1}}),ge=new I({props:{title:"Multiple Image Inputs",local:"multiple-image-inputs",headingTag:"h4"}}),fe=new Z({props:{code:" ",highlighted:`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;Hello, how are you?&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;I&#x27;m doing well, thank you for asking. How can I assist you today?&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;Can you describe these images and video?&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;image&quot;</span>}, 
            {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;video&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;These are from my vacation.&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;I&#x27;d be happy to describe the images and video for you. Could you please provide more context about your vacation?&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;It was a trip to the mountains. Can you see the details in the images and video?&quot;</span>
    }
]

<span class="hljs-comment"># default:</span>
prompt_without_id = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>)
<span class="hljs-comment"># Excepted output: &#x27;&lt;|im_start|&gt;system\\nYou are a helpful assistant.&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\n&lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;Hello, how are you?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\nI&#x27;m doing well, thank you for asking. How can I assist you today?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\nCan you describe these images and video?&lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;&lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;&lt;|vision_start|&gt;&lt;|video_pad|&gt;&lt;|vision_end|&gt;These are from my vacation.&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\nI&#x27;d be happy to describe the images and video for you. Could you please provide more context about your vacation?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\nIt was a trip to the mountains. Can you see the details in the images and video?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\n&#x27;</span>


<span class="hljs-comment"># add ids</span>
prompt_with_id = processor.apply_chat_template(conversation, add_generation_prompt=<span class="hljs-literal">True</span>, add_vision_id=<span class="hljs-literal">True</span>)
<span class="hljs-comment"># Excepted output: &#x27;&lt;|im_start|&gt;system\\nYou are a helpful assistant.&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\nPicture 1: &lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;Hello, how are you?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\nI&#x27;m doing well, thank you for asking. How can I assist you today?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\nCan you describe these images and video?Picture 2: &lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;Picture 3: &lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;Video 1: &lt;|vision_start|&gt;&lt;|video_pad|&gt;&lt;|vision_end|&gt;These are from my vacation.&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\nI&#x27;d be happy to describe the images and video for you. Could you please provide more context about your vacation?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;user\\nIt was a trip to the mountains. Can you see the details in the images and video?&lt;|im_end|&gt;\\n&lt;|im_start|&gt;assistant\\n&#x27;</span>
`,wrap:!1}}),ye=new I({props:{title:"Flash-Attention 2 to speed up generation",local:"flash-attention-2-to-speed-up-generation",headingTag:"h4"}}),we=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),Je=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yVkxGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMFF3ZW4yVkxGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlF3ZW4lMkZRd2VuMi1WTC03Qi1JbnN0cnVjdCUyMiUyQyUyMCUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMjAlMEElMjAlMjAlMjAlMjBhdHRuX2ltcGxlbWVudGF0aW9uJTNEJTIyZmxhc2hfYXR0ZW50aW9uXzIlMjIlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2VLForConditionalGeneration

model = Qwen2VLForConditionalGeneration.from_pretrained(
    <span class="hljs-string">&quot;Qwen/Qwen2-VL-7B-Instruct&quot;</span>, 
    torch_dtype=torch.bfloat16, 
    attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>,
)`,wrap:!1}}),Ue=new I({props:{title:"Qwen2VLConfig",local:"transformers.Qwen2VLConfig",headingTag:"h2"}}),Ie=new v({props:{name:"class transformers.Qwen2VLConfig",anchor:"transformers.Qwen2VLConfig",parameters:[{name:"vocab_size",val:" = 152064"},{name:"hidden_size",val:" = 8192"},{name:"intermediate_size",val:" = 29568"},{name:"num_hidden_layers",val:" = 80"},{name:"num_attention_heads",val:" = 64"},{name:"num_key_value_heads",val:" = 8"},{name:"hidden_act",val:" = 'silu'"},{name:"max_position_embeddings",val:" = 32768"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 1000000.0"},{name:"use_sliding_window",val:" = False"},{name:"sliding_window",val:" = 4096"},{name:"max_window_layers",val:" = 80"},{name:"attention_dropout",val:" = 0.0"},{name:"vision_config",val:" = None"},{name:"rope_scaling",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2VLConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 152064) &#x2014;
Vocabulary size of the Qwen2VL model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLModel">Qwen2VLModel</a>`,name:"vocab_size"},{anchor:"transformers.Qwen2VLConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8192) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Qwen2VLConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 29568) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Qwen2VLConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 80) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Qwen2VLConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Qwen2VLConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
<code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if
<code>num_key_value_heads=1</code> the model will use Multi Query Attention (MQA) otherwise GQA is used. When
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
by meanpooling all the original heads within that group. For more details checkout <a href="https://arxiv.org/pdf/2305.13245.pdf" rel="nofollow">this
paper</a>. If it is not specified, will default to <code>32</code>.`,name:"num_key_value_heads"},{anchor:"transformers.Qwen2VLConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.Qwen2VLConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 32768) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.Qwen2VLConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Qwen2VLConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.Qwen2VLConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.Qwen2VLConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model&#x2019;s input and output word embeddings should be tied.`,name:"tie_word_embeddings"},{anchor:"transformers.Qwen2VLConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 1000000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.Qwen2VLConfig.use_sliding_window",description:`<strong>use_sliding_window</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use sliding window attention.`,name:"use_sliding_window"},{anchor:"transformers.Qwen2VLConfig.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Sliding window attention (SWA) window size. If not specified, will default to <code>4096</code>.`,name:"sliding_window"},{anchor:"transformers.Qwen2VLConfig.max_window_layers",description:`<strong>max_window_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 80) &#x2014;
The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.`,name:"max_window_layers"},{anchor:"transformers.Qwen2VLConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Qwen2VLConfig.vision_config",description:`<strong>vision_config</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
The config for the visual encoder initialization.`,name:"vision_config"},{anchor:"transformers.Qwen2VLConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
and you expect the model to work on longer <code>max_position_embeddings</code>, we recommend you to update this value
accordingly.
Expected contents:
<code>rope_type</code> (<code>str</code>):
The sub-variant of RoPE to use. Can be one of [&#x2018;default&#x2019;, &#x2018;linear&#x2019;, &#x2018;dynamic&#x2019;, &#x2018;yarn&#x2019;, &#x2018;longrope&#x2019;,
&#x2018;llama3&#x2019;], with &#x2018;default&#x2019; being the original RoPE implementation.
<code>factor</code> (<code>float</code>, <em>optional</em>):
Used with all rope types except &#x2018;default&#x2019;. The scaling factor to apply to the RoPE embeddings. In
most scaling types, a <code>factor</code> of x will enable the model to handle sequences of length x <em>
original maximum pre-trained length.
<code>original_max_position_embeddings</code> (<code>int</code>, </em>optional<em>):
Used with &#x2018;dynamic&#x2019;, &#x2018;longrope&#x2019; and &#x2018;llama3&#x2019;. The original max position embeddings used during
pretraining.
<code>attention_factor</code> (<code>float</code>, </em>optional<em>):
Used with &#x2018;yarn&#x2019; and &#x2018;longrope&#x2019;. The scaling factor to be applied on the attention
computation. If unspecified, it defaults to value recommended by the implementation, using the
<code>factor</code> field to infer the suggested value.
<code>beta_fast</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for extrapolation (only) in the linear
ramp function. If unspecified, it defaults to 32.
<code>beta_slow</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for interpolation (only) in the linear
ramp function. If unspecified, it defaults to 1.
<code>short_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to short contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>long_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to long contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>low_freq_factor</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to low frequency components of the RoPE
<code>high_freq_factor</code> (<code>float</code>, </em>optional*):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to high frequency components of the RoPE`,name:"rope_scaling"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/configuration_qwen2_vl.py#L57"}}),k=new Ko({props:{anchor:"transformers.Qwen2VLConfig.example",$$slots:{default:[dn]},$$scope:{ctx:R}}}),be=new I({props:{title:"Qwen2VLImageProcessor",local:"transformers.Qwen2VLImageProcessor",headingTag:"h2"}}),je=new v({props:{name:"class transformers.Qwen2VLImageProcessor",anchor:"transformers.Qwen2VLImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{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:"min_pixels",val:": typing.Optional[int] = None"},{name:"max_pixels",val:": typing.Optional[int] = None"},{name:"patch_size",val:": int = 14"},{name:"temporal_patch_size",val:": int = 2"},{name:"merge_size",val:": int = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2VLImageProcessor.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.`,name:"do_resize"},{anchor:"transformers.Qwen2VLImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 56 * 56, &quot;longest_edge&quot;: 28 * 28 * 1280}</code>):
Size of the image after resizing. <code>shortest_edge</code> and <code>longest_edge</code> keys must be present.`,name:"size"},{anchor:"transformers.Qwen2VLImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BICUBIC</code>) &#x2014;
Resampling filter to use when resizing the image.`,name:"resample"},{anchor:"transformers.Qwen2VLImageProcessor.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>.`,name:"do_rescale"},{anchor:"transformers.Qwen2VLImageProcessor.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.`,name:"rescale_factor"},{anchor:"transformers.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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 for each channel in the image.`,name:"image_mean"},{anchor:"transformers.Qwen2VLImageProcessor.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 for each channel in the image.`,name:"image_std"},{anchor:"transformers.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>56 * 56</code>) &#x2014;
The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.Qwen2VLImageProcessor.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) &#x2014;
The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.Qwen2VLImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14) &#x2014;
The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.Qwen2VLImageProcessor.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.Qwen2VLImageProcessor.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The merge size of the vision encoder to llm encoder.`,name:"merge_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/image_processing_qwen2_vl.py#L87"}}),ve=new v({props:{name:"preprocess",anchor:"transformers.Qwen2VLImageProcessor.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:"videos",val:": typing.Union[list['PIL.Image.Image'], ForwardRef('np.ndarray'), ForwardRef('torch.Tensor'), list['np.ndarray'], list['torch.Tensor'], list[list['PIL.Image.Image']], list[list['np.ndarray']], list[list['torch.Tensor']]] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"min_pixels",val:": typing.Optional[int] = None"},{name:"max_pixels",val:": typing.Optional[int] = None"},{name:"resample",val:": Resampling = 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:"patch_size",val:": typing.Optional[int] = None"},{name:"temporal_patch_size",val:": typing.Optional[int] = None"},{name:"merge_size",val:": typing.Optional[int] = 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[transformers.image_utils.ChannelDimension, str, NoneType] = None"}],parametersDescription:[{anchor:"transformers.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.preprocess.videos",description:`<strong>videos</strong> (<code>VideoInput</code>) &#x2014;
Video to preprocess. Expects a single or batch of videos with pixel values ranging from 0 to 255. If
passing in videos with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"videos"},{anchor:"transformers.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.preprocess.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.min_pixels</code>) &#x2014;
The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.Qwen2VLImageProcessor.preprocess.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.max_pixels</code>) &#x2014;
The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.Qwen2VLImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
The spacial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.Qwen2VLImageProcessor.preprocess.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.temporal_patch_size</code>) &#x2014;
The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.Qwen2VLImageProcessor.preprocess.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.merge_size</code>) &#x2014;
The merge size of the vision encoder to llm encoder.`,name:"merge_size"},{anchor:"transformers.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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.Qwen2VLImageProcessor.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/qwen2_vl/image_processing_qwen2_vl.py#L301"}}),Ce=new I({props:{title:"Qwen2VLImageProcessorFast",local:"transformers.Qwen2VLImageProcessorFast",headingTag:"h2"}}),Qe=new v({props:{name:"class transformers.Qwen2VLImageProcessorFast",anchor:"transformers.Qwen2VLImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.qwen2_vl.image_processing_qwen2_vl_fast.Qwen2VLFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.Qwen2VLImageProcessorFast.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&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by the
<code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.Qwen2VLImageProcessorFast.size",description:`<strong>size</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.Qwen2VLImageProcessorFast.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.default_to_square</code>) &#x2014;
Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.Qwen2VLImageProcessorFast.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. Only has an effect if <code>do_resize</code> is set to <code>True</code>. Can be
overridden by the <code>resample</code> parameter in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.Qwen2VLImageProcessorFast.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 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.Qwen2VLImageProcessorFast.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 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.Qwen2VLImageProcessorFast.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 by the specified scale <code>rescale_factor</code>. Can be overridden by the
<code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.Qwen2VLImageProcessorFast.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Scale factor to use if rescaling the image. Only has an effect if <code>do_rescale</code> is set to <code>True</code>. Can be
overridden by the <code>rescale_factor</code> parameter in the <code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.Qwen2VLImageProcessorFast.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. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.Qwen2VLImageProcessorFast.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;
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. Can be
overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.Qwen2VLImageProcessorFast.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;
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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.return_tensors",description:"<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to <code>self.return_tensors</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.Qwen2VLImageProcessorFast.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.data_format</code>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.Qwen2VLImageProcessorFast.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>self.input_data_format</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.Qwen2VLImageProcessorFast.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>self.device</code>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.Qwen2VLImageProcessorFast.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>56 * 56</code>) &#x2014;
The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.Qwen2VLImageProcessorFast.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) &#x2014;
The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.Qwen2VLImageProcessorFast.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14) &#x2014;
The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.Qwen2VLImageProcessorFast.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.Qwen2VLImageProcessorFast.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The merge size of the vision encoder to llm encoder.`,name:"merge_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/image_processing_qwen2_vl_fast.py#L80"}}),Ve=new v({props:{name:"preprocess",anchor:"transformers.Qwen2VLImageProcessorFast.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:"videos",val:": typing.Union[list['PIL.Image.Image'], ForwardRef('np.ndarray'), ForwardRef('torch.Tensor'), list['np.ndarray'], list['torch.Tensor'], list[list['PIL.Image.Image']], list[list['np.ndarray']], list[list['torch.Tensor']]] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": typing.Union[ForwardRef('PILImageResampling'), ForwardRef('F.InterpolationMode'), NoneType] = 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:"min_pixels",val:": typing.Optional[int] = None"},{name:"max_pixels",val:": typing.Optional[int] = None"},{name:"patch_size",val:": typing.Optional[int] = None"},{name:"temporal_patch_size",val:": typing.Optional[int] = None"},{name:"merge_size",val:": typing.Optional[int] = 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[transformers.image_utils.ChannelDimension, str, NoneType] = None"},{name:"device",val:": typing.Optional[ForwardRef('torch.device')] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.preprocess.videos",description:`<strong>videos</strong> (<code>VideoInput</code>) &#x2014;
Video to preprocess. Expects a single or batch of videos with pixel values ranging from 0 to 255. If
passing in videos with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"videos"},{anchor:"transformers.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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. <code>shortest_edge</code> and <code>longest_edge</code> keys must be present.`,name:"size"},{anchor:"transformers.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.preprocess.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.min_pixels</code>) &#x2014;
The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.Qwen2VLImageProcessorFast.preprocess.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.max_pixels</code>) &#x2014;
The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.Qwen2VLImageProcessorFast.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
The spacial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.Qwen2VLImageProcessorFast.preprocess.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.temporal_patch_size</code>) &#x2014;
The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.Qwen2VLImageProcessorFast.preprocess.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.merge_size</code>) &#x2014;
The merge size of the vision encoder to llm encoder.`,name:"merge_size"},{anchor:"transformers.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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.Qwen2VLImageProcessorFast.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"},{anchor:"transformers.Qwen2VLImageProcessorFast.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/image_processing_qwen2_vl_fast.py#L254"}}),xe=new I({props:{title:"Qwen2VLProcessor",local:"transformers.Qwen2VLProcessor",headingTag:"h2"}}),ze=new v({props:{name:"class transformers.Qwen2VLProcessor",anchor:"transformers.Qwen2VLProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"chat_template",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2VLProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor">Qwen2VLImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Qwen2VLProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2TokenizerFast">Qwen2TokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.Qwen2VLProcessor.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/processing_qwen2_vl.py#L53"}}),Ne=new v({props:{name:"batch_decode",anchor:"transformers.Qwen2VLProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/processing_qwen2_vl.py#L168"}}),Be=new v({props:{name:"decode",anchor:"transformers.Qwen2VLProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/processing_qwen2_vl.py#L175"}}),qe=new v({props:{name:"post_process_image_text_to_text",anchor:"transformers.Qwen2VLProcessor.post_process_image_text_to_text",parameters:[{name:"generated_outputs",val:""},{name:"skip_special_tokens",val:" = True"},{name:"clean_up_tokenization_spaces",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2VLProcessor.post_process_image_text_to_text.generated_outputs",description:`<strong>generated_outputs</strong> (<code>torch.Tensor</code> or <code>np.ndarray</code>) &#x2014;
The output of the model <code>generate</code> function. The output is expected to be a tensor of shape <code>(batch_size, sequence_length)</code>
or <code>(sequence_length,)</code>.`,name:"generated_outputs"},{anchor:"transformers.Qwen2VLProcessor.post_process_image_text_to_text.skip_special_tokens",description:`<strong>skip_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to remove special tokens in the output. Argument passed to the tokenizer&#x2019;s <code>batch_decode</code> method.`,name:"skip_special_tokens"},{anchor:"transformers.Qwen2VLProcessor.post_process_image_text_to_text.Clean_up_tokenization_spaces",description:`<strong>Clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to clean up the tokenization spaces. Argument passed to the tokenizer&#x2019;s <code>batch_decode</code> method.`,name:"Clean_up_tokenization_spaces"},{anchor:"transformers.Qwen2VLProcessor.post_process_image_text_to_text.*kwargs",description:`*<strong>*kwargs</strong> &#x2014;
Additional arguments to be passed to the tokenizer&#x2019;s <code>batch_decode method</code>.`,name:"*kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/processing_qwen2_vl.py#L182",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The decoded text.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[str]</code></p>
`}}),Le=new I({props:{title:"Qwen2VLModel",local:"transformers.Qwen2VLModel",headingTag:"h2"}}),Ze=new v({props:{name:"class transformers.Qwen2VLModel",anchor:"transformers.Qwen2VLModel",parameters:[{name:"config",val:": Qwen2VLConfig"}],parametersDescription:[{anchor:"transformers.Qwen2VLModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLConfig">Qwen2VLConfig</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/qwen2_vl/modeling_qwen2_vl.py#L1015"}}),Re=new v({props:{name:"forward",anchor:"transformers.Qwen2VLModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = 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:"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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py#L1043"}}),We=new I({props:{title:"Qwen2VLForConditionalGeneration",local:"transformers.Qwen2VLForConditionalGeneration",headingTag:"h2"}}),ke=new v({props:{name:"class transformers.Qwen2VLForConditionalGeneration",anchor:"transformers.Qwen2VLForConditionalGeneration",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py#L1391"}}),Ge=new v({props:{name:"forward",anchor:"transformers.Qwen2VLForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = 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:"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:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_values_videos",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"video_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"rope_deltas",val:": typing.Optional[torch.LongTensor] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>. <a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Qwen2VLForConditionalGeneration.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.Qwen2VLForConditionalGeneration.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.Qwen2VLForConditionalGeneration.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.Qwen2VLForConditionalGeneration.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.Qwen2VLForConditionalGeneration.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.Qwen2VLForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape \`(seq_length, num_channels <em> image_size </em> image_size)) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">Qwen2VLImageProcessor.<strong>call</strong>()</a> for details. <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLProcessor">Qwen2VLProcessor</a> uses
<a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor">Qwen2VLImageProcessor</a> for processing images.`,name:"pixel_values"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.pixel_values_videos",description:`<strong>pixel_values_videos</strong> (<code>torch.FloatTensor</code> of shape \`(seq_length, num_channels <em> temporal_size </em> image_size * image_size)) &#x2014;
The tensors corresponding to the input videos. Pixel values can be obtained using
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">Qwen2VLImageProcessor.<strong>call</strong>()</a> for details. <a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLProcessor">Qwen2VLProcessor</a> uses
<a href="/docs/transformers/main/en/model_doc/qwen2_vl#transformers.Qwen2VLImageProcessor">Qwen2VLImageProcessor</a> for processing videos.`,name:"pixel_values_videos"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.image_grid_thw",description:`<strong>image_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_images, 3)</code>, <em>optional</em>) &#x2014;
The temporal, height and width of feature shape of each image in LLM.`,name:"image_grid_thw"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.video_grid_thw",description:`<strong>video_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_videos, 3)</code>, <em>optional</em>) &#x2014;
The temporal, height and width of feature shape of each video in LLM.`,name:"video_grid_thw"},{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.rope_deltas",description:`<strong>rope_deltas</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) &#x2014;
The rope index difference between sequence length and multimodal rope.`,name:"rope_deltas"},{anchor:"transformers.Qwen2VLForConditionalGeneration.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py#L1572",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLCausalLMOutputWithPast</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/qwen2_vl#transformers.Qwen2VLConfig"
>Qwen2VLConfig</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>rope_deltas</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) — The rope index difference between sequence length and multimodal rope.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLCausalLMOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new rn({props:{$$slots:{default:[cn]},$$scope:{ctx:R}}}),A=new Ko({props:{anchor:"transformers.Qwen2VLForConditionalGeneration.forward.example",$$slots:{default:[mn]},$$scope:{ctx:R}}}),Fe=new ln({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/qwen2_vl.md"}}),{c(){u=r("meta"),_=s(),y=r("p"),T=s(),i(C.$$.fragment),M=s(),Q=r("div"),Q.innerHTML=Io,rt=s(),i(P.$$.fragment),lt=s(),H=r("p"),H.innerHTML=bo,it=s(),Y=r("p"),Y.textContent=jo,dt=s(),D=r("p"),D.innerHTML=vo,ct=s(),W=r("img"),mt=s(),O=r("small"),O.innerHTML=Qo,pt=s(),K=r("p"),K.innerHTML=Vo,ht=s(),i(ee.$$.fragment),gt=s(),i(te.$$.fragment),ut=s(),oe=r("p"),oe.textContent=xo,ft=s(),i(ne.$$.fragment),yt=s(),i(se.$$.fragment),Mt=s(),ae=r("p"),ae.textContent=zo,wt=s(),i(re.$$.fragment),Tt=s(),i(le.$$.fragment),_t=s(),i(ie.$$.fragment),Jt=s(),de=r("p"),de.textContent=No,Ut=s(),i(ce.$$.fragment),It=s(),me=r("p"),me.textContent=Bo,bt=s(),i(pe.$$.fragment),jt=s(),he=r("p"),he.textContent=qo,vt=s(),i(ge.$$.fragment),Ct=s(),ue=r("p"),ue.textContent=Lo,Qt=s(),i(fe.$$.fragment),Vt=s(),i(ye.$$.fragment),xt=s(),Me=r("p"),Me.textContent=Zo,zt=s(),i(we.$$.fragment),Nt=s(),Te=r("p"),Te.innerHTML=Ro,Bt=s(),_e=r("p"),_e.innerHTML=Wo,qt=s(),i(Je.$$.fragment),Lt=s(),i(Ue.$$.fragment),Zt=s(),b=r("div"),i(Ie.$$.fragment),to=s(),$e=r("p"),$e.innerHTML=ko,oo=s(),Xe=r("p"),Xe.innerHTML=Go,no=s(),i(k.$$.fragment),Rt=s(),i(be.$$.fragment),Wt=s(),x=r("div"),i(je.$$.fragment),so=s(),Ae=r("p"),Ae.textContent=Fo,ao=s(),Ee=r("div"),i(ve.$$.fragment),kt=s(),i(Ce.$$.fragment),Gt=s(),z=r("div"),i(Qe.$$.fragment),ro=s(),Se=r("p"),Se.textContent=$o,lo=s(),Pe=r("div"),i(Ve.$$.fragment),Ft=s(),i(xe.$$.fragment),$t=s(),J=r("div"),i(ze.$$.fragment),io=s(),He=r("p"),He.innerHTML=Xo,co=s(),G=r("div"),i(Ne.$$.fragment),mo=s(),Ye=r("p"),Ye.innerHTML=Ao,po=s(),F=r("div"),i(Be.$$.fragment),ho=s(),De=r("p"),De.innerHTML=Eo,go=s(),$=r("div"),i(qe.$$.fragment),uo=s(),Oe=r("p"),Oe.textContent=So,Xt=s(),i(Le.$$.fragment),At=s(),j=r("div"),i(Ze.$$.fragment),fo=s(),Ke=r("p"),Ke.innerHTML=Po,yo=s(),et=r("p"),et.innerHTML=Ho,Mo=s(),tt=r("div"),i(Re.$$.fragment),Et=s(),i(We.$$.fragment),St=s(),q=r("div"),i(ke.$$.fragment),wo=s(),V=r("div"),i(Ge.$$.fragment),To=s(),ot=r("p"),ot.innerHTML=Yo,_o=s(),i(X.$$.fragment),Jo=s(),i(A.$$.fragment),Pt=s(),i(Fe.$$.fragment),Ht=s(),st=r("p"),this.h()},l(e){const t=an("svelte-u9bgzb",document.head);u=l(t,"META",{name:!0,content:!0}),t.forEach(o),_=a(e),y=l(e,"P",{}),U(y).forEach(o),T=a(e),d(C.$$.fragment,e),M=a(e),Q=l(e,"DIV",{class:!0,"data-svelte-h":!0}),f(Q)!=="svelte-1bxez4j"&&(Q.innerHTML=Io),rt=a(e),d(P.$$.fragment,e),lt=a(e),H=l(e,"P",{"data-svelte-h":!0}),f(H)!=="svelte-hamayc"&&(H.innerHTML=bo),it=a(e),Y=l(e,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-1j9j3g4"&&(Y.textContent=jo),dt=a(e),D=l(e,"P",{"data-svelte-h":!0}),f(D)!=="svelte-r7ego0"&&(D.innerHTML=vo),ct=a(e),W=l(e,"IMG",{src:!0,alt:!0,width:!0}),mt=a(e),O=l(e,"SMALL",{"data-svelte-h":!0}),f(O)!=="svelte-attzn3"&&(O.innerHTML=Qo),pt=a(e),K=l(e,"P",{"data-svelte-h":!0}),f(K)!=="svelte-1oz6b0p"&&(K.innerHTML=Vo),ht=a(e),d(ee.$$.fragment,e),gt=a(e),d(te.$$.fragment,e),ut=a(e),oe=l(e,"P",{"data-svelte-h":!0}),f(oe)!=="svelte-1r0t8ni"&&(oe.textContent=xo),ft=a(e),d(ne.$$.fragment,e),yt=a(e),d(se.$$.fragment,e),Mt=a(e),ae=l(e,"P",{"data-svelte-h":!0}),f(ae)!=="svelte-9fk83r"&&(ae.textContent=zo),wt=a(e),d(re.$$.fragment,e),Tt=a(e),d(le.$$.fragment,e),_t=a(e),d(ie.$$.fragment,e),Jt=a(e),de=l(e,"P",{"data-svelte-h":!0}),f(de)!=="svelte-1rlewe6"&&(de.textContent=No),Ut=a(e),d(ce.$$.fragment,e),It=a(e),me=l(e,"P",{"data-svelte-h":!0}),f(me)!=="svelte-1h7uwi1"&&(me.textContent=Bo),bt=a(e),d(pe.$$.fragment,e),jt=a(e),he=l(e,"P",{"data-svelte-h":!0}),f(he)!=="svelte-7vf2io"&&(he.textContent=qo),vt=a(e),d(ge.$$.fragment,e),Ct=a(e),ue=l(e,"P",{"data-svelte-h":!0}),f(ue)!=="svelte-12fryma"&&(ue.textContent=Lo),Qt=a(e),d(fe.$$.fragment,e),Vt=a(e),d(ye.$$.fragment,e),xt=a(e),Me=l(e,"P",{"data-svelte-h":!0}),f(Me)!=="svelte-13kjllm"&&(Me.textContent=Zo),zt=a(e),d(we.$$.fragment,e),Nt=a(e),Te=l(e,"P",{"data-svelte-h":!0}),f(Te)!=="svelte-dzzatn"&&(Te.innerHTML=Ro),Bt=a(e),_e=l(e,"P",{"data-svelte-h":!0}),f(_e)!=="svelte-z3ioid"&&(_e.innerHTML=Wo),qt=a(e),d(Je.$$.fragment,e),Lt=a(e),d(Ue.$$.fragment,e),Zt=a(e),b=l(e,"DIV",{class:!0});var N=U(b);d(Ie.$$.fragment,N),to=a(N),$e=l(N,"P",{"data-svelte-h":!0}),f($e)!=="svelte-10v0gqo"&&($e.innerHTML=ko),oo=a(N),Xe=l(N,"P",{"data-svelte-h":!0}),f(Xe)!=="svelte-o55m63"&&(Xe.innerHTML=Go),no=a(N),d(k.$$.fragment,N),N.forEach(o),Rt=a(e),d(be.$$.fragment,e),Wt=a(e),x=l(e,"DIV",{class:!0});var L=U(x);d(je.$$.fragment,L),so=a(L),Ae=l(L,"P",{"data-svelte-h":!0}),f(Ae)!=="svelte-uygdj3"&&(Ae.textContent=Fo),ao=a(L),Ee=l(L,"DIV",{class:!0});var at=U(Ee);d(ve.$$.fragment,at),at.forEach(o),L.forEach(o),kt=a(e),d(Ce.$$.fragment,e),Gt=a(e),z=l(e,"DIV",{class:!0});var nt=U(z);d(Qe.$$.fragment,nt),ro=a(nt),Se=l(nt,"P",{"data-svelte-h":!0}),f(Se)!=="svelte-ewsee1"&&(Se.textContent=$o),lo=a(nt),Pe=l(nt,"DIV",{class:!0});var Do=U(Pe);d(Ve.$$.fragment,Do),Do.forEach(o),nt.forEach(o),Ft=a(e),d(xe.$$.fragment,e),$t=a(e),J=l(e,"DIV",{class:!0});var B=U(J);d(ze.$$.fragment,B),io=a(B),He=l(B,"P",{"data-svelte-h":!0}),f(He)!=="svelte-pu6uow"&&(He.innerHTML=Xo),co=a(B),G=l(B,"DIV",{class:!0});var Dt=U(G);d(Ne.$$.fragment,Dt),mo=a(Dt),Ye=l(Dt,"P",{"data-svelte-h":!0}),f(Ye)!=="svelte-1h49hic"&&(Ye.innerHTML=Ao),Dt.forEach(o),po=a(B),F=l(B,"DIV",{class:!0});var Ot=U(F);d(Be.$$.fragment,Ot),ho=a(Ot),De=l(Ot,"P",{"data-svelte-h":!0}),f(De)!=="svelte-46ufki"&&(De.innerHTML=Eo),Ot.forEach(o),go=a(B),$=l(B,"DIV",{class:!0});var Kt=U($);d(qe.$$.fragment,Kt),uo=a(Kt),Oe=l(Kt,"P",{"data-svelte-h":!0}),f(Oe)!=="svelte-z5vbkk"&&(Oe.textContent=So),Kt.forEach(o),B.forEach(o),Xt=a(e),d(Le.$$.fragment,e),At=a(e),j=l(e,"DIV",{class:!0});var E=U(j);d(Ze.$$.fragment,E),fo=a(E),Ke=l(E,"P",{"data-svelte-h":!0}),f(Ke)!=="svelte-pt1abj"&&(Ke.innerHTML=Po),yo=a(E),et=l(E,"P",{"data-svelte-h":!0}),f(et)!=="svelte-hswkmf"&&(et.innerHTML=Ho),Mo=a(E),tt=l(E,"DIV",{class:!0});var Oo=U(tt);d(Re.$$.fragment,Oo),Oo.forEach(o),E.forEach(o),Et=a(e),d(We.$$.fragment,e),St=a(e),q=l(e,"DIV",{class:!0});var eo=U(q);d(ke.$$.fragment,eo),wo=a(eo),V=l(eo,"DIV",{class:!0});var S=U(V);d(Ge.$$.fragment,S),To=a(S),ot=l(S,"P",{"data-svelte-h":!0}),f(ot)!=="svelte-1nri9gt"&&(ot.innerHTML=Yo),_o=a(S),d(X.$$.fragment,S),Jo=a(S),d(A.$$.fragment,S),S.forEach(o),eo.forEach(o),Pt=a(e),d(Fe.$$.fragment,e),Ht=a(e),st=l(e,"P",{}),U(st).forEach(o),this.h()},h(){w(u,"name","hf:doc:metadata"),w(u,"content",hn),w(Q,"class","flex flex-wrap space-x-1"),tn(W.src,Co="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/qwen2_vl_architecture.jpeg")||w(W,"src",Co),w(W,"alt","drawing"),w(W,"width","600"),w(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(q,"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){g(document.head,u),n(e,_,t),n(e,y,t),n(e,T,t),c(C,e,t),n(e,M,t),n(e,Q,t),n(e,rt,t),c(P,e,t),n(e,lt,t),n(e,H,t),n(e,it,t),n(e,Y,t),n(e,dt,t),n(e,D,t),n(e,ct,t),n(e,W,t),n(e,mt,t),n(e,O,t),n(e,pt,t),n(e,K,t),n(e,ht,t),c(ee,e,t),n(e,gt,t),c(te,e,t),n(e,ut,t),n(e,oe,t),n(e,ft,t),c(ne,e,t),n(e,yt,t),c(se,e,t),n(e,Mt,t),n(e,ae,t),n(e,wt,t),c(re,e,t),n(e,Tt,t),c(le,e,t),n(e,_t,t),c(ie,e,t),n(e,Jt,t),n(e,de,t),n(e,Ut,t),c(ce,e,t),n(e,It,t),n(e,me,t),n(e,bt,t),c(pe,e,t),n(e,jt,t),n(e,he,t),n(e,vt,t),c(ge,e,t),n(e,Ct,t),n(e,ue,t),n(e,Qt,t),c(fe,e,t),n(e,Vt,t),c(ye,e,t),n(e,xt,t),n(e,Me,t),n(e,zt,t),c(we,e,t),n(e,Nt,t),n(e,Te,t),n(e,Bt,t),n(e,_e,t),n(e,qt,t),c(Je,e,t),n(e,Lt,t),c(Ue,e,t),n(e,Zt,t),n(e,b,t),c(Ie,b,null),g(b,to),g(b,$e),g(b,oo),g(b,Xe),g(b,no),c(k,b,null),n(e,Rt,t),c(be,e,t),n(e,Wt,t),n(e,x,t),c(je,x,null),g(x,so),g(x,Ae),g(x,ao),g(x,Ee),c(ve,Ee,null),n(e,kt,t),c(Ce,e,t),n(e,Gt,t),n(e,z,t),c(Qe,z,null),g(z,ro),g(z,Se),g(z,lo),g(z,Pe),c(Ve,Pe,null),n(e,Ft,t),c(xe,e,t),n(e,$t,t),n(e,J,t),c(ze,J,null),g(J,io),g(J,He),g(J,co),g(J,G),c(Ne,G,null),g(G,mo),g(G,Ye),g(J,po),g(J,F),c(Be,F,null),g(F,ho),g(F,De),g(J,go),g(J,$),c(qe,$,null),g($,uo),g($,Oe),n(e,Xt,t),c(Le,e,t),n(e,At,t),n(e,j,t),c(Ze,j,null),g(j,fo),g(j,Ke),g(j,yo),g(j,et),g(j,Mo),g(j,tt),c(Re,tt,null),n(e,Et,t),c(We,e,t),n(e,St,t),n(e,q,t),c(ke,q,null),g(q,wo),g(q,V),c(Ge,V,null),g(V,To),g(V,ot),g(V,_o),c(X,V,null),g(V,Jo),c(A,V,null),n(e,Pt,t),c(Fe,e,t),n(e,Ht,t),n(e,st,t),Yt=!0},p(e,[t]){const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),k.$set(N);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),X.$set(L);const at={};t&2&&(at.$$scope={dirty:t,ctx:e}),A.$set(at)},i(e){Yt||(m(C.$$.fragment,e),m(P.$$.fragment,e),m(ee.$$.fragment,e),m(te.$$.fragment,e),m(ne.$$.fragment,e),m(se.$$.fragment,e),m(re.$$.fragment,e),m(le.$$.fragment,e),m(ie.$$.fragment,e),m(ce.$$.fragment,e),m(pe.$$.fragment,e),m(ge.$$.fragment,e),m(fe.$$.fragment,e),m(ye.$$.fragment,e),m(we.$$.fragment,e),m(Je.$$.fragment,e),m(Ue.$$.fragment,e),m(Ie.$$.fragment,e),m(k.$$.fragment,e),m(be.$$.fragment,e),m(je.$$.fragment,e),m(ve.$$.fragment,e),m(Ce.$$.fragment,e),m(Qe.$$.fragment,e),m(Ve.$$.fragment,e),m(xe.$$.fragment,e),m(ze.$$.fragment,e),m(Ne.$$.fragment,e),m(Be.$$.fragment,e),m(qe.$$.fragment,e),m(Le.$$.fragment,e),m(Ze.$$.fragment,e),m(Re.$$.fragment,e),m(We.$$.fragment,e),m(ke.$$.fragment,e),m(Ge.$$.fragment,e),m(X.$$.fragment,e),m(A.$$.fragment,e),m(Fe.$$.fragment,e),Yt=!0)},o(e){p(C.$$.fragment,e),p(P.$$.fragment,e),p(ee.$$.fragment,e),p(te.$$.fragment,e),p(ne.$$.fragment,e),p(se.$$.fragment,e),p(re.$$.fragment,e),p(le.$$.fragment,e),p(ie.$$.fragment,e),p(ce.$$.fragment,e),p(pe.$$.fragment,e),p(ge.$$.fragment,e),p(fe.$$.fragment,e),p(ye.$$.fragment,e),p(we.$$.fragment,e),p(Je.$$.fragment,e),p(Ue.$$.fragment,e),p(Ie.$$.fragment,e),p(k.$$.fragment,e),p(be.$$.fragment,e),p(je.$$.fragment,e),p(ve.$$.fragment,e),p(Ce.$$.fragment,e),p(Qe.$$.fragment,e),p(Ve.$$.fragment,e),p(xe.$$.fragment,e),p(ze.$$.fragment,e),p(Ne.$$.fragment,e),p(Be.$$.fragment,e),p(qe.$$.fragment,e),p(Le.$$.fragment,e),p(Ze.$$.fragment,e),p(Re.$$.fragment,e),p(We.$$.fragment,e),p(ke.$$.fragment,e),p(Ge.$$.fragment,e),p(X.$$.fragment,e),p(A.$$.fragment,e),p(Fe.$$.fragment,e),Yt=!1},d(e){e&&(o(_),o(y),o(T),o(M),o(Q),o(rt),o(lt),o(H),o(it),o(Y),o(dt),o(D),o(ct),o(W),o(mt),o(O),o(pt),o(K),o(ht),o(gt),o(ut),o(oe),o(ft),o(yt),o(Mt),o(ae),o(wt),o(Tt),o(_t),o(Jt),o(de),o(Ut),o(It),o(me),o(bt),o(jt),o(he),o(vt),o(Ct),o(ue),o(Qt),o(Vt),o(xt),o(Me),o(zt),o(Nt),o(Te),o(Bt),o(_e),o(qt),o(Lt),o(Zt),o(b),o(Rt),o(Wt),o(x),o(kt),o(Gt),o(z),o(Ft),o($t),o(J),o(Xt),o(At),o(j),o(Et),o(St),o(q),o(Pt),o(Ht),o(st)),o(u),h(C,e),h(P,e),h(ee,e),h(te,e),h(ne,e),h(se,e),h(re,e),h(le,e),h(ie,e),h(ce,e),h(pe,e),h(ge,e),h(fe,e),h(ye,e),h(we,e),h(Je,e),h(Ue,e),h(Ie),h(k),h(be,e),h(je),h(ve),h(Ce,e),h(Qe),h(Ve),h(xe,e),h(ze),h(Ne),h(Be),h(qe),h(Le,e),h(Ze),h(Re),h(We,e),h(ke),h(Ge),h(X),h(A),h(Fe,e)}}}const hn='{"title":"Qwen2-VL","local":"qwen2-vl","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[{"title":"Single Media inference","local":"single-media-inference","sections":[],"depth":3},{"title":"Batch Mixed Media Inference","local":"batch-mixed-media-inference","sections":[],"depth":3},{"title":"Usage Tips","local":"usage-tips","sections":[{"title":"Image Resolution trade-off","local":"image-resolution-trade-off","sections":[],"depth":4},{"title":"Multiple Image Inputs","local":"multiple-image-inputs","sections":[],"depth":4},{"title":"Flash-Attention 2 to speed up generation","local":"flash-attention-2-to-speed-up-generation","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"Qwen2VLConfig","local":"transformers.Qwen2VLConfig","sections":[],"depth":2},{"title":"Qwen2VLImageProcessor","local":"transformers.Qwen2VLImageProcessor","sections":[],"depth":2},{"title":"Qwen2VLImageProcessorFast","local":"transformers.Qwen2VLImageProcessorFast","sections":[],"depth":2},{"title":"Qwen2VLProcessor","local":"transformers.Qwen2VLProcessor","sections":[],"depth":2},{"title":"Qwen2VLModel","local":"transformers.Qwen2VLModel","sections":[],"depth":2},{"title":"Qwen2VLForConditionalGeneration","local":"transformers.Qwen2VLForConditionalGeneration","sections":[],"depth":2}],"depth":1}';function gn(R){return on(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jn extends nn{constructor(u){super(),sn(this,u,gn,pn,en,{})}}export{Jn as component};
