import{s as ct,A as dt,o as mt,n as lt}from"../chunks/scheduler.01eeda35.js";import{S as pt,i as ht,g as i,s as r,r as m,A as ft,h as l,f as t,c as a,j as z,u as p,x as c,k as b,y as n,a as s,v as h,d as f,t as g,w as u}from"../chunks/index.6dd51b66.js";import{T as gt}from"../chunks/Tip.de9bae2b.js";import{D as q}from"../chunks/Docstring.cb556860.js";import{C as Vo}from"../chunks/CodeBlock.19ec9b8c.js";import{E as ut}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as W,E as _t}from"../chunks/index.58fe8f9d.js";function xt(xe){let d,J="Example:",x,v,w;return v=new Vo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeHRyYWxWaXNpb25Nb2RlbCUyQyUyMFBpeHRyYWxWaXNpb25Db25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUGl4dHJhbC0xMkIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWclMjAlM0QlMjBQaXh0cmFsVmlzaW9uQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbWx5JTIwaW5pdGlhbGl6ZWQlMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBQaXh0cmFsVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PixtralVisionModel, PixtralVisionConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Pixtral-12B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = PixtralVisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with randomly initialized weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PixtralVisionModel(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(){d=i("p"),d.textContent=J,x=r(),m(v.$$.fragment)},l(_){d=l(_,"P",{"data-svelte-h":!0}),c(d)!=="svelte-11lpom8"&&(d.textContent=J),x=a(_),p(v.$$.fragment,_)},m(_,I){s(_,d,I),s(_,x,I),h(v,_,I),w=!0},p:lt,i(_){w||(f(v.$$.fragment,_),w=!0)},o(_){g(v.$$.fragment,_),w=!1},d(_){_&&(t(d),t(x)),u(v,_)}}}function bt(xe){let d,J=`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(){d=i("p"),d.innerHTML=J},l(x){d=l(x,"P",{"data-svelte-h":!0}),c(d)!=="svelte-fincs2"&&(d.innerHTML=J)},m(x,v){s(x,d,v)},p:lt,d(x){x&&t(d)}}}function yt(xe){let d,J,x,v,w,_,I,Lo='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Le,S,Fe,E,Fo='The Pixtral model was released by the Mistral AI team in a <a href="https://mistral.ai/news/pixtral-12b/" rel="nofollow">blog post</a>. Pixtral is a multimodal version of <a href="mistral">Mistral</a>, incorporating a 400 million parameter vision encoder trained from scratch.',Ne,B,No="The intro from the blog says the following:",De,H,Do="<em>Pixtral is trained to understand both natural images and documents, achieving 52.5% on the MMMU reasoning benchmark, surpassing a number of larger models. The model shows strong abilities in tasks such as chart and figure understanding, document question answering, multimodal reasoning and instruction following. Pixtral is able to ingest images at their natural resolution and aspect ratio, giving the user flexibility on the number of tokens used to process an image. Pixtral is also able to process any number of images in its long context window of 128K tokens. Unlike previous open-source models, Pixtral does not compromise on text benchmark performance to excel in multimodal tasks.</em>",Ge,R,Go,We,Z,Wo='Pixtral architecture. Taken from the <a href="https://mistral.ai/news/pixtral-12b/">blog post.</a>',Se,Q,So="Tips:",Ee,X,Eo='<li>Pixtral is a multimodal model, taking images and text as input, and producing text as output.</li> <li>This model follows the <a href="llava">Llava</a> architecture. The model uses <a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralVisionModel">PixtralVisionModel</a> for its vision encoder, and <a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralForCausalLM">MistralForCausalLM</a> for its language decoder.</li> <li>The main contribution is the 2d ROPE (rotary position embeddings) on the images, and support for arbitrary image sizes (the images are not padded together nor are they resized).</li> <li>Similar to <a href="llava">Llava</a>, the model internally replaces the <code>[IMG]</code> token placeholders by image embeddings from the vision encoder. The format for one or multiple prompts is the following:</li>',Be,A,He,Y,Bo='Then, the processor will replace each <code>[IMG]</code> token with a number of <code>[IMG]</code> tokens that depend on the height and the width of each image. Each <em>row</em> of the image is separated by an <code>[IMG_BREAK]</code> token, and each image is separated by an <code>[IMG_END]</code> token. It’s advised to use the <code>apply_chat_template</code> method of the processor, which takes care of all of this and formats the text for you. If you’re using <code>transformers&gt;=4.49.0</code>, you can also get a vectorized output from <code>apply_chat_template</code>. See the <a href="#usage">usage section</a> for more info.',Ze,O,Ho='This model was contributed by <a href="https://huggingface.co/amyeroberts" rel="nofollow">amyeroberts</a> and <a href="https://huggingface.co/ArthurZ" rel="nofollow">ArthurZ</a>. The original code can be found <a href="https://github.com/vllm-project/vllm/pull/8377" rel="nofollow">here</a>.',Qe,K,Xe,ee,Zo="At inference time, it’s advised to use the processor’s <code>apply_chat_template</code> method, which correctly formats the prompt for the model:",Ae,oe,Ye,te,Oe,y,re,go,be,Qo=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralVisionModel">PixtralVisionModel</a>. It is used to instantiate an
Pixtral vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to the vision encoder used by Pixtral-12B.`,uo,ye,Xo='e.g. <a href="https://huggingface.co/pixtral-hf/pixtral-9b" rel="nofollow">pixtral-hf/pixtral-9b</a>',_o,Pe,Ao=`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.`,xo,V,Ke,ae,eo,M,se,bo,ve,Yo=`The bare Pixtral vision encoder 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,Me,Oo=`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.`,Po,j,ne,vo,Te,Ko='The <a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralVisionModel">PixtralVisionModel</a> forward method, overrides the <code>__call__</code> special method.',Mo,L,oo,ie,to,C,le,To,we,et="Constructs a Pixtral image processor.",wo,F,ce,Io,Ie,ot="Preprocess an image or batch of images.",ro,de,ao,$,me,zo,ze,tt="Constructs a fast ConvNeXT image processor.",Co,N,pe,$o,Ce,rt="Preprocess an image or batch of images.",so,he,no,P,fe,Uo,$e,at="Constructs a Pixtral processor which wraps a Pixtral image processor and a Pixtral tokenizer into a single processor.",Jo,Ue,st=`<a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralProcessor">PixtralProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/llama#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralProcessor.decode">decode()</a> for more information.`,jo,D,ge,ko,Je,nt=`This method forwards all its arguments to LlamaTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,qo,G,ue,Ro,je,it=`This method forwards all its arguments to LlamaTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,io,_e,lo,Ve,co;return w=new W({props:{title:"Pixtral",local:"pixtral",headingTag:"h1"}}),S=new W({props:{title:"Overview",local:"overview",headingTag:"h2"}}),A=new Vo({props:{code:"JTIyJTNDcyUzRSU1QklOU1QlNUQlNUJJTUclNUQlNUNuV2hhdCUyMGFyZSUyMHRoZSUyMHRoaW5ncyUyMEklMjBzaG91bGQlMjBiZSUyMGNhdXRpb3VzJTIwYWJvdXQlMjB3aGVuJTIwSSUyMHZpc2l0JTIwdGhpcyUyMHBsYWNlJTNGJTVCJTJGSU5TVCU1RCUyMg==",highlighted:'&quot;&lt;s&gt;<span class="hljs-selector-attr">[INST]</span><span class="hljs-selector-attr">[IMG]</span>\\nWhat are the things <span class="hljs-selector-tag">I</span> should be cautious about when <span class="hljs-selector-tag">I</span> visit this place?<span class="hljs-selector-attr">[/INST]</span>&quot;',wrap:!1}}),K=new W({props:{title:"Usage",local:"usage",headingTag:"h2"}}),oe=new Vo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBMbGF2YUZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIybWlzdHJhbC1jb21tdW5pdHklMkZwaXh0cmFsLTEyYiUyMiUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwTGxhdmFGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwZGV2aWNlX21hcCUzRCUyMmN1ZGElMjIpJTBBJTBBY2hhdCUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkNhbiUyMHRoaXMlMjBhbmltYWwlMjIlN0QlMkMlMjAlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJ1cmwlMjIlM0ElMjAlMjJodHRwcyUzQSUyRiUyRnBpY3N1bS5waG90b3MlMkZpZCUyRjIzNyUyRjIwMCUyRjMwMCUyMiU3RCUyQyUyMCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMmxpdmUlMjBoZXJlJTNGJTIyJTdEJTJDJTIwJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdCJTIydHlwZSUyMiUzQSUyMCUyMmltYWdlJTIyJTJDJTIwJTIydXJsJTIyJTNBJTIwJTIyaHR0cHMlM0ElMkYlMkZwaWNzdW0ucGhvdG9zJTJGc2VlZCUyRnBpY3N1bSUyRjIwMCUyRjMwMCUyMiU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMGNoYXQlMkMlMEElMjAlMjAlMjAlMjBhZGRfZ2VuZXJhdGlvbl9wcm9tcHQlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2RpY3QlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSkudG8obW9kZWwuZGV2aWNlKSUwQSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1MDApJTBBb3V0cHV0JTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, LlavaForConditionalGeneration

model_id = <span class="hljs-string">&quot;mistral-community/pixtral-12b&quot;</span>
processor = AutoProcessor.from_pretrained(model_id)
model = LlavaForConditionalGeneration.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;cuda&quot;</span>)

chat = [
    {
      <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;content&quot;</span>: <span class="hljs-string">&quot;Can this animal&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://picsum.photos/id/237/200/300&quot;</span>}, 
        {<span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;text&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;live here?&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://picsum.photos/seed/picsum/200/300&quot;</span>}
      ]
    }
]

inputs = processor.apply_chat_template(
    chat,
    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)

generate_ids = model.generate(**inputs, max_new_tokens=<span class="hljs-number">500</span>)
output = processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),te=new W({props:{title:"PixtralVisionConfig",local:"transformers.PixtralVisionConfig",headingTag:"h2"}}),re=new q({props:{name:"class transformers.PixtralVisionConfig",anchor:"transformers.PixtralVisionConfig",parameters:[{name:"hidden_size",val:" = 1024"},{name:"intermediate_size",val:" = 4096"},{name:"num_hidden_layers",val:" = 24"},{name:"num_attention_heads",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 1024"},{name:"patch_size",val:" = 16"},{name:"hidden_act",val:" = 'gelu'"},{name:"attention_dropout",val:" = 0.0"},{name:"rope_theta",val:" = 10000.0"},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.PixtralVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.PixtralVisionConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.PixtralVisionConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.PixtralVisionConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Number of input channels in the input images.`,name:"num_channels"},{anchor:"transformers.PixtralVisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Max dimension of the input images.`,name:"image_size"},{anchor:"transformers.PixtralVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Size of the image patches.`,name:"patch_size"},{anchor:"transformers.PixtralVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
Activation function used in the hidden layers.`,name:"hidden_act"},{anchor:"transformers.PixtralVisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Dropout probability for the attention layers.`,name:"attention_dropout"},{anchor:"transformers.PixtralVisionConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 10000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.PixtralVisionConfig.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/configuration_pixtral.py#L23"}}),V=new ut({props:{anchor:"transformers.PixtralVisionConfig.example",$$slots:{default:[xt]},$$scope:{ctx:xe}}}),ae=new W({props:{title:"PixtralVisionModel",local:"transformers.PixtralVisionModel",headingTag:"h2"}}),se=new q({props:{name:"class transformers.PixtralVisionModel",anchor:"transformers.PixtralVisionModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PixtralVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralVisionConfig">PixtralVisionConfig</a>) &#x2014;
Model configuration class with all the parameters of the vision encoder. 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/pixtral/modeling_pixtral.py#L456"}}),ne=new q({props:{name:"forward",anchor:"transformers.PixtralVisionModel.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"image_sizes",val:": Tensor"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralVisionModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <code>AutoImageProcessor.__call__()</code>
for details.`,name:"pixel_values"},{anchor:"transformers.PixtralVisionModel.forward.image_sizes",description:`<strong>image_sizes</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2)</code>, <em>optional</em>) &#x2014;
The sizes of the images in the batch, being (height, width) for each image.`,name:"image_sizes"},{anchor:"transformers.PixtralVisionModel.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.PixtralVisionModel.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.PixtralVisionModel.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/modeling_pixtral.py#L483",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>tensor of token features for
all tokens of all images of shape (N_toks, D)</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>pixel_values</p>
`}}),L=new gt({props:{$$slots:{default:[bt]},$$scope:{ctx:xe}}}),ie=new W({props:{title:"PixtralImageProcessor",local:"transformers.PixtralImageProcessor",headingTag:"h2"}}),le=new q({props:{name:"class transformers.PixtralImageProcessor",anchor:"transformers.PixtralImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"patch_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:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.PixtralImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;longest_edge&quot; -- 1024}</code>):
Size of the maximum dimension of either the height or width dimension of the image. Used to control how
images are resized. If either the height or width are greater than <code>size[&quot;longest_edge&quot;]</code> then both the height and width are rescaled by <code>height / ratio</code>, <code>width /ratio</code> where <code>ratio = max(height / longest_edge, width / longest_edge)</code>`,name:"size"},{anchor:"transformers.PixtralImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
Size of the patches in the model, used to calculate the output image size. Can be overridden by <code>patch_size</code> in the <code>preprocess</code> method.`,name:"patch_size"},{anchor:"transformers.PixtralImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.PixtralImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.PixtralImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by <code>rescale_factor</code> in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.PixtralImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by <code>do_normalize</code> in the <code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.PixtralImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.PixtralImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.
Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.PixtralImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/image_processing_pixtral.py#L139"}}),ce=new q({props:{name:"preprocess",anchor:"transformers.PixtralImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"patch_size",val:": typing.Dict[str, 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:"do_convert_rgb",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.PixtralImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.patch_size</code>) &#x2014;
Patch size in the model. Used to calculate the image after resizing.`,name:"patch_size"},{anchor:"transformers.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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.PixtralImageProcessor.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/pixtral/image_processing_pixtral.py#L319"}}),de=new W({props:{title:"PixtralImageProcessorFast",local:"transformers.PixtralImageProcessorFast",headingTag:"h2"}}),me=new q({props:{name:"class transformers.PixtralImageProcessorFast",anchor:"transformers.PixtralImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.pixtral.image_processing_pixtral_fast.PixtralFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
Size of the patches in the model, used to calculate the output image size. Can be overridden by <code>patch_size</code> in the <code>preprocess</code> method.`,name:"patch_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/image_processing_pixtral_fast.py#L67"}}),pe=new q({props:{name:"preprocess",anchor:"transformers.PixtralImageProcessorFast.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.pixtral.image_processing_pixtral_fast.PixtralFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.PixtralImageProcessorFast.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> or <code>InterpolationMode</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.PixtralImageProcessorFast.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.PixtralImageProcessorFast.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.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.PixtralImageProcessorFast.preprocess.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.PixtralImageProcessorFast.preprocess.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.PixtralImageProcessorFast.preprocess.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.PixtralImageProcessorFast.preprocess.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.PixtralImageProcessorFast.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 16, &quot;width&quot;: 16}</code>):
Size of the patches in the model, used to calculate the output image size. Can be overridden by <code>patch_size</code> in the <code>preprocess</code> method.`,name:"patch_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/image_processing_pixtral_fast.py#L91"}}),he=new W({props:{title:"PixtralProcessor",local:"transformers.PixtralProcessor",headingTag:"h2"}}),fe=new q({props:{name:"class transformers.PixtralProcessor",anchor:"transformers.PixtralProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"patch_size",val:": int = 16"},{name:"spatial_merge_size",val:": int = 1"},{name:"chat_template",val:" = None"},{name:"image_token",val:" = '[IMG]'"},{name:"image_break_token",val:" = '[IMG_BREAK]'"},{name:"image_end_token",val:" = '[IMG_END]'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/pixtral#transformers.PixtralImageProcessor">PixtralImageProcessor</a>, <em>optional</em>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.PixtralProcessor.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/main/en/model_doc/llama#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>, <em>optional</em>) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.PixtralProcessor.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Patch size from the vision tower.`,name:"patch_size"},{anchor:"transformers.PixtralProcessor.spatial_merge_size",description:`<strong>spatial_merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The downsampling factor for the spatial merge operation.`,name:"spatial_merge_size"},{anchor:"transformers.PixtralProcessor.chat_template",description:`<strong>chat_template</strong> (<code>str</code>, <em>optional</em>) &#x2014; A Jinja template which will be used to convert lists of messages
in a chat into a tokenizable string.`,name:"chat_template"},{anchor:"transformers.PixtralProcessor.image_token",description:`<strong>image_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[IMG]&quot;</code>) &#x2014;
Special token used to denote image location.`,name:"image_token"},{anchor:"transformers.PixtralProcessor.image_break_token",description:`<strong>image_break_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[IMG_BREAK]&quot;</code>) &#x2014;
Special token used to denote the end of a line of pixels in an image.`,name:"image_break_token"},{anchor:"transformers.PixtralProcessor.image_end_token",description:`<strong>image_end_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[IMG_END]&quot;</code>) &#x2014;
Special token used to denote the end of an image input.`,name:"image_end_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/processing_pixtral.py#L53"}}),ge=new q({props:{name:"batch_decode",anchor:"transformers.PixtralProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/processing_pixtral.py#L220"}}),ue=new q({props:{name:"decode",anchor:"transformers.PixtralProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/processing_pixtral.py#L228"}}),_e=new _t({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/pixtral.md"}}),{c(){d=i("meta"),J=r(),x=i("p"),v=r(),m(w.$$.fragment),_=r(),I=i("div"),I.innerHTML=Lo,Le=r(),m(S.$$.fragment),Fe=r(),E=i("p"),E.innerHTML=Fo,Ne=r(),B=i("p"),B.textContent=No,De=r(),H=i("p"),H.innerHTML=Do,Ge=r(),R=i("img"),We=r(),Z=i("small"),Z.innerHTML=Wo,Se=r(),Q=i("p"),Q.textContent=So,Ee=r(),X=i("ul"),X.innerHTML=Eo,Be=r(),m(A.$$.fragment),He=r(),Y=i("p"),Y.innerHTML=Bo,Ze=r(),O=i("p"),O.innerHTML=Ho,Qe=r(),m(K.$$.fragment),Xe=r(),ee=i("p"),ee.innerHTML=Zo,Ae=r(),m(oe.$$.fragment),Ye=r(),m(te.$$.fragment),Oe=r(),y=i("div"),m(re.$$.fragment),go=r(),be=i("p"),be.innerHTML=Qo,uo=r(),ye=i("p"),ye.innerHTML=Xo,_o=r(),Pe=i("p"),Pe.innerHTML=Ao,xo=r(),m(V.$$.fragment),Ke=r(),m(ae.$$.fragment),eo=r(),M=i("div"),m(se.$$.fragment),bo=r(),ve=i("p"),ve.innerHTML=Yo,yo=r(),Me=i("p"),Me.innerHTML=Oo,Po=r(),j=i("div"),m(ne.$$.fragment),vo=r(),Te=i("p"),Te.innerHTML=Ko,Mo=r(),m(L.$$.fragment),oo=r(),m(ie.$$.fragment),to=r(),C=i("div"),m(le.$$.fragment),To=r(),we=i("p"),we.textContent=et,wo=r(),F=i("div"),m(ce.$$.fragment),Io=r(),Ie=i("p"),Ie.textContent=ot,ro=r(),m(de.$$.fragment),ao=r(),$=i("div"),m(me.$$.fragment),zo=r(),ze=i("p"),ze.textContent=tt,Co=r(),N=i("div"),m(pe.$$.fragment),$o=r(),Ce=i("p"),Ce.textContent=rt,so=r(),m(he.$$.fragment),no=r(),P=i("div"),m(fe.$$.fragment),Uo=r(),$e=i("p"),$e.textContent=at,Jo=r(),Ue=i("p"),Ue.innerHTML=st,jo=r(),D=i("div"),m(ge.$$.fragment),ko=r(),Je=i("p"),Je.innerHTML=nt,qo=r(),G=i("div"),m(ue.$$.fragment),Ro=r(),je=i("p"),je.innerHTML=it,io=r(),m(_e.$$.fragment),lo=r(),Ve=i("p"),this.h()},l(e){const o=ft("svelte-u9bgzb",document.head);d=l(o,"META",{name:!0,content:!0}),o.forEach(t),J=a(e),x=l(e,"P",{}),z(x).forEach(t),v=a(e),p(w.$$.fragment,e),_=a(e),I=l(e,"DIV",{class:!0,"data-svelte-h":!0}),c(I)!=="svelte-13t8s2t"&&(I.innerHTML=Lo),Le=a(e),p(S.$$.fragment,e),Fe=a(e),E=l(e,"P",{"data-svelte-h":!0}),c(E)!=="svelte-tgqlpw"&&(E.innerHTML=Fo),Ne=a(e),B=l(e,"P",{"data-svelte-h":!0}),c(B)!=="svelte-3te1w2"&&(B.textContent=No),De=a(e),H=l(e,"P",{"data-svelte-h":!0}),c(H)!=="svelte-1y5kg5k"&&(H.innerHTML=Do),Ge=a(e),R=l(e,"IMG",{src:!0,alt:!0,width:!0}),We=a(e),Z=l(e,"SMALL",{"data-svelte-h":!0}),c(Z)!=="svelte-10jofpl"&&(Z.innerHTML=Wo),Se=a(e),Q=l(e,"P",{"data-svelte-h":!0}),c(Q)!=="svelte-axv494"&&(Q.textContent=So),Ee=a(e),X=l(e,"UL",{"data-svelte-h":!0}),c(X)!=="svelte-rknnv7"&&(X.innerHTML=Eo),Be=a(e),p(A.$$.fragment,e),He=a(e),Y=l(e,"P",{"data-svelte-h":!0}),c(Y)!=="svelte-n0o11w"&&(Y.innerHTML=Bo),Ze=a(e),O=l(e,"P",{"data-svelte-h":!0}),c(O)!=="svelte-1fxleij"&&(O.innerHTML=Ho),Qe=a(e),p(K.$$.fragment,e),Xe=a(e),ee=l(e,"P",{"data-svelte-h":!0}),c(ee)!=="svelte-orhe3n"&&(ee.innerHTML=Zo),Ae=a(e),p(oe.$$.fragment,e),Ye=a(e),p(te.$$.fragment,e),Oe=a(e),y=l(e,"DIV",{class:!0});var T=z(y);p(re.$$.fragment,T),go=a(T),be=l(T,"P",{"data-svelte-h":!0}),c(be)!=="svelte-1xxf4yy"&&(be.innerHTML=Qo),uo=a(T),ye=l(T,"P",{"data-svelte-h":!0}),c(ye)!=="svelte-l0qt95"&&(ye.innerHTML=Xo),_o=a(T),Pe=l(T,"P",{"data-svelte-h":!0}),c(Pe)!=="svelte-o55m63"&&(Pe.innerHTML=Ao),xo=a(T),p(V.$$.fragment,T),T.forEach(t),Ke=a(e),p(ae.$$.fragment,e),eo=a(e),M=l(e,"DIV",{class:!0});var U=z(M);p(se.$$.fragment,U),bo=a(U),ve=l(U,"P",{"data-svelte-h":!0}),c(ve)!=="svelte-ybvejp"&&(ve.innerHTML=Yo),yo=a(U),Me=l(U,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-hswkmf"&&(Me.innerHTML=Oo),Po=a(U),j=l(U,"DIV",{class:!0});var ke=z(j);p(ne.$$.fragment,ke),vo=a(ke),Te=l(ke,"P",{"data-svelte-h":!0}),c(Te)!=="svelte-1mwzfrr"&&(Te.innerHTML=Ko),Mo=a(ke),p(L.$$.fragment,ke),ke.forEach(t),U.forEach(t),oo=a(e),p(ie.$$.fragment,e),to=a(e),C=l(e,"DIV",{class:!0});var qe=z(C);p(le.$$.fragment,qe),To=a(qe),we=l(qe,"P",{"data-svelte-h":!0}),c(we)!=="svelte-1eqw4iw"&&(we.textContent=et),wo=a(qe),F=l(qe,"DIV",{class:!0});var mo=z(F);p(ce.$$.fragment,mo),Io=a(mo),Ie=l(mo,"P",{"data-svelte-h":!0}),c(Ie)!=="svelte-1x3yxsa"&&(Ie.textContent=ot),mo.forEach(t),qe.forEach(t),ro=a(e),p(de.$$.fragment,e),ao=a(e),$=l(e,"DIV",{class:!0});var Re=z($);p(me.$$.fragment,Re),zo=a(Re),ze=l(Re,"P",{"data-svelte-h":!0}),c(ze)!=="svelte-1bn0s7p"&&(ze.textContent=tt),Co=a(Re),N=l(Re,"DIV",{class:!0});var po=z(N);p(pe.$$.fragment,po),$o=a(po),Ce=l(po,"P",{"data-svelte-h":!0}),c(Ce)!=="svelte-1x3yxsa"&&(Ce.textContent=rt),po.forEach(t),Re.forEach(t),so=a(e),p(he.$$.fragment,e),no=a(e),P=l(e,"DIV",{class:!0});var k=z(P);p(fe.$$.fragment,k),Uo=a(k),$e=l(k,"P",{"data-svelte-h":!0}),c($e)!=="svelte-1i1eb5d"&&($e.textContent=at),Jo=a(k),Ue=l(k,"P",{"data-svelte-h":!0}),c(Ue)!=="svelte-6p9so9"&&(Ue.innerHTML=st),jo=a(k),D=l(k,"DIV",{class:!0});var ho=z(D);p(ge.$$.fragment,ho),ko=a(ho),Je=l(ho,"P",{"data-svelte-h":!0}),c(Je)!=="svelte-1o9eza"&&(Je.innerHTML=nt),ho.forEach(t),qo=a(k),G=l(k,"DIV",{class:!0});var fo=z(G);p(ue.$$.fragment,fo),Ro=a(fo),je=l(fo,"P",{"data-svelte-h":!0}),c(je)!=="svelte-kk16qw"&&(je.innerHTML=it),fo.forEach(t),k.forEach(t),io=a(e),p(_e.$$.fragment,e),lo=a(e),Ve=l(e,"P",{}),z(Ve).forEach(t),this.h()},h(){b(d,"name","hf:doc:metadata"),b(d,"content",Pt),b(I,"class","flex flex-wrap space-x-1"),dt(R.src,Go="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/pixtral_architecture.webp")||b(R,"src",Go),b(R,"alt","drawing"),b(R,"width","600"),b(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(P,"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,o){n(document.head,d),s(e,J,o),s(e,x,o),s(e,v,o),h(w,e,o),s(e,_,o),s(e,I,o),s(e,Le,o),h(S,e,o),s(e,Fe,o),s(e,E,o),s(e,Ne,o),s(e,B,o),s(e,De,o),s(e,H,o),s(e,Ge,o),s(e,R,o),s(e,We,o),s(e,Z,o),s(e,Se,o),s(e,Q,o),s(e,Ee,o),s(e,X,o),s(e,Be,o),h(A,e,o),s(e,He,o),s(e,Y,o),s(e,Ze,o),s(e,O,o),s(e,Qe,o),h(K,e,o),s(e,Xe,o),s(e,ee,o),s(e,Ae,o),h(oe,e,o),s(e,Ye,o),h(te,e,o),s(e,Oe,o),s(e,y,o),h(re,y,null),n(y,go),n(y,be),n(y,uo),n(y,ye),n(y,_o),n(y,Pe),n(y,xo),h(V,y,null),s(e,Ke,o),h(ae,e,o),s(e,eo,o),s(e,M,o),h(se,M,null),n(M,bo),n(M,ve),n(M,yo),n(M,Me),n(M,Po),n(M,j),h(ne,j,null),n(j,vo),n(j,Te),n(j,Mo),h(L,j,null),s(e,oo,o),h(ie,e,o),s(e,to,o),s(e,C,o),h(le,C,null),n(C,To),n(C,we),n(C,wo),n(C,F),h(ce,F,null),n(F,Io),n(F,Ie),s(e,ro,o),h(de,e,o),s(e,ao,o),s(e,$,o),h(me,$,null),n($,zo),n($,ze),n($,Co),n($,N),h(pe,N,null),n(N,$o),n(N,Ce),s(e,so,o),h(he,e,o),s(e,no,o),s(e,P,o),h(fe,P,null),n(P,Uo),n(P,$e),n(P,Jo),n(P,Ue),n(P,jo),n(P,D),h(ge,D,null),n(D,ko),n(D,Je),n(P,qo),n(P,G),h(ue,G,null),n(G,Ro),n(G,je),s(e,io,o),h(_e,e,o),s(e,lo,o),s(e,Ve,o),co=!0},p(e,[o]){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),V.$set(T);const U={};o&2&&(U.$$scope={dirty:o,ctx:e}),L.$set(U)},i(e){co||(f(w.$$.fragment,e),f(S.$$.fragment,e),f(A.$$.fragment,e),f(K.$$.fragment,e),f(oe.$$.fragment,e),f(te.$$.fragment,e),f(re.$$.fragment,e),f(V.$$.fragment,e),f(ae.$$.fragment,e),f(se.$$.fragment,e),f(ne.$$.fragment,e),f(L.$$.fragment,e),f(ie.$$.fragment,e),f(le.$$.fragment,e),f(ce.$$.fragment,e),f(de.$$.fragment,e),f(me.$$.fragment,e),f(pe.$$.fragment,e),f(he.$$.fragment,e),f(fe.$$.fragment,e),f(ge.$$.fragment,e),f(ue.$$.fragment,e),f(_e.$$.fragment,e),co=!0)},o(e){g(w.$$.fragment,e),g(S.$$.fragment,e),g(A.$$.fragment,e),g(K.$$.fragment,e),g(oe.$$.fragment,e),g(te.$$.fragment,e),g(re.$$.fragment,e),g(V.$$.fragment,e),g(ae.$$.fragment,e),g(se.$$.fragment,e),g(ne.$$.fragment,e),g(L.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(ce.$$.fragment,e),g(de.$$.fragment,e),g(me.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(ue.$$.fragment,e),g(_e.$$.fragment,e),co=!1},d(e){e&&(t(J),t(x),t(v),t(_),t(I),t(Le),t(Fe),t(E),t(Ne),t(B),t(De),t(H),t(Ge),t(R),t(We),t(Z),t(Se),t(Q),t(Ee),t(X),t(Be),t(He),t(Y),t(Ze),t(O),t(Qe),t(Xe),t(ee),t(Ae),t(Ye),t(Oe),t(y),t(Ke),t(eo),t(M),t(oo),t(to),t(C),t(ro),t(ao),t($),t(so),t(no),t(P),t(io),t(lo),t(Ve)),t(d),u(w,e),u(S,e),u(A,e),u(K,e),u(oe,e),u(te,e),u(re),u(V),u(ae,e),u(se),u(ne),u(L),u(ie,e),u(le),u(ce),u(de,e),u(me),u(pe),u(he,e),u(fe),u(ge),u(ue),u(_e,e)}}}const Pt='{"title":"Pixtral","local":"pixtral","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"PixtralVisionConfig","local":"transformers.PixtralVisionConfig","sections":[],"depth":2},{"title":"PixtralVisionModel","local":"transformers.PixtralVisionModel","sections":[],"depth":2},{"title":"PixtralImageProcessor","local":"transformers.PixtralImageProcessor","sections":[],"depth":2},{"title":"PixtralImageProcessorFast","local":"transformers.PixtralImageProcessorFast","sections":[],"depth":2},{"title":"PixtralProcessor","local":"transformers.PixtralProcessor","sections":[],"depth":2}],"depth":1}';function vt(xe){return mt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ut extends pt{constructor(d){super(),ht(this,d,vt,yt,ct,{})}}export{Ut as component};
