Buckets:
| import"../chunks/DsnmJJEf.js";import{i as Qe,h as Ae,C as De,H as a,a as l,D as n,E as Ee,s as Ye}from"../chunks/qxQfBDOH.js";import{p as He,o as Oe,s as e,f as m,a as c,b as Ke,d as t,c as h,r,n as g}from"../chunks/Dpn4EqEf.js";import{T as u}from"../chunks/BRV980rc.js";import{E as p}from"../chunks/BD6i_DTX.js";const $e='{"title":"CohereCompass","local":"coherecompass","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage examples","local":"usage-examples","sections":[],"depth":2},{"title":"CohereCompassConfig","local":"transformers.CohereCompassConfig","sections":[],"depth":2},{"title":"CohereCompassTextConfig","local":"transformers.CohereCompassTextConfig","sections":[],"depth":2},{"title":"CohereCompassVisionConfig","local":"transformers.CohereCompassVisionConfig","sections":[],"depth":2},{"title":"CohereCompassModel","local":"transformers.CohereCompassModel","sections":[],"depth":2},{"title":"CohereCompassTextModel","local":"transformers.CohereCompassTextModel","sections":[],"depth":2},{"title":"CohereCompassVisionModel","local":"transformers.CohereCompassVisionModel","sections":[],"depth":2},{"title":"CohereCompassForConditionalGeneration","local":"transformers.CohereCompassForConditionalGeneration","sections":[],"depth":2},{"title":"CohereCompassForCausalLM","local":"transformers.CohereCompassForCausalLM","sections":[],"depth":2},{"title":"CohereCompassTextForSequenceClassification","local":"transformers.CohereCompassTextForSequenceClassification","sections":[],"depth":2},{"title":"CohereCompassImageProcessor","local":"transformers.CohereCompassImageProcessor","sections":[],"depth":2},{"title":"CohereCompassImageProcessorPil","local":"transformers.CohereCompassImageProcessorPil","sections":[],"depth":2},{"title":"CohereCompassVideoProcessor","local":"transformers.CohereCompassVideoProcessor","sections":[],"depth":2},{"title":"CohereCompassProcessor","local":"transformers.CohereCompassProcessor","sections":[],"depth":2}],"depth":1}';var eo=h('<meta name="hf:doc:metadata"/>'),_=h("<p>Example:</p> <!>",1),f=h(`<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.</p>`),oo=h("<p>Example of single-label classification:</p> <!>",1),so=h("<p>Example of multi-label classification:</p> <!>",1),no=h(`<p></p> <p><em>This model was contributed to Hugging Face Transformers on 2026-08-10.</em></p> <!> <!> <div class="flex flex-wrap space-x-1"><img alt="FlashAttention" src="https://img.shields.io/badge/%E2%9A%A1%EF%B8%8E%20FlashAttention-eae0c8?style=flat"/> <img alt="SDPA" src="https://img.shields.io/badge/SDPA-DE3412?style=flat&logo=pytorch&logoColor=white"/></div> <!> <p>CohereCompass is the base architecture for small, specialized (vision-)language models trained by Cohere.</p> <!> <p>The following example loads an image from a URL and asks the model to describe it. Prompts can interleave text with one or more images; for text-only prompts, omit the image entries.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>This is the configuration class to store the configuration of a CohereCompassModel. It is used to instantiate a Cohere Compass | |
| 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 <a href="https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct" rel="nofollow">CohereLabs/North-Micro-Vision-Instruct</a></p> <p>Configuration objects inherit from <a href="/docs/transformers/pr_49429/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_49429/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> for more information.</p> <!></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>This is the configuration class to store the configuration of a CohereCompassModel. It is used to instantiate a Cohere Compass | |
| 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 <a href="https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct" rel="nofollow">CohereLabs/North-Micro-Vision-Instruct</a></p> <p>Configuration objects inherit from <a href="/docs/transformers/pr_49429/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_49429/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> for more information.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>This is the configuration class to store the configuration of a CohereCompassModel. It is used to instantiate a Cohere Compass | |
| 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 <a href="https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct" rel="nofollow">CohereLabs/North-Micro-Vision-Instruct</a></p> <p>Configuration objects inherit from <a href="/docs/transformers/pr_49429/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_49429/en/main_classes/configuration#transformers.PreTrainedConfig">PreTrainedConfig</a> for more information.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The bare Cohere Compass Model outputting raw hidden-states without any specific head on top.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassModel">CohereCompassModel</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> <p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if <code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li> <li><p><strong>rope_deltas</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) — The rope index difference between sequence length and multimodal rope. | |
| The attribute is deprecated and will be removed in v5.20, use <code>model.base_model.rope_deltas</code> instead.</p></li></ul></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The bare Cohere Compass Text Model outputting raw hidden-states without any specific head on top.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassTextModel">CohereCompassTextModel</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> <p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if <code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li></ul></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The bare Cohere Compass Model outputting raw hidden-states without any specific head on top.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The CohereCompass model with a language modeling head, for image-text-to-text generation.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassForConditionalGeneration">CohereCompassForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p></li> <li><p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li></ul> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <ul><li><p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p></li> <li><p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state of the first token of the sequence (classification token) after further processing | |
| through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns | |
| the classification token after processing through a linear layer and a tanh activation function. The linear | |
| layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li> <li><p><strong>deepstack_features</strong> (<code>List[torch.FloatTensor]</code>, <em>optional</em>) — List of hidden-states (feature maps) from deepstack layers.</p></li></ul> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The Cohere Compass Model for causal language modeling.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassForCausalLM">CohereCompassForCausalLM</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p></li> <li><p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li></ul> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The CohereCompass model with a sequence classification head on top.</p> <p>This model inherits from <a href="/docs/transformers/pr_49429/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.)</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassTextForSequenceClassification">CohereCompassTextForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.</p> <!> <ul><li><p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p></li> <li><p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p></li> <li><p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance. For more details, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>.</p> <p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p></li> <li><p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p></li> <li><p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p></li></ul> <!> <!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Constructs a CohereCompassImageProcessor image processor.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Constructs a CohereCompassImageProcessor image processor.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Constructs a CohereCompassVideoProcessor video processor.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Constructs a CohereCompassProcessor which wraps a image processor, a tokenizer, and a video processor into a single processor.</p> <p><a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassProcessor">CohereCompassProcessor</a> offers all the functionalities of <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">CohereCompassImageProcessor</a>, <code>tokenizer_class</code>, and <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">CohereCompassVideoProcessor</a>. See the <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">~CohereCompassImageProcessor</a>, <code>~tokenizer_class</code>, and <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">~CohereCompassVideoProcessor</a> for more information.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <p></p>`,1);function lo(Ue,Ie){He(Ie,!1),Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),Qe();var j=no();Ae("1xbtnlf",s=>{var i=eo();Ye(i,"content",$e),c(s,i)});var J=e(m(j),4);De(J,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var q=e(J,2);a(q,{title:"CohereCompass",local:"coherecompass",headingTag:"h1"});var F=e(q,4);a(F,{title:"Overview",local:"overview",headingTag:"h2"});var V=e(F,4);a(V,{title:"Usage examples",local:"usage-examples",headingTag:"h2"});var W=e(V,4);l(W,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9ySW1hZ2VUZXh0VG9UZXh0JTJDJTIwQXV0b1Byb2Nlc3NvciUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyQ29oZXJlTGFicyUyRk5vcnRoLU1pY3JvLVZpc2lvbi1JbnN0cnVjdCUyMiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9ySW1hZ2VUZXh0VG9UZXh0LmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBKSUwQSUwQWltYWdlX3VybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGY2RuLXVwbG9hZHMuaHVnZ2luZ2ZhY2UuY28lMkZwcm9kdWN0aW9uJTJGdXBsb2FkcyUyRjY2ZDczMmVmZmU2Njg0ZmMxNmIxMmMyOCUyRklvXzVPQ21mdHNtSC1uMTU4WnRQcy5wbmclMjIlMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyY29udGVudCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJpbWFnZSUyMiUyQyUyMCUyMnVybCUyMiUzQSUyMGltYWdlX3VybCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoYXQlMjBkbyUyMHlvdSUyMHNlZSUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUwQSU1RCUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYWRkX2dlbmVyYXRpb25fcHJvbXB0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdCUzRFRydWUlMkMlMEEpLnRvKG1vZGVsLmRldmljZSklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoJTBBJTIwJTIwJTIwJTIwKippbnB1dHMlMkMlMEElMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDEyOCUyQyUwQSklMEElMEFpbnB1dF9sZW5ndGglMjAlM0QlMjBpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQuc2hhcGUlNUItMSU1RCUwQXJlc3BvbnNlJTIwJTNEJTIwcHJvY2Vzc29yLmRlY29kZSglMEElMjAlMjAlMjAlMjBvdXRwdXRzJTVCMCU1RCU1QmlucHV0X2xlbmd0aCUzQSU1RCUyQyUwQSUyMCUyMCUyMCUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTBBKSUwQXByaW50KHJlc3BvbnNlKQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageTextToText, AutoProcessor | |
| model_id = <span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span> | |
| processor = AutoProcessor.from_pretrained(model_id) | |
| model = AutoModelForImageTextToText.from_pretrained( | |
| model_id, | |
| device_map=<span class="hljs-string">"auto"</span>, | |
| ) | |
| image_url = <span class="hljs-string">"https://cdn-uploads.huggingface.co/production/uploads/66d732effe6684fc16b12c28/Io_5OCmftsmH-n158ZtPs.png"</span> | |
| messages = [ | |
| { | |
| <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, | |
| <span class="hljs-string">"content"</span>: [ | |
| {<span class="hljs-string">"type"</span>: <span class="hljs-string">"image"</span>, <span class="hljs-string">"url"</span>: image_url}, | |
| {<span class="hljs-string">"type"</span>: <span class="hljs-string">"text"</span>, <span class="hljs-string">"text"</span>: <span class="hljs-string">"What do you see?"</span>}, | |
| ], | |
| } | |
| ] | |
| inputs = processor.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span>, | |
| return_dict=<span class="hljs-literal">True</span>, | |
| ).to(model.device) | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=<span class="hljs-number">128</span>, | |
| ) | |
| input_length = inputs[<span class="hljs-string">"input_ids"</span>].shape[-<span class="hljs-number">1</span>] | |
| response = processor.decode( | |
| outputs[<span class="hljs-number">0</span>][input_length:], | |
| skip_special_tokens=<span class="hljs-literal">True</span>, | |
| ) | |
| <span class="hljs-built_in">print</span>(response)`,lang:"python",wrap:!1});var R=e(W,2);a(R,{title:"CohereCompassConfig",local:"transformers.CohereCompassConfig",headingTag:"h2"});var C=e(R,2),Z=t(C);n(Z,{name:"class transformers.CohereCompassConfig",anchor:"transformers.CohereCompassConfig",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/configuration_cohere_compass.py#L147",parameters:[{name:"transformers_version",val:": str | None = None"},{name:"architectures",val:": list[str] | None = None"},{name:"output_hidden_states",val:": bool | None = False"},{name:"return_dict",val:": bool | None = True"},{name:"dtype",val:": str | torch.dtype | None = None"},{name:"chunk_size_feed_forward",val:": int = 0"},{name:"is_encoder_decoder",val:": bool = False"},{name:"id2label",val:": dict[int, str] | dict[str, str] | None = None"},{name:"label2id",val:": dict[str, int] | dict[str, str] | None = None"},{name:"problem_type",val:": Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None"},{name:"text_config",val:": dict | transformers.configuration_utils.PreTrainedConfig | None = None"},{name:"vision_config",val:": dict | transformers.configuration_utils.PreTrainedConfig | None = None"},{name:"image_token_id",val:": int = 255031"},{name:"video_token_id",val:": int = 255032"},{name:"vision_start_token_id",val:": int = 255028"},{name:"vision_end_token_id",val:": int = 255029"},{name:"tie_word_embeddings",val:": bool = False"}],parametersDescription:[{anchor:"transformers.CohereCompassConfig.text_config",description:`<strong>text_config</strong> (<code>Union[dict, ~configuration_utils.PreTrainedConfig]</code>, <em>optional</em>) — | |
| The config object or dictionary of the text backbone.`,name:"text_config"},{anchor:"transformers.CohereCompassConfig.vision_config",description:`<strong>vision_config</strong> (<code>Union[dict, ~configuration_utils.PreTrainedConfig]</code>, <em>optional</em>) — | |
| The config object or dictionary of the vision backbone.`,name:"vision_config"},{anchor:"transformers.CohereCompassConfig.image_token_id",description:`<strong>image_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>255031</code>) — | |
| The image token index used as a placeholder for input images.`,name:"image_token_id"},{anchor:"transformers.CohereCompassConfig.video_token_id",description:`<strong>video_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>255032</code>) — | |
| The video token index used as a placeholder for input videos.`,name:"video_token_id"},{anchor:"transformers.CohereCompassConfig.vision_start_token_id",description:`<strong>vision_start_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>255028</code>) — | |
| Token ID that marks the start of a visual segment in the multimodal input sequence.`,name:"vision_start_token_id"},{anchor:"transformers.CohereCompassConfig.vision_end_token_id",description:`<strong>vision_end_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>255029</code>) — | |
| Token ID that marks the end of a visual segment in the multimodal input sequence.`,name:"vision_end_token_id"},{anchor:"transformers.CohereCompassConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to tie weight embeddings according to model’s <code>tied_weights_keys</code> mapping.`,name:"tie_word_embeddings"}]});var Pe=e(Z,6);p(Pe,{anchor:"transformers.CohereCompassConfig.example",children:(s,i)=>{var o=_(),d=e(m(o),2);l(d,{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvaGVyZUNvbXBhc3NGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMkMlMjBDb2hlcmVDb21wYXNzQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwQ29oZXJlQ29tcGFzc0NvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMENvaGVyZUNvbXBhc3NGb3JDb25kaXRpb25hbEdlbmVyYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CohereCompassForConditionalGeneration, CohereCompassConfig | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a "CohereLabs/North-Micro-Vision-Instruct" style configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = CohereCompassConfig() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a model from the "CohereLabs/North-Micro-Vision-Instruct" style configuration</span> | |
| <span class="hljs-meta">>>> </span>model = CohereCompassForConditionalGeneration(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}}),r(C);var G=e(C,2);a(G,{title:"CohereCompassTextConfig",local:"transformers.CohereCompassTextConfig",headingTag:"h2"});var b=e(G,2),Ne=t(b);n(Ne,{name:"class transformers.CohereCompassTextConfig",anchor:"transformers.CohereCompassTextConfig",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/configuration_cohere_compass.py#L62",parameters:[{name:"transformers_version",val:": str | None = None"},{name:"architectures",val:": list[str] | None = None"},{name:"output_hidden_states",val:": bool | None = False"},{name:"return_dict",val:": bool | None = True"},{name:"dtype",val:": str | torch.dtype | None = None"},{name:"chunk_size_feed_forward",val:": int = 0"},{name:"is_encoder_decoder",val:": bool = False"},{name:"id2label",val:": dict[int, str] | dict[str, str] | None = None"},{name:"label2id",val:": dict[str, int] | dict[str, str] | None = None"},{name:"problem_type",val:": Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None"},{name:"vocab_size",val:": int = 256000"},{name:"hidden_size",val:": int = 8192"},{name:"intermediate_size",val:": int = 22528"},{name:"logit_scale",val:": float | None = None"},{name:"num_hidden_layers",val:": int = 40"},{name:"num_attention_heads",val:": int = 64"},{name:"num_key_value_heads",val:": int | None = None"},{name:"hidden_act",val:": str = 'silu'"},{name:"max_position_embeddings",val:": int = 8192"},{name:"initializer_range",val:": float = 0.02"},{name:"layer_norm_eps",val:": float = 1e-05"},{name:"use_cache",val:": bool = True"},{name:"pad_token_id",val:": int | None = 0"},{name:"bos_token_id",val:": int | None = 5"},{name:"eos_token_id",val:": int | list[int] | None = 255001"},{name:"tie_word_embeddings",val:": bool = True"},{name:"rope_parameters",val:": dict[str, transformers.modeling_rope_utils.RopeParameters | dict | float | str | int | None] | None = None"},{name:"attention_bias",val:": bool = False"},{name:"attention_dropout",val:": float | int = 0.0"},{name:"sliding_window",val:": int | None = 4096"},{name:"layer_types",val:": list[str] | None = None"},{name:"pooling",val:": str | None = None"}],parametersDescription:[{anchor:"transformers.CohereCompassTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>256000</code>) — | |
| Vocabulary size of the model. Defines the number of different tokens that can be represented by the <code>input_ids</code>.`,name:"vocab_size"},{anchor:"transformers.CohereCompassTextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8192</code>) — | |
| Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.CohereCompassTextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>22528</code>) — | |
| Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.CohereCompassTextConfig.logit_scale",description:`<strong>logit_scale</strong> (<code>float</code>, <em>optional</em>) — | |
| Scale applied to language-model logits.`,name:"logit_scale"},{anchor:"transformers.CohereCompassTextConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to <code>40</code>) — | |
| Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.CohereCompassTextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>64</code>) — | |
| Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.CohereCompassTextConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>) — | |
| This is the number of key_value heads that should be used to implement Grouped Query Attention. If | |
| <code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if | |
| <code>num_key_value_heads=1</code> the model will use Multi Query Attention (MQA) otherwise GQA is used. When | |
| converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed | |
| by meanpooling all the original heads within that group. For more details, check out <a href="https://huggingface.co/papers/2305.13245" rel="nofollow">this | |
| paper</a>. If it is not specified, will default to | |
| <code>num_attention_heads</code>.`,name:"num_key_value_heads"},{anchor:"transformers.CohereCompassTextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>silu</code>) — | |
| The non-linear activation function (function or string) in the decoder. For example, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"silu"</code>, etc.`,name:"hidden_act"},{anchor:"transformers.CohereCompassTextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8192</code>) — | |
| The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.CohereCompassTextConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.02</code>) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.CohereCompassTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1e-05</code>) — | |
| The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.CohereCompassTextConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not the model should return the last key/values attentions (not used by all models). Only | |
| relevant if <code>config.is_decoder=True</code> or when the model is a decoder-only generative model.`,name:"use_cache"},{anchor:"transformers.CohereCompassTextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| Token id used for padding in the vocabulary.`,name:"pad_token_id"},{anchor:"transformers.CohereCompassTextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to <code>5</code>) — | |
| Token id used for beginning-of-stream in the vocabulary.`,name:"bos_token_id"},{anchor:"transformers.CohereCompassTextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, list[int]]</code>, <em>optional</em>, defaults to <code>255001</code>) — | |
| Token id used for end-of-stream in the vocabulary.`,name:"eos_token_id"},{anchor:"transformers.CohereCompassTextConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to tie weight embeddings according to model’s <code>tied_weights_keys</code> mapping.`,name:"tie_word_embeddings"},{anchor:"transformers.CohereCompassTextConfig.rope_parameters",description:`<strong>rope_parameters</strong> (<code>dict[str, ~modeling_rope_utils.RopeParameters | dict | float | str | int | NoneType]</code>, <em>optional</em>) — | |
| Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain | |
| a value for <code>rope_theta</code> and optionally parameters used for scaling in case you want to use RoPE | |
| with longer <code>max_position_embeddings</code>.`,name:"rope_parameters"},{anchor:"transformers.CohereCompassTextConfig.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use a bias in the query, key, value and output projection layers during self-attention.`,name:"attention_bias"},{anchor:"transformers.CohereCompassTextConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>Union[float, int]</code>, <em>optional</em>, defaults to <code>0.0</code>) — | |
| The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.CohereCompassTextConfig.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to <code>4096</code>) — | |
| Sliding window attention window size. If <code>None</code>, no sliding window is applied.`,name:"sliding_window"},{anchor:"transformers.CohereCompassTextConfig.layer_types",description:`<strong>layer_types</strong> (<code>list[str]</code>, <em>optional</em>) — | |
| A list that explicitly maps each layer index with its layer type. If not provided, it will be automatically | |
| generated based on config values.`,name:"layer_types"},{anchor:"transformers.CohereCompassTextConfig.pooling",description:`<strong>pooling</strong> (<code>str</code>, <em>optional</em>) — | |
| The pooling strategy (<code>bos</code> | <code>eos</code> | <code>mean</code>); <code>None</code> defaults to <code>eos</code>.`,name:"pooling"}]}),g(4),r(b);var B=e(b,2);a(B,{title:"CohereCompassVisionConfig",local:"transformers.CohereCompassVisionConfig",headingTag:"h2"});var y=e(B,2),je=t(y);n(je,{name:"class transformers.CohereCompassVisionConfig",anchor:"transformers.CohereCompassVisionConfig",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/configuration_cohere_compass.py#L29",parameters:[{name:"transformers_version",val:": str | None = None"},{name:"architectures",val:": list[str] | None = None"},{name:"output_hidden_states",val:": bool | None = False"},{name:"return_dict",val:": bool | None = True"},{name:"dtype",val:": str | torch.dtype | None = None"},{name:"chunk_size_feed_forward",val:": int = 0"},{name:"is_encoder_decoder",val:": bool = False"},{name:"id2label",val:": dict[int, str] | dict[str, str] | None = None"},{name:"label2id",val:": dict[str, int] | dict[str, str] | None = None"},{name:"problem_type",val:": Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None"},{name:"depth",val:": int = 27"},{name:"hidden_size",val:": int = 1152"},{name:"hidden_act",val:": str = 'gelu_pytorch_tanh'"},{name:"intermediate_size",val:": int = 4304"},{name:"num_heads",val:": int = 16"},{name:"in_channels",val:": int = 3"},{name:"patch_size",val:": int | list[int] | tuple[int, int] = 16"},{name:"spatial_merge_size",val:": int = 2"},{name:"temporal_patch_size",val:": int | list[int] | tuple[int, int] = 2"},{name:"out_hidden_size",val:": int = 3584"},{name:"num_position_embeddings",val:": int = 2304"},{name:"deepstack_visual_indexes",val:": list[int] | tuple[int, ...] = (8, 16, 24)"},{name:"initializer_range",val:": float = 0.02"},{name:"rope_parameters",val:": dict | None = None"}],parametersDescription:[{anchor:"transformers.CohereCompassVisionConfig.depth",description:`<strong>depth</strong> (<code>int</code>, <em>optional</em>, defaults to <code>27</code>) — | |
| Number of Transformer layers in the vision encoder.`,name:"depth"},{anchor:"transformers.CohereCompassVisionConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1152</code>) — | |
| Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.CohereCompassVisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>gelu_pytorch_tanh</code>) — | |
| The non-linear activation function (function or string) in the decoder. For example, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"silu"</code>, etc.`,name:"hidden_act"},{anchor:"transformers.CohereCompassVisionConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>4304</code>) — | |
| Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.CohereCompassVisionConfig.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) — | |
| Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_heads"},{anchor:"transformers.CohereCompassVisionConfig.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>3</code>) — | |
| The number of input channels.`,name:"in_channels"},{anchor:"transformers.CohereCompassVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>Union[int, list[int], tuple[int, int]]</code>, <em>optional</em>, defaults to <code>16</code>) — | |
| The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.CohereCompassVisionConfig.spatial_merge_size",description:`<strong>spatial_merge_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| The size of the spatial merge window used to reduce the number of visual tokens by merging neighboring patches.`,name:"spatial_merge_size"},{anchor:"transformers.CohereCompassVisionConfig.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>Union[int, list[int], tuple[int, int]]</code>, <em>optional</em>, defaults to <code>2</code>) — | |
| Temporal patch size used in the 3D patch embedding for video inputs.`,name:"temporal_patch_size"},{anchor:"transformers.CohereCompassVisionConfig.out_hidden_size",description:`<strong>out_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3584) — | |
| The output hidden size of the vision model.`,name:"out_hidden_size"},{anchor:"transformers.CohereCompassVisionConfig.num_position_embeddings",description:`<strong>num_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 2304) — | |
| The maximum sequence length that this model might ever be used with`,name:"num_position_embeddings"},{anchor:"transformers.CohereCompassVisionConfig.deepstack_visual_indexes",description:`<strong>deepstack_visual_indexes</strong> (<code>list[int]</code>, <em>optional</em>, defaults to <code>[8, 16, 24]</code>) — | |
| Indexed of layers for deepstack embeddings.`,name:"deepstack_visual_indexes"},{anchor:"transformers.CohereCompassVisionConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.02</code>) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.CohereCompassVisionConfig.rope_parameters",description:`<strong>rope_parameters</strong> (<code>dict</code>, <em>optional</em>) — | |
| Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain | |
| a value for <code>rope_theta</code> and optionally parameters used for scaling in case you want to use RoPE | |
| with longer <code>max_position_embeddings</code>.`,name:"rope_parameters"}]}),g(4),r(y);var L=e(y,2);a(L,{title:"CohereCompassModel",local:"transformers.CohereCompassModel",headingTag:"h2"});var v=e(L,2),S=t(v);n(S,{name:"class transformers.CohereCompassModel",anchor:"transformers.CohereCompassModel",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L970",parameters:[{name:"config",val:": CohereCompassConfig"}],parametersDescription:[{anchor:"transformers.CohereCompassModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig">CohereCompassConfig</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var X=e(S,8),Q=t(X);n(Q,{name:"forward",anchor:"transformers.CohereCompassModel.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1254",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_values_videos",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"video_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"mm_token_type_ids",val:": typing.Optional[torch.IntTensor] = None"},{name:"mm_encoder_outputs",val:": dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CohereCompassModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CohereCompassModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CohereCompassModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CohereCompassModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CohereCompassModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) — | |
| The tensors corresponding to the input images. Pixel values can be obtained using | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">CohereCompassImageProcessor</a>. See <a href="/docs/transformers/pr_49429/en/model_doc/molmo2#transformers.Molmo2ImageProcessor.__call__">CohereCompassImageProcessor.<strong>call</strong>()</a> for details (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassProcessor">CohereCompassProcessor</a> uses | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">CohereCompassImageProcessor</a> for processing images).`,name:"pixel_values"},{anchor:"transformers.CohereCompassModel.forward.pixel_values_videos",description:`<strong>pixel_values_videos</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_frames, num_channels, frame_size, frame_size)</code>, <em>optional</em>) — | |
| The tensors corresponding to the input video. Pixel values for videos can be obtained using | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">CohereCompassVideoProcessor</a>. See <a href="/docs/transformers/pr_49429/en/model_doc/molmo2#transformers.Molmo2VideoProcessor.__call__">CohereCompassVideoProcessor.<strong>call</strong>()</a> for details (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassProcessor">CohereCompassProcessor</a> uses | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">CohereCompassVideoProcessor</a> for processing videos).`,name:"pixel_values_videos"},{anchor:"transformers.CohereCompassModel.forward.image_grid_thw",description:`<strong>image_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_images, 3)</code>, <em>optional</em>) — | |
| The temporal, height and width of feature shape of each image in LLM.`,name:"image_grid_thw"},{anchor:"transformers.CohereCompassModel.forward.video_grid_thw",description:`<strong>video_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_videos, 3)</code>, <em>optional</em>) — | |
| The temporal, height and width of feature shape of each video in LLM.`,name:"video_grid_thw"},{anchor:"transformers.CohereCompassModel.forward.mm_token_type_ids",description:`<strong>mm_token_type_ids</strong> (<code>torch.IntTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens matching each modality. For example text (0), image (1), video (2). | |
| Multimodal token type ids can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <a href="/docs/transformers/pr_49429/en/main_classes/processors#transformers.ProcessorMixin.__call__">ProcessorMixin.<strong>call</strong>()</a> for details.`,name:"mm_token_type_ids"},{anchor:"transformers.CohereCompassModel.forward.mm_encoder_outputs",description:`<strong>mm_encoder_outputs</strong> (<code>dict[str, ~modeling_outputs.BaseModelOutputWithPooling]</code>, <em>optional</em>) — | |
| Dict where keys are supported modalities and values are encoded outputs for that modality. Each encoded output is a tuple | |
| that consists of (<code>pooler_output</code>, <em>optional</em>: <code>last_hidden_states</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>) | |
| <code>pooler_output</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of | |
| multimmodal features of the encoder merged into text embeddings.`,name:"mm_encoder_outputs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>CohereCompassModelOutputWithPast</code> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>CohereCompassModelOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var Je=e(Q,4);u(Je,{children:(s,i)=>{var o=f();c(s,o)},$$slots:{default:!0}}),g(2),r(X),r(v);var A=e(v,2);a(A,{title:"CohereCompassTextModel",local:"transformers.CohereCompassTextModel",headingTag:"h2"});var T=e(A,2),D=t(T);n(D,{name:"class transformers.CohereCompassTextModel",anchor:"transformers.CohereCompassTextModel",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L405",parameters:[{name:"config",val:": CohereCompassTextConfig"}],parametersDescription:[{anchor:"transformers.CohereCompassTextModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassTextConfig">CohereCompassTextConfig</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var E=e(D,8),Y=t(E);n(Y,{name:"forward",anchor:"transformers.CohereCompassTextModel.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L428",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"visual_pos_masks",val:": typing.Optional[torch.Tensor] = None"},{name:"deepstack_visual_embeds",val:": list[torch.Tensor] | None = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassTextModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CohereCompassTextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CohereCompassTextModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CohereCompassTextModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CohereCompassTextModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CohereCompassTextModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CohereCompassTextModel.forward.visual_pos_masks",description:`<strong>visual_pos_masks</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, seqlen)</code>, <em>optional</em>) — | |
| The mask of the visual positions.`,name:"visual_pos_masks"},{anchor:"transformers.CohereCompassTextModel.forward.deepstack_visual_embeds",description:`<strong>deepstack_visual_embeds</strong> (<code>list[torch.Tensor]</code>, <em>optional</em>) — | |
| The deepstack visual embeddings. The shape is (num_layers, visual_seqlen, embed_dim). | |
| The feature is extracted from the different visual encoder layers, and fed to the decoder | |
| hidden states. It’s from the paper DeepStack(<a href="https://arxiv.org/abs/2406.04334" rel="nofollow">https://arxiv.org/abs/2406.04334</a>).`,name:"deepstack_visual_embeds"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast" | |
| >BaseModelOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast" | |
| >BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var qe=e(Y,4);u(qe,{children:(s,i)=>{var o=f();c(s,o)},$$slots:{default:!0}}),g(2),r(E),r(T);var H=e(T,2);a(H,{title:"CohereCompassVisionModel",local:"transformers.CohereCompassVisionModel",headingTag:"h2"});var w=e(H,2),O=t(w);n(O,{name:"class transformers.CohereCompassVisionModel",anchor:"transformers.CohereCompassVisionModel",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L852",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CohereCompassVisionModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVisionModel">CohereCompassVisionModel</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var K=e(O,8),Fe=t(K);n(Fe,{name:"forward",anchor:"transformers.CohereCompassVisionModel.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L899",parameters:[{name:"hidden_states",val:": Tensor"},{name:"grid_thw",val:": Tensor"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassVisionModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(seq_len, hidden_size)</code>) — | |
| The final hidden states of the model.`,name:"hidden_states"},{anchor:"transformers.CohereCompassVisionModel.forward.grid_thw",description:`<strong>grid_thw</strong> (<code>torch.Tensor</code> of shape <code>(num_images_or_videos, 3)</code>) — | |
| The temporal, height and width of feature shape of each image in LLM.`,name:"grid_thw"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>hidden_states.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>torch.Tensor</code></p> | |
| `}),r(K),r(w);var $=e(w,2);a($,{title:"CohereCompassForConditionalGeneration",local:"transformers.CohereCompassForConditionalGeneration",headingTag:"h2"});var M=e($,2),ee=t(M);n(ee,{name:"class transformers.CohereCompassForConditionalGeneration",anchor:"transformers.CohereCompassForConditionalGeneration",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1374",parameters:[{name:"config",val:": CohereCompassConfig"}],parametersDescription:[{anchor:"transformers.CohereCompassForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig">CohereCompassConfig</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var k=e(ee,8),oe=t(k);n(oe,{name:"forward",anchor:"transformers.CohereCompassForConditionalGeneration.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1414",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_values_videos",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"video_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"mm_token_type_ids",val:": typing.Optional[torch.IntTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"mm_encoder_outputs",val:": dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored | |
| (masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) — | |
| The tensors corresponding to the input images. Pixel values can be obtained using | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">CohereCompassImageProcessor</a>. See <a href="/docs/transformers/pr_49429/en/model_doc/molmo2#transformers.Molmo2ImageProcessor.__call__">CohereCompassImageProcessor.<strong>call</strong>()</a> for details (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassProcessor">CohereCompassProcessor</a> uses | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassImageProcessor">CohereCompassImageProcessor</a> for processing images).`,name:"pixel_values"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.pixel_values_videos",description:`<strong>pixel_values_videos</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_frames, num_channels, frame_size, frame_size)</code>, <em>optional</em>) — | |
| The tensors corresponding to the input video. Pixel values for videos can be obtained using | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">CohereCompassVideoProcessor</a>. See <a href="/docs/transformers/pr_49429/en/model_doc/molmo2#transformers.Molmo2VideoProcessor.__call__">CohereCompassVideoProcessor.<strong>call</strong>()</a> for details (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassProcessor">CohereCompassProcessor</a> uses | |
| <a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassVideoProcessor">CohereCompassVideoProcessor</a> for processing videos).`,name:"pixel_values_videos"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.image_grid_thw",description:`<strong>image_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_images, 3)</code>, <em>optional</em>) — | |
| The temporal, height and width of feature shape of each image in LLM.`,name:"image_grid_thw"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.video_grid_thw",description:`<strong>video_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_videos, 3)</code>, <em>optional</em>) — | |
| The temporal, height and width of feature shape of each video in LLM.`,name:"video_grid_thw"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.mm_token_type_ids",description:`<strong>mm_token_type_ids</strong> (<code>torch.IntTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens matching each modality. For example text (0), image (1), video (2). | |
| Multimodal token type ids can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoProcessor">AutoProcessor</a>. See <a href="/docs/transformers/pr_49429/en/main_classes/processors#transformers.ProcessorMixin.__call__">ProcessorMixin.<strong>call</strong>()</a> for details.`,name:"mm_token_type_ids"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>Union[int, torch.Tensor]</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all | |
| <code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that | |
| token can save memory, which becomes pretty significant for long sequences or large vocabulary size. | |
| If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension. | |
| This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"logits_to_keep"},{anchor:"transformers.CohereCompassForConditionalGeneration.forward.mm_encoder_outputs",description:`<strong>mm_encoder_outputs</strong> (<code>dict[str, ~modeling_outputs.BaseModelOutputWithPooling]</code>, <em>optional</em>) — | |
| Dict where keys are supported modalities and values are encoded outputs for that modality. Each encoded output is a tuple | |
| that consists of (<code>pooler_output</code>, <em>optional</em>: <code>last_hidden_states</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>) | |
| <code>pooler_output</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of | |
| multimmodal features of the encoder merged into text embeddings.`,name:"mm_encoder_outputs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var se=e(oe,4);u(se,{children:(s,i)=>{var o=f();c(s,o)},$$slots:{default:!0}});var Ve=e(se,4);p(Ve,{anchor:"transformers.CohereCompassForConditionalGeneration.forward.example",children:(s,i)=>{var o=_(),d=e(m(o),2);l(d,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ29oZXJlQ29tcGFzc0ZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyMENvaGVyZUNvbXBhc3NQcm9jZXNzb3IlMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBDb2hlcmVDb21wYXNzUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFtb2RlbCUyMCUzRCUyMENvaGVyZUNvbXBhc3NGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUwQWltYWdlX3VybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGY2RuLXVwbG9hZHMuaHVnZ2luZ2ZhY2UuY28lMkZwcm9kdWN0aW9uJTJGdXBsb2FkcyUyRjY2ZDczMmVmZmU2Njg0ZmMxNmIxMmMyOCUyRklvXzVPQ21mdHNtSC1uMTU4WnRQcy5wbmclMjIlMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMEFpbnB1dF9sZW5ndGglMjAlM0QlMjBpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQuc2hhcGUlNUItMSU1RCUwQXJlc3BvbnNlJTIwJTNEJTIwcHJvY2Vzc29yLmRlY29kZSglMEFwcmludChyZXNwb25zZSk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CohereCompassForConditionalGeneration, CohereCompassProcessor | |
| <span class="hljs-meta">>>> </span>model_id = <span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span> | |
| <span class="hljs-meta">>>> </span>processor = CohereCompassProcessor.from_pretrained(model_id) | |
| <span class="hljs-meta">>>> </span>model = CohereCompassForConditionalGeneration.from_pretrained( | |
| model_id, | |
| device_map=<span class="hljs-string">"auto"</span>, | |
| ) | |
| <span class="hljs-meta">>>> </span>image_url = <span class="hljs-string">"https://cdn-uploads.huggingface.co/production/uploads/66d732effe6684fc16b12c28/Io_5OCmftsmH-n158ZtPs.png"</span> | |
| <span class="hljs-meta">>>> </span>messages = [ | |
| { | |
| <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, | |
| <span class="hljs-string">"content"</span>: [ | |
| {<span class="hljs-string">"type"</span>: <span class="hljs-string">"image"</span>, <span class="hljs-string">"url"</span>: image_url}, | |
| {<span class="hljs-string">"type"</span>: <span class="hljs-string">"text"</span>, <span class="hljs-string">"text"</span>: <span class="hljs-string">"Describe this image."</span>}, | |
| ], | |
| } | |
| ] | |
| <span class="hljs-meta">>>> </span>inputs = processor.apply_chat_template( | |
| messages, | |
| tokenize=<span class="hljs-literal">True</span>, | |
| add_generation_prompt=<span class="hljs-literal">True</span>, | |
| return_tensors=<span class="hljs-string">"pt"</span>, | |
| return_dict=<span class="hljs-literal">True</span>, | |
| ).to(model.device) | |
| <span class="hljs-meta">>>> </span>outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=<span class="hljs-number">128</span>, | |
| ) | |
| <span class="hljs-meta">>>> </span>input_length = inputs[<span class="hljs-string">"input_ids"</span>].shape[-<span class="hljs-number">1</span>] | |
| <span class="hljs-meta">>>> </span>response = processor.decode( | |
| outputs[<span class="hljs-number">0</span>][input_length:], | |
| skip_special_tokens=<span class="hljs-literal">True</span>, | |
| ) | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(response)`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}}),r(k);var ne=e(k,2),te=t(ne);n(te,{name:"get_image_features",anchor:"transformers.CohereCompassForConditionalGeneration.get_image_features",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1401",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"image_grid_thw",val:": typing.Optional[torch.LongTensor] = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassForConditionalGeneration.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>) — | |
| The tensors corresponding to the input images.`,name:"pixel_values"},{anchor:"transformers.CohereCompassForConditionalGeneration.get_image_features.image_grid_thw",description:`<strong>image_grid_thw</strong> (<code>torch.LongTensor</code> of shape <code>(num_images, 3)</code>, <em>optional</em>) — | |
| The temporal, height and width of feature shape of each image in LLM.`,name:"image_grid_thw"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>BaseModelOutputWithDeepstackFeatures</code> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>BaseModelOutputWithDeepstackFeatures</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var We=e(te,4);p(We,{anchor:"transformers.CohereCompassForConditionalGeneration.get_image_features.example",children:(s,i)=>{var o=_(),d=e(m(o),2);l(d,{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBDb2hlcmVDb21wYXNzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBDb2hlcmVDb21wYXNzRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJDb2hlcmVMYWJzJTJGTm9ydGgtTWljcm8tVmlzaW9uLUluc3RydWN0JTIyKSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIpJTBBJTBBbWVzc2FnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyb2xlJTIyJTNBJTIwJTIydXNlciUyMiUyQyUyMCUyMmNvbnRlbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJ0eXBlJTIyJTNBJTIwJTIyaW1hZ2UlMjIlMkMlMjAlMjJ1cmwlMjIlM0ElMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZwaXBlbGluZS1jYXQtY2hvbmsuanBlZyUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QiUyMnR5cGUlMjIlM0ElMjAlMjJ0ZXh0JTIyJTJDJTIwJTIydGV4dCUyMiUzQSUyMCUyMldoZXJlJTIwaXMlMjB0aGUlMjBjYXQlMjBzdGFuZGluZyUzRiUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSU1RCUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvci5hcHBseV9jaGF0X3RlbXBsYXRlKCUwQSUyMCUyMCUyMCUyMG1lc3NhZ2VzJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2RpY3QlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMEEpJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyklMEFwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, CohereCompassForConditionalGeneration | |
| <span class="hljs-meta">>>> </span>model = CohereCompassForConditionalGeneration.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>) | |
| <span class="hljs-meta">>>> </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>) | |
| <span class="hljs-meta">>>> </span>messages = [ | |
| <span class="hljs-meta">... </span> { | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"role"</span>: <span class="hljs-string">"user"</span>, <span class="hljs-string">"content"</span>: [ | |
| <span class="hljs-meta">... </span> {<span class="hljs-string">"type"</span>: <span class="hljs-string">"image"</span>, <span class="hljs-string">"url"</span>: <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"</span>}, | |
| <span class="hljs-meta">... </span> {<span class="hljs-string">"type"</span>: <span class="hljs-string">"text"</span>, <span class="hljs-string">"text"</span>: <span class="hljs-string">"Where is the cat standing?"</span>}, | |
| <span class="hljs-meta">... </span> ] | |
| <span class="hljs-meta">... </span> }, | |
| <span class="hljs-meta">... </span>] | |
| <span class="hljs-meta">>>> </span>inputs = processor.apply_chat_template( | |
| <span class="hljs-meta">... </span> messages, | |
| <span class="hljs-meta">... </span> tokenize=<span class="hljs-literal">True</span>, | |
| <span class="hljs-meta">... </span> return_dict=<span class="hljs-literal">True</span>, | |
| <span class="hljs-meta">... </span> return_tensors=<span class="hljs-string">"pt"</span>, | |
| <span class="hljs-meta">... </span> add_generation_prompt=<span class="hljs-literal">True</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Generate</span> | |
| <span class="hljs-meta">>>> </span>generate_ids = model.generate(**inputs) | |
| <span class="hljs-meta">>>> </span>processor.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}}),r(ne),r(M);var re=e(M,2);a(re,{title:"CohereCompassForCausalLM",local:"transformers.CohereCompassForCausalLM",headingTag:"h2"});var x=e(re,2),ae=t(x);n(ae,{name:"class transformers.CohereCompassForCausalLM",anchor:"transformers.CohereCompassForCausalLM",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L526",parameters:[{name:"config",val:": CohereCompassTextConfig"}],parametersDescription:[{anchor:"transformers.CohereCompassForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassTextConfig">CohereCompassTextConfig</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var ie=e(ae,8),ce=t(ie);n(ce,{name:"forward",anchor:"transformers.CohereCompassForCausalLM.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L544",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CohereCompassForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CohereCompassForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CohereCompassForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CohereCompassForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CohereCompassForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored | |
| (masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.CohereCompassForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.CohereCompassForCausalLM.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>Union[int, torch.Tensor]</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all | |
| <code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that | |
| token can save memory, which becomes pretty significant for long sequences or large vocabulary size. | |
| If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension. | |
| This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"logits_to_keep"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_49429/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast" | |
| >CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var de=e(ce,4);u(de,{children:(s,i)=>{var o=f();c(s,o)},$$slots:{default:!0}});var Re=e(de,4);p(Re,{anchor:"transformers.CohereCompassForCausalLM.forward.example",children:(s,i)=>{var o=_(),d=e(m(o),2);l(d,{code:"JTNFJTNFJTIwZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDb2hlcmVDb21wYXNzRm9yQ2F1c2FsTE0lMEElMEElM0UlM0UlMjBtb2RlbCUyMCUzRCUyMENvaGVyZUNvbXBhc3NGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyQ29oZXJlQ29tcGFzc0ZvckFJJTJGYzRhaS1jb21tYW5kLXItdjAxJTIyKSUwQSUzRSUzRSUyMHRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUNvbXBhc3NGb3JBSSUyRmM0YWktY29tbWFuZC1yLXYwMSUyMiklMEElMEElM0UlM0UlMjBwcm9tcHQlMjAlM0QlMjAlMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiUyMiUwQSUzRSUzRSUyMGlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUzRSUzRSUyMCUyMyUyMEdlbmVyYXRlJTBBJTNFJTNFJTIwZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9sZW5ndGglM0QzMCklMEElM0UlM0UlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQlMEElMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiU1Q25JJ20lMjBub3QlMjBjb25zY2lvdXMlMkMlMjBidXQlMjBJJTIwY2FuJTIwdGFsayUyMHRvJTIweW91LiUyMg==",highlighted:`>> <span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CohereCompassForCausalLM | |
| >> model = CohereCompassForCausalLM.from_pretrained(<span class="hljs-string">"CohereCompassForAI/c4ai-command-r-v01"</span>) | |
| >> tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"CohereCompassForAI/c4ai-command-r-v01"</span>) | |
| >> prompt = <span class="hljs-string">"Hey, are you conscious? Can you talk to me?"</span> | |
| >> inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">"pt"</span>) | |
| >> <span class="hljs-comment"># Generate</span> | |
| >> generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>) | |
| >> tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>] | |
| <span class="hljs-string">"Hey, are you conscious? Can you talk to me?\\nI'm not conscious, but I can talk to you."</span>`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}}),r(ie),r(x);var le=e(x,2);a(le,{title:"CohereCompassTextForSequenceClassification",local:"transformers.CohereCompassTextForSequenceClassification",headingTag:"h2"});var z=e(le,2),me=t(z);n(me,{name:"class transformers.CohereCompassTextForSequenceClassification",anchor:"transformers.CohereCompassTextForSequenceClassification",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1560",parameters:[{name:"config",val:": CohereCompassTextConfig"}],parametersDescription:[{anchor:"transformers.CohereCompassTextForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassTextConfig">CohereCompassTextConfig</a>) — | |
| 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_49429/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]});var pe=e(me,8),he=t(pe);n(he,{name:"forward",anchor:"transformers.CohereCompassTextForSequenceClassification.forward",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/modeling_cohere_compass.py#L1587",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": transformers.cache_utils.Cache | None = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": bool | None = None"},{name:"**kwargs",val:": *<class 'transformers.utils.generic.TransformersKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_49429/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_49429/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p> | |
| <p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~cache_utils.Cache</code>, <em>optional</em>) — | |
| Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention | |
| blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code> | |
| returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p> | |
| <p>Only <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.Cache">Cache</a> instance is allowed as input, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>. | |
| If no <code>past_key_values</code> are passed, <a href="/docs/transformers/pr_49429/en/internal/generation_utils#transformers.DynamicCache">DynamicCache</a> will be initialized by default.</p> | |
| <p>The model will output the same cache format that is fed as input.</p> | |
| <p>If <code>past_key_values</code> are used, the user is expected to input only unprocessed <code>input_ids</code> (those that don’t | |
| have their past key value states given to this model) of shape <code>(batch_size, unprocessed_length)</code> instead of all <code>input_ids</code> | |
| of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If | |
| <code>config.num_labels > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"},{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) — | |
| If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see | |
| <code>past_key_values</code>).`,name:"use_cache"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>SequenceClassifierOutputWithPast</code> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_49429/en/model_doc/cohere_compass#transformers.CohereCompassConfig" | |
| >CohereCompassConfig</a>) and inputs.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `});var ge=e(he,4);u(ge,{children:(s,i)=>{var o=f();c(s,o)},$$slots:{default:!0}});var ue=e(ge,4);p(ue,{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.example",children:(s,i)=>{var o=oo(),d=e(m(o),2);l(d,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENvaGVyZUNvbXBhc3NUZXh0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIpJTBBbW9kZWwlMjAlM0QlMjBDb2hlcmVDb21wYXNzVGV4dEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMENvaGVyZUNvbXBhc3NUZXh0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyQ29oZXJlTGFicyUyRk5vcnRoLU1pY3JvLVZpc2lvbi1JbnN0cnVjdCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CohereCompassTextForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>) | |
| <span class="hljs-meta">>>> </span>model = CohereCompassTextForSequenceClassification.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = logits.argmax().item() | |
| <span class="hljs-meta">>>> </span>model.config.id2label[predicted_class_id] | |
| ... | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span> | |
| <span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = CohereCompassTextForSequenceClassification.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>, num_labels=num_labels) | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor([<span class="hljs-number">1</span>]) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>) | |
| ...`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}});var Ze=e(ue,2);p(Ze,{anchor:"transformers.CohereCompassTextForSequenceClassification.forward.example-2",children:(s,i)=>{var o=so(),d=e(m(o),2);l(d,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENvaGVyZUNvbXBhc3NUZXh0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIpJTBBbW9kZWwlMjAlM0QlMjBDb2hlcmVDb21wYXNzVGV4dEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMkNvaGVyZUxhYnMlMkZOb3J0aC1NaWNyby1WaXNpb24tSW5zdHJ1Y3QlMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMENvaGVyZUNvbXBhc3NUZXh0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyQ29oZXJlTGFicyUyRk5vcnRoLU1pY3JvLVZpc2lvbi1JbnN0cnVjdCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CohereCompassTextForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>) | |
| <span class="hljs-meta">>>> </span>model = CohereCompassTextForSequenceClassification.from_pretrained(<span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>, problem_type=<span class="hljs-string">"multi_label_classification"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) > <span class="hljs-number">0.5</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span> | |
| <span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = CohereCompassTextForSequenceClassification.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"CohereLabs/North-Micro-Vision-Instruct"</span>, num_labels=num_labels, problem_type=<span class="hljs-string">"multi_label_classification"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>labels = torch.<span class="hljs-built_in">sum</span>( | |
| <span class="hljs-meta">... </span> torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span> | |
| <span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,lang:"python",wrap:!1}),c(s,o)},$$slots:{default:!0}}),r(pe),r(z);var fe=e(z,2);a(fe,{title:"CohereCompassImageProcessor",local:"transformers.CohereCompassImageProcessor",headingTag:"h2"});var U=e(fe,2),_e=t(U);n(_e,{name:"class transformers.CohereCompassImageProcessor",anchor:"transformers.CohereCompassImageProcessor",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/image_processing_cohere_compass.py#L87",parameters:[{name:"**kwargs",val:": *<class 'transformers.models.cohere_compass.image_processing_cohere_compass.CohereCompassImageProcessorKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassImageProcessor.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.CohereCompassImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.CohereCompassImageProcessor.size",description:`<strong>size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>, defaults to <code>{'shortest_edge' -- 3136, 'longest_edge': 1003520}</code>): | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.CohereCompassImageProcessor.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.CohereCompassImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.CohereCompassImageProcessor.resample",description:`<strong>resample</strong> (<code>Annotated[Union[int, PILImageResampling, NoneType], None]</code>, <em>kwargs</em>, defaults to <code>3</code>) — | |
| 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.CohereCompassImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.CohereCompassImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>0.00392156862745098</code>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.CohereCompassImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.CohereCompassImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) — | |
| 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.CohereCompassImageProcessor.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) — | |
| 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.CohereCompassImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to pad the image. Padding is done either to the largest size in the batch | |
| or to a fixed square size per image. The exact padding strategy depends on the model.`,name:"do_pad"},{anchor:"transformers.CohereCompassImageProcessor.pad_size",description:`<strong>pad_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| The size in <code>{"height": int, "width" int}</code> to pad the images to. Must be larger than any image size | |
| provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest | |
| height and width in the batch. Applied only when <code>do_pad=True.</code>`,name:"pad_size"},{anchor:"transformers.CohereCompassImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.CohereCompassImageProcessor.data_format",description:`<strong>data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.CohereCompassImageProcessor.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.CohereCompassImageProcessor.device",description:`<strong>device</strong> (<code>Annotated[Union[str, torch.device, NoneType], None]</code>, <em>kwargs</em>) — | |
| The device to process the videos on. If unset, the device is inferred from the input videos.`,name:"device"},{anchor:"transformers.CohereCompassImageProcessor.return_tensors",description:`<strong>return_tensors</strong> (<code>Annotated[str | ~utils.generic.TensorType | None, None]</code>, <em>kwargs</em>) — | |
| Returns stacked tensors if set to <code>'pt'</code>, otherwise returns a list of tensors.`,name:"return_tensors"},{anchor:"transformers.CohereCompassImageProcessor.disable_grouping",description:`<strong>disable_grouping</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to disable grouping of images by size to process them individually and not in batches. | |
| If None, will be set to True if the images are on CPU, and False otherwise. This choice is based on | |
| empirical observations, as detailed here: <a href="https://github.com/huggingface/transformers/pull/38157" rel="nofollow">https://github.com/huggingface/transformers/pull/38157</a>`,name:"disable_grouping"},{anchor:"transformers.CohereCompassImageProcessor.image_seq_length",description:`<strong>image_seq_length</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>) — | |
| The number of image tokens to be used for each image in the input. | |
| Added for backward compatibility but this should be set as a processor attribute in future models.`,name:"image_seq_length"},{anchor:"transformers.CohereCompassImageProcessor.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>56 * 56</code>) — | |
| The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.CohereCompassImageProcessor.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) — | |
| The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.CohereCompassImageProcessor.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 14) — | |
| The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.CohereCompassImageProcessor.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.CohereCompassImageProcessor.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The merge size of the vision encoder to llm encoder.`,name:"merge_size"}]});var Ce=e(_e,4),Ge=t(Ce);n(Ge,{name:"preprocess",anchor:"transformers.CohereCompassImageProcessor.preprocess",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/image_processing_cohere_compass.py#L137",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:": *<class 'transformers.models.cohere_compass.image_processing_cohere_compass.CohereCompassImageProcessorKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]</code>) — | |
| 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.CohereCompassImageProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>Annotated[Union[int, PILImageResampling, NoneType], None]</code>, <em>kwargs</em>) — | |
| 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.CohereCompassImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to pad the image. Padding is done either to the largest size in the batch | |
| or to a fixed square size per image. The exact padding strategy depends on the model.`,name:"do_pad"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.pad_size",description:`<strong>pad_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| The size in <code>{"height": int, "width" int}</code> to pad the images to. Must be larger than any image size | |
| provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest | |
| height and width in the batch. Applied only when <code>do_pad=True.</code>`,name:"pad_size"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.device",description:`<strong>device</strong> (<code>Annotated[Union[str, torch.device, NoneType], None]</code>, <em>kwargs</em>) — | |
| The device to process the videos on. If unset, the device is inferred from the input videos.`,name:"device"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>Annotated[str | ~utils.generic.TensorType | None, None]</code>, <em>kwargs</em>) — | |
| Returns stacked tensors if set to <code>'pt'</code>, otherwise returns a list of tensors.`,name:"return_tensors"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.disable_grouping",description:`<strong>disable_grouping</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to disable grouping of images by size to process them individually and not in batches. | |
| If None, will be set to True if the images are on CPU, and False otherwise. This choice is based on | |
| empirical observations, as detailed here: <a href="https://github.com/huggingface/transformers/pull/38157" rel="nofollow">https://github.com/huggingface/transformers/pull/38157</a>`,name:"disable_grouping"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.image_seq_length",description:`<strong>image_seq_length</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>) — | |
| The number of image tokens to be used for each image in the input. | |
| Added for backward compatibility but this should be set as a processor attribute in future models.`,name:"image_seq_length"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>56 * 56</code>) — | |
| The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) — | |
| The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 14) — | |
| The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.CohereCompassImageProcessor.preprocess.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The merge size of the vision encoder to llm encoder.`,name:"merge_size"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li><strong>data</strong> (<code>dict</code>) — Dictionary of lists/arrays/tensors returned by the <strong>call</strong> method (‘pixel_values’, etc.).</li> | |
| <li><strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) — You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at | |
| initialization.</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~image_processing_base.BatchFeature</code></p> | |
| `}),r(Ce),r(U);var be=e(U,2);a(be,{title:"CohereCompassImageProcessorPil",local:"transformers.CohereCompassImageProcessorPil",headingTag:"h2"});var I=e(be,2),ye=t(I);n(ye,{name:"class transformers.CohereCompassImageProcessorPil",anchor:"transformers.CohereCompassImageProcessorPil",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/image_processing_pil_cohere_compass.py#L84",parameters:[{name:"**kwargs",val:": *<class 'transformers.models.cohere_compass.image_processing_pil_cohere_compass.CohereCompassImageProcessorKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassImageProcessorPil.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.CohereCompassImageProcessorPil.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.CohereCompassImageProcessorPil.size",description:`<strong>size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>, defaults to <code>{'shortest_edge' -- 3136, 'longest_edge': 1003520}</code>): | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.CohereCompassImageProcessorPil.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.CohereCompassImageProcessorPil.crop_size",description:`<strong>crop_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.CohereCompassImageProcessorPil.resample",description:`<strong>resample</strong> (<code>Annotated[Union[int, PILImageResampling, NoneType], None]</code>, <em>kwargs</em>, defaults to <code>3</code>) — | |
| 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.CohereCompassImageProcessorPil.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.CohereCompassImageProcessorPil.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>0.00392156862745098</code>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.CohereCompassImageProcessorPil.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.CohereCompassImageProcessorPil.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) — | |
| 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.CohereCompassImageProcessorPil.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) — | |
| 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.CohereCompassImageProcessorPil.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to pad the image. Padding is done either to the largest size in the batch | |
| or to a fixed square size per image. The exact padding strategy depends on the model.`,name:"do_pad"},{anchor:"transformers.CohereCompassImageProcessorPil.pad_size",description:`<strong>pad_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| The size in <code>{"height": int, "width" int}</code> to pad the images to. Must be larger than any image size | |
| provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest | |
| height and width in the batch. Applied only when <code>do_pad=True.</code>`,name:"pad_size"},{anchor:"transformers.CohereCompassImageProcessorPil.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.CohereCompassImageProcessorPil.data_format",description:`<strong>data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.CohereCompassImageProcessorPil.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.CohereCompassImageProcessorPil.device",description:`<strong>device</strong> (<code>Annotated[Union[str, torch.device, NoneType], None]</code>, <em>kwargs</em>) — | |
| The device to process the videos on. If unset, the device is inferred from the input videos.`,name:"device"},{anchor:"transformers.CohereCompassImageProcessorPil.return_tensors",description:`<strong>return_tensors</strong> (<code>Annotated[str | ~utils.generic.TensorType | None, None]</code>, <em>kwargs</em>) — | |
| Returns stacked tensors if set to <code>'pt'</code>, otherwise returns a list of tensors.`,name:"return_tensors"},{anchor:"transformers.CohereCompassImageProcessorPil.disable_grouping",description:`<strong>disable_grouping</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to disable grouping of images by size to process them individually and not in batches. | |
| If None, will be set to True if the images are on CPU, and False otherwise. This choice is based on | |
| empirical observations, as detailed here: <a href="https://github.com/huggingface/transformers/pull/38157" rel="nofollow">https://github.com/huggingface/transformers/pull/38157</a>`,name:"disable_grouping"},{anchor:"transformers.CohereCompassImageProcessorPil.image_seq_length",description:`<strong>image_seq_length</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>) — | |
| The number of image tokens to be used for each image in the input. | |
| Added for backward compatibility but this should be set as a processor attribute in future models.`,name:"image_seq_length"},{anchor:"transformers.CohereCompassImageProcessorPil.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>56 * 56</code>) — | |
| The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.CohereCompassImageProcessorPil.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) — | |
| The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.CohereCompassImageProcessorPil.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 14) — | |
| The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.CohereCompassImageProcessorPil.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.CohereCompassImageProcessorPil.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The merge size of the vision encoder to llm encoder.`,name:"merge_size"}]});var ve=e(ye,4),Be=t(ve);n(Be,{name:"preprocess",anchor:"transformers.CohereCompassImageProcessorPil.preprocess",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/image_processing_pil_cohere_compass.py#L197",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:": *<class 'transformers.models.cohere_compass.image_processing_pil_cohere_compass.CohereCompassImageProcessorKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.images",description:`<strong>images</strong> (<code>Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]</code>) — | |
| 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.CohereCompassImageProcessorPil.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.size",description:`<strong>size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.resample",description:`<strong>resample</strong> (<code>Annotated[Union[int, PILImageResampling, NoneType], None]</code>, <em>kwargs</em>) — | |
| 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.CohereCompassImageProcessorPil.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassImageProcessorPil.preprocess.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassImageProcessorPil.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to pad the image. Padding is done either to the largest size in the batch | |
| or to a fixed square size per image. The exact padding strategy depends on the model.`,name:"do_pad"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.pad_size",description:`<strong>pad_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| The size in <code>{"height": int, "width" int}</code> to pad the images to. Must be larger than any image size | |
| provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest | |
| height and width in the batch. Applied only when <code>do_pad=True.</code>`,name:"pad_size"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.data_format",description:`<strong>data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.device",description:`<strong>device</strong> (<code>Annotated[Union[str, torch.device, NoneType], None]</code>, <em>kwargs</em>) — | |
| The device to process the videos on. If unset, the device is inferred from the input videos.`,name:"device"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>Annotated[str | ~utils.generic.TensorType | None, None]</code>, <em>kwargs</em>) — | |
| Returns stacked tensors if set to <code>'pt'</code>, otherwise returns a list of tensors.`,name:"return_tensors"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.disable_grouping",description:`<strong>disable_grouping</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to disable grouping of images by size to process them individually and not in batches. | |
| If None, will be set to True if the images are on CPU, and False otherwise. This choice is based on | |
| empirical observations, as detailed here: <a href="https://github.com/huggingface/transformers/pull/38157" rel="nofollow">https://github.com/huggingface/transformers/pull/38157</a>`,name:"disable_grouping"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.image_seq_length",description:`<strong>image_seq_length</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>) — | |
| The number of image tokens to be used for each image in the input. | |
| Added for backward compatibility but this should be set as a processor attribute in future models.`,name:"image_seq_length"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.min_pixels",description:`<strong>min_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>56 * 56</code>) — | |
| The min pixels of the image to resize the image.`,name:"min_pixels"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.max_pixels",description:`<strong>max_pixels</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to <code>28 * 28 * 1280</code>) — | |
| The max pixels of the image to resize the image.`,name:"max_pixels"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 14) — | |
| The spatial patch size of the vision encoder.`,name:"patch_size"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.temporal_patch_size",description:`<strong>temporal_patch_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The temporal patch size of the vision encoder.`,name:"temporal_patch_size"},{anchor:"transformers.CohereCompassImageProcessorPil.preprocess.merge_size",description:`<strong>merge_size</strong> (<code>int</code>, <em>kwargs</em>, <em>optional</em>, defaults to 2) — | |
| The merge size of the vision encoder to llm encoder.`,name:"merge_size"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li><strong>data</strong> (<code>dict</code>) — Dictionary of lists/arrays/tensors returned by the <strong>call</strong> method (‘pixel_values’, etc.).</li> | |
| <li><strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) — You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at | |
| initialization.</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~image_processing_base.BatchFeature</code></p> | |
| `}),r(ve),r(I);var Te=e(I,2);a(Te,{title:"CohereCompassVideoProcessor",local:"transformers.CohereCompassVideoProcessor",headingTag:"h2"});var P=e(Te,2),we=t(P);n(we,{name:"class transformers.CohereCompassVideoProcessor",anchor:"transformers.CohereCompassVideoProcessor",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/video_processing_cohere_compass.py#L109",parameters:[{name:"**kwargs",val:": *<class 'transformers.models.cohere_compass.video_processing_cohere_compass.CohereCompassVideoProcessorInitKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassVideoProcessor.*kwargs",description:`*<strong>*kwargs</strong> (<code>CohereCompassVideoProcessorInitKwargs</code>, <em>optional</em>) — | |
| Additional processing options for each modality (text, images, videos, audio). Model-specific parameters | |
| are listed above; see the TypedDict class for the complete list of supported arguments.`,name:"*kwargs"}]});var Me=e(we,4),Le=t(Me);n(Le,{name:"preprocess",anchor:"transformers.CohereCompassVideoProcessor.preprocess",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/video_processing_utils.py#L98",parameters:[{name:"videos",val:": typing.Union[list['PIL.Image.Image'], numpy.ndarray, ForwardRef('torch.Tensor'), list[numpy.ndarray], list['torch.Tensor'], list[list['PIL.Image.Image']], list[list[numpy.ndarray]], list[list['torch.Tensor']], transformers.video_utils.URL, list[transformers.video_utils.URL], list[list[transformers.video_utils.URL]], transformers.video_utils.Path, list[transformers.video_utils.Path], list[list[transformers.video_utils.Path]]]"},{name:"**kwargs",val:": *<class 'transformers.processing_utils.VideosKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassVideoProcessor.preprocess.videos",description:`<strong>videos</strong> (<code>Union[list[PIL.Image.Image], numpy.ndarray, torch.Tensor, list[numpy.ndarray], list[torch.Tensor], list[list[PIL.Image.Image]], list[list[numpy.ndarray]], list[list[torch.Tensor]], ~video_utils.URL, list[~video_utils.URL], list[list[~video_utils.URL]], ~video_utils.Path, list[~video_utils.Path], list[list[~video_utils.Path]]]</code>) — | |
| Video to preprocess. Expects a single or batch of videos with pixel values ranging from 0 to 255. If | |
| passing in videos with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"videos"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.size",description:`<strong>size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>Annotated[Union[int, PILImageResampling, NoneType], None]</code>, <em>kwargs</em>) — | |
| 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.CohereCompassVideoProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassVideoProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], tuple[float, ...]]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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.CohereCompassVideoProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to pad the image. Padding is done either to the largest size in the batch | |
| or to a fixed square size per image. The exact padding strategy depends on the model.`,name:"do_pad"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]</code>, <em>kwargs</em>) — | |
| Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[str, ~image_utils.ChannelDimension]</code>, <em>kwargs</em>, <em>optional</em>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li> | |
| <li><code>"none"</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li> | |
| </ul>`,name:"input_data_format"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.device",description:`<strong>device</strong> (<code>Annotated[Union[str, torch.device, NoneType], None]</code>, <em>kwargs</em>) — | |
| The device to process the videos on. If unset, the device is inferred from the input videos.`,name:"device"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.do_sample_frames",description:`<strong>do_sample_frames</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to sample frames from the video before processing or to process the whole video.`,name:"do_sample_frames"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.video_metadata",description:`<strong>video_metadata</strong> (<code>Annotated[~video_utils.VideoMetadata | dict | list[dict | ~video_utils.VideoMetadata] | list[list[dict | ~video_utils.VideoMetadata]] | None, None]</code>, <em>kwargs</em>) — | |
| Metadata of the video containing information about total duration, fps and total number of frames. It will be | |
| used to sample frames from video or compute timestamps. Don’t pass any metadata unless you are trying to decode | |
| the video manually before processing`,name:"video_metadata"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.fps",description:`<strong>fps</strong> (<code>Annotated[int | float | None, None]</code>, <em>kwargs</em>) — | |
| Target frames to sample per second when <code>do_sample_frames=True</code>.`,name:"fps"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.num_frames",description:`<strong>num_frames</strong> (<code>Annotated[int | None, None]</code>, <em>kwargs</em>) — | |
| Maximum number of frames to sample when <code>do_sample_frames=True</code>.`,name:"num_frames"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.return_metadata",description:`<strong>return_metadata</strong> (<code>bool</code>, <em>kwargs</em>, <em>optional</em>) — | |
| Whether to return video metadata or not. Video metadats is an object containing info about video duration, fps, | |
| decoding backend, etc.`,name:"return_metadata"},{anchor:"transformers.CohereCompassVideoProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>Annotated[str | ~utils.generic.TensorType | None, None]</code>, <em>kwargs</em>) — | |
| Returns stacked tensors if set to <code>'pt'</code>, otherwise returns a list of tensors.`,name:"return_tensors"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li><strong>data</strong> (<code>dict</code>) — Dictionary of lists/arrays/tensors returned by the <strong>call</strong> method (‘pixel_values’, etc.).</li> | |
| <li><strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) — You can give a tensor_type here to convert the lists of integers in PyTorch/Numpy Tensors at | |
| initialization.</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~image_processing_base.BatchFeature</code></p> | |
| `}),r(Me),r(P);var ke=e(P,2);a(ke,{title:"CohereCompassProcessor",local:"transformers.CohereCompassProcessor",headingTag:"h2"});var N=e(ke,2),xe=t(N);n(xe,{name:"class transformers.CohereCompassProcessor",anchor:"transformers.CohereCompassProcessor",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/models/cohere_compass/processing_cohere_compass.py#L41",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"video_processor",val:" = None"},{name:"chat_template",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CohereCompassProcessor.image_processor",description:`<strong>image_processor</strong> (<code>CohereCompassImageProcessor</code>) — | |
| The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.CohereCompassProcessor.tokenizer",description:`<strong>tokenizer</strong> (<code>tokenizer_class</code>) — | |
| The tokenizer is a required input.`,name:"tokenizer"},{anchor:"transformers.CohereCompassProcessor.video_processor",description:`<strong>video_processor</strong> (<code>CohereCompassVideoProcessor</code>) — | |
| The video processor is a required input.`,name:"video_processor"},{anchor:"transformers.CohereCompassProcessor.chat_template",description:`<strong>chat_template</strong> (<code>str</code>) — | |
| A Jinja template to convert lists of messages in a chat into a tokenizable string.`,name:"chat_template"}]});var ze=e(xe,6),Se=t(ze);n(Se,{name:"__call__",anchor:"transformers.CohereCompassProcessor.__call__",source:"https://github.com/huggingface/transformers/blob/vr_49429/src/transformers/processing_utils.py#L652",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'], NoneType] = None"},{name:"text",val:": str | list[str] | list[list[str]] | None = None"},{name:"videos",val:": typing.Union[list['PIL.Image.Image'], numpy.ndarray, ForwardRef('torch.Tensor'), list[numpy.ndarray], list['torch.Tensor'], list[list['PIL.Image.Image']], list[list[numpy.ndarray]], list[list['torch.Tensor']], transformers.video_utils.URL, list[transformers.video_utils.URL], list[list[transformers.video_utils.URL]], transformers.video_utils.Path, list[transformers.video_utils.Path], list[list[transformers.video_utils.Path]], NoneType] = None"},{name:"audio",val:": typing.Union[numpy.ndarray, ForwardRef('torch.Tensor'), collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence['torch.Tensor'], NoneType] = None"},{name:"**kwargs",val:": *<class 'transformers.processing_utils.ProcessingKwargs'>"}],parametersDescription:[{anchor:"transformers.CohereCompassProcessor.__call__.images",description:`<strong>images</strong> (<code>Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]</code>, <em>optional</em>) — | |
| 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.CohereCompassProcessor.__call__.text",description:`<strong>text</strong> (<code>Union[str, list[str], list[list[str]]]</code>, <em>optional</em>) — | |
| The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings | |
| (pretokenized string). If you pass a pretokenized input, set <code>is_split_into_words=True</code> to avoid ambiguity with batched inputs.`,name:"text"},{anchor:"transformers.CohereCompassProcessor.__call__.videos",description:`<strong>videos</strong> (<code>Union[list[PIL.Image.Image], numpy.ndarray, torch.Tensor, list[numpy.ndarray], list[torch.Tensor], list[list[PIL.Image.Image]], list[list[numpy.ndarray]], list[list[torch.Tensor]], ~video_utils.URL, list[~video_utils.URL], list[list[~video_utils.URL]], ~video_utils.Path, list[~video_utils.Path], list[list[~video_utils.Path]]]</code>, <em>optional</em>) — | |
| Video to preprocess. Expects a single or batch of videos with pixel values ranging from 0 to 255. If | |
| passing in videos with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"videos"},{anchor:"transformers.CohereCompassProcessor.__call__.audio",description:`<strong>audio</strong> (<code>Union[numpy.ndarray, torch.Tensor, collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence[torch.Tensor]]</code>, <em>optional</em>) — | |
| The audio or batch of audios to be prepared. Each audio can be a NumPy array or PyTorch tensor. | |
| In case of a NumPy array/PyTorch tensor, each audio should be of shape (C, T), where C is a number of channels, | |
| and T is the sample length of the audio.`,name:"audio"},{anchor:"transformers.CohereCompassProcessor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_49429/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) — | |
| If set, will return tensors of a particular framework. Acceptable values are:</p> | |
| <ul> | |
| <li><code>'pt'</code>: Return PyTorch <code>torch.Tensor</code> objects.</li> | |
| <li><code>'np'</code>: Return NumPy <code>np.ndarray</code> objects.</li> | |
| </ul>`,name:"return_tensors"},{anchor:"transformers.CohereCompassProcessor.__call__.*kwargs",description:`*<strong>*kwargs</strong> (<a href="/docs/transformers/pr_49429/en/main_classes/processors#transformers.ProcessingKwargs">ProcessingKwargs</a>, <em>optional</em>) — | |
| Additional processing options for each modality (text, images, videos, audio). Model-specific parameters | |
| are listed above; see the TypedDict class for the complete list of supported arguments.`,name:"*kwargs"}]}),r(ze),r(N);var Xe=e(N,2);Ee(Xe,{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/cohere_compass.md"}),g(2),c(Ue,j),Ke()}export{lo as component}; | |
Xet Storage Details
- Size:
- 180 kB
- Xet hash:
- 23d11b936d751af8c537883c6b02a9ce70a8548d6fbddfb54fd6a1ad1662e069
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.