import{s as jt,o as Gt,n as Pt}from"../chunks/scheduler.25b97de1.js";import{S as Ct,i as Bt,g as i,s as a,r as c,A as zt,h as l,f as o,c as r,j as C,u as m,x as u,k as B,y as s,a as n,v as p,d as h,t as g,w as f}from"../chunks/index.d9030fc9.js";import{T as $t}from"../chunks/Tip.baa67368.js";import{D as V}from"../chunks/Docstring.ffac8efa.js";import{C as dt}from"../chunks/CodeBlock.e6cd0d95.js";import{E as kt}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as Te,E as Zt}from"../chunks/EditOnGithub.91d95064.js";function Wt(se){let d,P="Example:",_,T,J;return T=new dt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBpeHRyYWxNb2RlbCUyQyUyMFBpeHRyYWxWaXNpb25Db25maWclMkMlMjBDTElQVmlzaW9uQ29uZmlnJTJDJTIwTGxhbWFDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUGl4dHJhbCUyMDEyQiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZyUyMCUzRCUyMFBpeHRyYWxWaXNpb25Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBwaXh0cmFsJTIwMTJCJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBQaXh0cmFsTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PixtralModel, PixtralVisionConfig, CLIPVisionConfig, LlamaConfig

<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 from the pixtral 12B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PixtralModel(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=P,_=a(),c(T.$$.fragment)},l(M){d=l(M,"P",{"data-svelte-h":!0}),u(d)!=="svelte-11lpom8"&&(d.textContent=P),_=r(M),m(T.$$.fragment,M)},m(M,U){n(M,d,U),n(M,_,U),p(T,M,U),J=!0},p:Pt,i(M){J||(h(T.$$.fragment,M),J=!0)},o(M){g(T.$$.fragment,M),J=!1},d(M){M&&(o(d),o(_)),f(T,M)}}}function Vt(se){let d,P=`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=P},l(_){d=l(_,"P",{"data-svelte-h":!0}),u(d)!=="svelte-fincs2"&&(d.innerHTML=P)},m(_,T){n(_,d,T)},p:Pt,d(_){_&&o(d)}}}function Rt(se){let d,P,_,T,J,M,U,xe,R,ct='The Pixtral model was released by the Mistral AI team on <a href="https://github.com/vllm-project/vllm/pull/8377" rel="nofollow">Vllm</a>, where a version of the code can be found!',Je,N,mt="Tips:",Ue,E,pt="<li>Pixtral is a multimodal model, the main contribution is the 2d ROPE on the images, and support for arbitrary image size (the images are not padded together nor are they resized)</li> <li>This model follows the <code>Llava</code> familiy, meaning image embeddings are placed instead of the <code>[IMG]</code> token placeholders.</li> <li>The format for one or mulitple prompts is the following:</li>",Ie,S,ve,H,ht="Then, the processor will replace each <code>[IMG]</code> token with  a number of <code>[IMG]</code> token that depends on the height and the width of the image. Each <em>row</em> of the image is separated by a <code>[IMG_BREAK]</code> token, and each image is separated by a  <code>[IMG_END]</code> token.",Pe,Y,gt='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>',je,X,ft="Here is an example of how to run it:",Ge,L,Ce,q,Be,y,F,Xe,ie,ut=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralModel">PixtralModel</a>. It is used to instantiate an
Pixtral model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the Pixtral-9B.`,Le,le,Mt='e.g. <a href="https://huggingface.co/pixtral-hf/pixtral-9b" rel="nofollow">pixtral-hf/pixtral-9b</a>',qe,de,_t=`Configuration objects inherit from <a href="/docs/transformers/pr_31098/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/pr_31098/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Fe,z,ze,D,$e,w,Q,De,ce,yt=`The PIXTRAL model which consists of a vision backbone and a language model.
This model inherits from <a href="/docs/transformers/pr_31098/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.)`,Qe,me,bt=`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.`,Ae,j,A,Ke,pe,Tt='The <a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralModel">PixtralModel</a> forward method, overrides the <code>__call__</code> special method.',Oe,$,ke,K,Ze,I,O,et,he,wt="Constructs a Pixtral image processor.",tt,k,ee,ot,ge,xt="Preprocess an image or batch of images.",We,te,Ve,b,oe,at,fe,Jt="Constructs a Pixtral processor which wraps a Pixtral image processor and a Pixtral tokenizer into a single processor.",rt,ue,Ut=`<a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralProcessor">PixtralProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_31098/en/model_doc/clip#transformers.CLIPImageProcessor">CLIPImageProcessor</a> and <a href="/docs/transformers/pr_31098/en/model_doc/llama2#transformers.LlamaTokenizerFast">LlamaTokenizerFast</a>. See the
<code>__call__()</code> and <a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralProcessor.decode">decode()</a> for more information.`,nt,Z,ae,st,Me,It=`This method forwards all its arguments to LlamaTokenizerFast’s <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,it,W,re,lt,_e,vt=`This method forwards all its arguments to LlamaTokenizerFast’s <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,Re,ne,Ne,we,Ee;return J=new Te({props:{title:"Pixtral",local:"pixtral",headingTag:"h1"}}),U=new Te({props:{title:"Overview",local:"overview",headingTag:"h2"}}),S=new dt({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}}),L=new dt({props:{code:" ",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LlavaForConditionalGeneration, AutoProcessor
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

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

IMG_URLS = [
    <span class="hljs-string">&quot;https://picsum.photos/id/237/400/300&quot;</span>,
    <span class="hljs-string">&quot;https://picsum.photos/id/231/200/300&quot;</span>,
    <span class="hljs-string">&quot;https://picsum.photos/id/27/500/500&quot;</span>,
    <span class="hljs-string">&quot;https://picsum.photos/id/17/150/600&quot;</span>,
]
PROMPT = <span class="hljs-string">&quot;&lt;s&gt;[INST]Describe the images.\\n[IMG][IMG][IMG][IMG][/INST]&quot;</span>

inputs = processor(images=IMG_URLS, text=PROMPT, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
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>]

EXPECTED_GENERATION = <span class="hljs-string">&quot;&quot;&quot;
Describe the images.
Sure, let&#x27;s break down each image description:

1. **Image 1:**
   - **Description:** A black dog with a glossy coat is sitting on a wooden floor. The dog has a focused expression and is looking directly at the camera.
   - **Details:** The wooden floor has a rustic appearance with visible wood grain patterns. The dog&#x27;s eyes are a striking color, possibly brown or amber, which contrasts with its black fur.

2. **Image 2:**
   - **Description:** A scenic view of a mountainous landscape with a winding road cutting through it. The road is surrounded by lush green vegetation and leads to a distant valley.
   - **Details:** The mountains are rugged with steep slopes, and the sky is clear, indicating good weather. The winding road adds a sense of depth and perspective to the image.

3. **Image 3:**
   - **Description:** A beach scene with waves crashing against the shore. There are several people in the water and on the beach, enjoying the waves and the sunset.
   - **Details:** The waves are powerful, creating a dynamic and lively atmosphere. The sky is painted with hues of orange and pink from the setting sun, adding a warm glow to the scene.

4. **Image 4:**
   - **Description:** A garden path leading to a large tree with a bench underneath it. The path is bordered by well-maintained grass and flowers.
   - **Details:** The path is made of small stones or gravel, and the tree provides a shaded area with the bench invitingly placed beneath it. The surrounding area is lush and green, suggesting a well-kept garden.

Each image captures a different scene, from a close-up of a dog to expansive natural landscapes, showcasing various elements of nature and human interaction with it.
&quot;&quot;&quot;</span>
`,wrap:!1}}),q=new Te({props:{title:"PixtralVisionConfig",local:"transformers.PixtralVisionConfig",headingTag:"h2"}}),F=new V({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:"tie_word_embeddings",val:" = False"},{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.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie the word embeddings with the input embeddings.`,name:"tie_word_embeddings"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/pixtral/configuration_pixtral.py#L23"}}),z=new kt({props:{anchor:"transformers.PixtralVisionConfig.example",$$slots:{default:[Wt]},$$scope:{ctx:se}}}),D=new Te({props:{title:"PixtralModel",local:"transformers.PixtralModel",headingTag:"h2"}}),Q=new V({props:{name:"class transformers.PixtralModel",anchor:"transformers.PixtralModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PixtralModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralVisionConfig">PixtralVisionConfig</a> or <a href="/docs/transformers/pr_31098/en/model_doc/pixtral#transformers.PixtralVisionConfig">PixtralVisionConfig</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/pr_31098/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/vr_31098/src/transformers/models/pixtral/modeling_pixtral.py#L465"}}),A=new V({props:{name:"forward",anchor:"transformers.PixtralModel.forward",parameters:[{name:"pixel_values",val:": List"},{name:"output_hidden_states",val:": Optional = False"},{name:"output_attentions",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PixtralModel.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.PixtralModel.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.PixtralModel.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/pr_31098/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/pixtral/modeling_pixtral.py#L486",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>
`}}),$=new $t({props:{$$slots:{default:[Vt]},$$scope:{ctx:se}}}),K=new Te({props:{title:"PixtralImageProcessor",local:"transformers.PixtralImageProcessor",headingTag:"h2"}}),O=new V({props:{name:"class transformers.PixtralImageProcessor",anchor:"transformers.PixtralImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": Dict = None"},{name:"patch_size",val:": Dict = None"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = 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/vr_31098/src/transformers/models/pixtral/image_processing_pixtral.py#L231"}}),ee=new V({props:{name:"preprocess",anchor:"transformers.PixtralImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": bool = None"},{name:"size",val:": Dict = None"},{name:"patch_size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"do_convert_rgb",val:": bool = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": Optional = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = 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/vr_31098/src/transformers/models/pixtral/image_processing_pixtral.py#L368"}}),te=new Te({props:{title:"PixtralProcessor",local:"transformers.PixtralProcessor",headingTag:"h2"}}),oe=new V({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:"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/pr_31098/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/pr_31098/en/model_doc/llama2#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.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/vr_31098/src/transformers/models/pixtral/processing_pixtral.py#L104"}}),ae=new V({props:{name:"batch_decode",anchor:"transformers.PixtralProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/pixtral/processing_pixtral.py#L262"}}),re=new V({props:{name:"decode",anchor:"transformers.PixtralProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/pixtral/processing_pixtral.py#L270"}}),ne=new Zt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/pixtral.md"}}),{c(){d=i("meta"),P=a(),_=i("p"),T=a(),c(J.$$.fragment),M=a(),c(U.$$.fragment),xe=a(),R=i("p"),R.innerHTML=ct,Je=a(),N=i("p"),N.textContent=mt,Ue=a(),E=i("ul"),E.innerHTML=pt,Ie=a(),c(S.$$.fragment),ve=a(),H=i("p"),H.innerHTML=ht,Pe=a(),Y=i("p"),Y.innerHTML=gt,je=a(),X=i("p"),X.textContent=ft,Ge=a(),c(L.$$.fragment),Ce=a(),c(q.$$.fragment),Be=a(),y=i("div"),c(F.$$.fragment),Xe=a(),ie=i("p"),ie.innerHTML=ut,Le=a(),le=i("p"),le.innerHTML=Mt,qe=a(),de=i("p"),de.innerHTML=_t,Fe=a(),c(z.$$.fragment),ze=a(),c(D.$$.fragment),$e=a(),w=i("div"),c(Q.$$.fragment),De=a(),ce=i("p"),ce.innerHTML=yt,Qe=a(),me=i("p"),me.innerHTML=bt,Ae=a(),j=i("div"),c(A.$$.fragment),Ke=a(),pe=i("p"),pe.innerHTML=Tt,Oe=a(),c($.$$.fragment),ke=a(),c(K.$$.fragment),Ze=a(),I=i("div"),c(O.$$.fragment),et=a(),he=i("p"),he.textContent=wt,tt=a(),k=i("div"),c(ee.$$.fragment),ot=a(),ge=i("p"),ge.textContent=xt,We=a(),c(te.$$.fragment),Ve=a(),b=i("div"),c(oe.$$.fragment),at=a(),fe=i("p"),fe.textContent=Jt,rt=a(),ue=i("p"),ue.innerHTML=Ut,nt=a(),Z=i("div"),c(ae.$$.fragment),st=a(),Me=i("p"),Me.innerHTML=It,it=a(),W=i("div"),c(re.$$.fragment),lt=a(),_e=i("p"),_e.innerHTML=vt,Re=a(),c(ne.$$.fragment),Ne=a(),we=i("p"),this.h()},l(e){const t=zt("svelte-u9bgzb",document.head);d=l(t,"META",{name:!0,content:!0}),t.forEach(o),P=r(e),_=l(e,"P",{}),C(_).forEach(o),T=r(e),m(J.$$.fragment,e),M=r(e),m(U.$$.fragment,e),xe=r(e),R=l(e,"P",{"data-svelte-h":!0}),u(R)!=="svelte-5qqfj4"&&(R.innerHTML=ct),Je=r(e),N=l(e,"P",{"data-svelte-h":!0}),u(N)!=="svelte-axv494"&&(N.textContent=mt),Ue=r(e),E=l(e,"UL",{"data-svelte-h":!0}),u(E)!=="svelte-njbux6"&&(E.innerHTML=pt),Ie=r(e),m(S.$$.fragment,e),ve=r(e),H=l(e,"P",{"data-svelte-h":!0}),u(H)!=="svelte-7bcz5w"&&(H.innerHTML=ht),Pe=r(e),Y=l(e,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-18lxr6r"&&(Y.innerHTML=gt),je=r(e),X=l(e,"P",{"data-svelte-h":!0}),u(X)!=="svelte-h0po0h"&&(X.textContent=ft),Ge=r(e),m(L.$$.fragment,e),Ce=r(e),m(q.$$.fragment,e),Be=r(e),y=l(e,"DIV",{class:!0});var x=C(y);m(F.$$.fragment,x),Xe=r(x),ie=l(x,"P",{"data-svelte-h":!0}),u(ie)!=="svelte-bhfqna"&&(ie.innerHTML=ut),Le=r(x),le=l(x,"P",{"data-svelte-h":!0}),u(le)!=="svelte-l0qt95"&&(le.innerHTML=Mt),qe=r(x),de=l(x,"P",{"data-svelte-h":!0}),u(de)!=="svelte-1eopo2z"&&(de.innerHTML=_t),Fe=r(x),m(z.$$.fragment,x),x.forEach(o),ze=r(e),m(D.$$.fragment,e),$e=r(e),w=l(e,"DIV",{class:!0});var v=C(w);m(Q.$$.fragment,v),De=r(v),ce=l(v,"P",{"data-svelte-h":!0}),u(ce)!=="svelte-17h2pm8"&&(ce.innerHTML=yt),Qe=r(v),me=l(v,"P",{"data-svelte-h":!0}),u(me)!=="svelte-hswkmf"&&(me.innerHTML=bt),Ae=r(v),j=l(v,"DIV",{class:!0});var ye=C(j);m(A.$$.fragment,ye),Ke=r(ye),pe=l(ye,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-1ntvowk"&&(pe.innerHTML=Tt),Oe=r(ye),m($.$$.fragment,ye),ye.forEach(o),v.forEach(o),ke=r(e),m(K.$$.fragment,e),Ze=r(e),I=l(e,"DIV",{class:!0});var be=C(I);m(O.$$.fragment,be),et=r(be),he=l(be,"P",{"data-svelte-h":!0}),u(he)!=="svelte-1eqw4iw"&&(he.textContent=wt),tt=r(be),k=l(be,"DIV",{class:!0});var Se=C(k);m(ee.$$.fragment,Se),ot=r(Se),ge=l(Se,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-1x3yxsa"&&(ge.textContent=xt),Se.forEach(o),be.forEach(o),We=r(e),m(te.$$.fragment,e),Ve=r(e),b=l(e,"DIV",{class:!0});var G=C(b);m(oe.$$.fragment,G),at=r(G),fe=l(G,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-1i1eb5d"&&(fe.textContent=Jt),rt=r(G),ue=l(G,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-1xan2hv"&&(ue.innerHTML=Ut),nt=r(G),Z=l(G,"DIV",{class:!0});var He=C(Z);m(ae.$$.fragment,He),st=r(He),Me=l(He,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-1xebko3"&&(Me.innerHTML=It),He.forEach(o),it=r(G),W=l(G,"DIV",{class:!0});var Ye=C(W);m(re.$$.fragment,Ye),lt=r(Ye),_e=l(Ye,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-1w1zri5"&&(_e.innerHTML=vt),Ye.forEach(o),G.forEach(o),Re=r(e),m(ne.$$.fragment,e),Ne=r(e),we=l(e,"P",{}),C(we).forEach(o),this.h()},h(){B(d,"name","hf:doc:metadata"),B(d,"content",Nt),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(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(b,"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){s(document.head,d),n(e,P,t),n(e,_,t),n(e,T,t),p(J,e,t),n(e,M,t),p(U,e,t),n(e,xe,t),n(e,R,t),n(e,Je,t),n(e,N,t),n(e,Ue,t),n(e,E,t),n(e,Ie,t),p(S,e,t),n(e,ve,t),n(e,H,t),n(e,Pe,t),n(e,Y,t),n(e,je,t),n(e,X,t),n(e,Ge,t),p(L,e,t),n(e,Ce,t),p(q,e,t),n(e,Be,t),n(e,y,t),p(F,y,null),s(y,Xe),s(y,ie),s(y,Le),s(y,le),s(y,qe),s(y,de),s(y,Fe),p(z,y,null),n(e,ze,t),p(D,e,t),n(e,$e,t),n(e,w,t),p(Q,w,null),s(w,De),s(w,ce),s(w,Qe),s(w,me),s(w,Ae),s(w,j),p(A,j,null),s(j,Ke),s(j,pe),s(j,Oe),p($,j,null),n(e,ke,t),p(K,e,t),n(e,Ze,t),n(e,I,t),p(O,I,null),s(I,et),s(I,he),s(I,tt),s(I,k),p(ee,k,null),s(k,ot),s(k,ge),n(e,We,t),p(te,e,t),n(e,Ve,t),n(e,b,t),p(oe,b,null),s(b,at),s(b,fe),s(b,rt),s(b,ue),s(b,nt),s(b,Z),p(ae,Z,null),s(Z,st),s(Z,Me),s(b,it),s(b,W),p(re,W,null),s(W,lt),s(W,_e),n(e,Re,t),p(ne,e,t),n(e,Ne,t),n(e,we,t),Ee=!0},p(e,[t]){const x={};t&2&&(x.$$scope={dirty:t,ctx:e}),z.$set(x);const v={};t&2&&(v.$$scope={dirty:t,ctx:e}),$.$set(v)},i(e){Ee||(h(J.$$.fragment,e),h(U.$$.fragment,e),h(S.$$.fragment,e),h(L.$$.fragment,e),h(q.$$.fragment,e),h(F.$$.fragment,e),h(z.$$.fragment,e),h(D.$$.fragment,e),h(Q.$$.fragment,e),h(A.$$.fragment,e),h($.$$.fragment,e),h(K.$$.fragment,e),h(O.$$.fragment,e),h(ee.$$.fragment,e),h(te.$$.fragment,e),h(oe.$$.fragment,e),h(ae.$$.fragment,e),h(re.$$.fragment,e),h(ne.$$.fragment,e),Ee=!0)},o(e){g(J.$$.fragment,e),g(U.$$.fragment,e),g(S.$$.fragment,e),g(L.$$.fragment,e),g(q.$$.fragment,e),g(F.$$.fragment,e),g(z.$$.fragment,e),g(D.$$.fragment,e),g(Q.$$.fragment,e),g(A.$$.fragment,e),g($.$$.fragment,e),g(K.$$.fragment,e),g(O.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(oe.$$.fragment,e),g(ae.$$.fragment,e),g(re.$$.fragment,e),g(ne.$$.fragment,e),Ee=!1},d(e){e&&(o(P),o(_),o(T),o(M),o(xe),o(R),o(Je),o(N),o(Ue),o(E),o(Ie),o(ve),o(H),o(Pe),o(Y),o(je),o(X),o(Ge),o(Ce),o(Be),o(y),o(ze),o($e),o(w),o(ke),o(Ze),o(I),o(We),o(Ve),o(b),o(Re),o(Ne),o(we)),o(d),f(J,e),f(U,e),f(S,e),f(L,e),f(q,e),f(F),f(z),f(D,e),f(Q),f(A),f($),f(K,e),f(O),f(ee),f(te,e),f(oe),f(ae),f(re),f(ne,e)}}}const Nt='{"title":"Pixtral","local":"pixtral","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"PixtralVisionConfig","local":"transformers.PixtralVisionConfig","sections":[],"depth":2},{"title":"PixtralModel","local":"transformers.PixtralModel","sections":[],"depth":2},{"title":"PixtralImageProcessor","local":"transformers.PixtralImageProcessor","sections":[],"depth":2},{"title":"PixtralProcessor","local":"transformers.PixtralProcessor","sections":[],"depth":2}],"depth":1}';function Et(se){return Gt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Dt extends Ct{constructor(d){super(),Bt(this,d,Et,Rt,jt,{})}}export{Dt as component};
