Transformers documentation
Dots 3 Note Preview
This model was contributed to Hugging Face Transformers on 2026-11-12.
Dots 3 Note Preview
Dots 3 Note Preview is a mixture-of-experts causal language model with native text, image, video, and audio inputs. It uses a shared vision encoder for images and videos and a Whisper-style audio encoder. Both encoders project their outputs into the language model’s hidden space before autoregressive text generation.
BF16 and FP8 inference are supported.
The checkpoint needs a standard
processor_config.jsonwith Qwen image/video components and Dots preprocessing settings. Saved configs use the native Transformers schema; older serving frameworks may need a compatibility adapter.
Usage
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "dots-studio/dots3-note-prev"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(model_id, device_map="auto")
conversation = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png"},
{"type": "text", "text": "Describe this image."},
],
}
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device, dtype=model.dtype)
output_ids = model.generate(**inputs, max_new_tokens=128)
print(processor.batch_decode(output_ids, skip_special_tokens=True)[0])Use the same processing and generation calls with any of these user messages:
# Text
conversation = [{"role": "user", "content": [{"type": "text", "text": "Briefly introduce yourself."}]}]
# Audio: replace the path with a local recording.
conversation = [{"role": "user", "content": [
{"type": "audio", "path": "speech.wav"},
{"type": "text", "text": "Transcribe this recording."},
]}]
# Video frames. Pass audio separately to include the soundtrack.
conversation = [{"role": "user", "content": [
{"type": "video", "path": "concert.mp4"},
{"type": "text", "text": "Describe what you see."},
]}]Dots3NoteModel combines the text, vision and audio encoders. Dots3NoteForConditionalGeneration adds the
language-model head and generation interface. Dots3NoteForCausalLM is the text-only variant.
Dots3NoteConfig
class transformers.Dots3NoteConfig
< source >( transformers_version: str | None = Nonearchitectures: list[str] | None = Noneoutput_hidden_states: bool | None = Falsereturn_dict: bool | None = Truedtype: str | torch.dtype | None = Nonechunk_size_feed_forward: int = 0is_encoder_decoder: bool = Falseid2label: dict[int, str] | dict[str, str] | None = Nonelabel2id: dict[str, int] | dict[str, str] | None = Noneproblem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = Nonetext_config: dict | transformers.models.dots3_note.configuration_dots3_note.Dots3NoteTextConfig | None = Nonevision_config: dict | transformers.models.dots3_note.configuration_dots3_note.Dots3NoteVisionConfig | None = Noneaudio_config: dict | transformers.models.dots3_note.configuration_dots3_note.Dots3NoteAudioConfig | None = Noneimage_token_id: int = 151660video_token_id: int = 151680audio_token_id: int = 151720tie_word_embeddings: bool = False )
Parameters
- text_config (
Union[dict, ~models.dots3_note.configuration_dots3_note.Dots3NoteTextConfig], optional) — The config object or dictionary of the text backbone. - vision_config (
Union[dict, ~models.dots3_note.configuration_dots3_note.Dots3NoteVisionConfig], optional) — The config object or dictionary of the vision backbone. - audio_config (
Union[dict, ~models.dots3_note.configuration_dots3_note.Dots3NoteAudioConfig], optional) — The config object or dictionary of the audio backbone. - image_token_id (
int, optional, defaults to151660) — The image token index used as a placeholder for input images. - video_token_id (
int, optional, defaults to151680) — The video token index used as a placeholder for input videos. - audio_token_id (
int, optional, defaults to151720) — The audio token index used as a placeholder for input audio. - tie_word_embeddings (
bool, optional, defaults toFalse) — Whether to tie weight embeddings according to model’stied_weights_keysmapping.
This is the configuration class to store the configuration of a Dots3NoteModel. It is used to instantiate a Dots3 Note 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 dots-studio/dots3-note-prev
Configuration objects inherit from PreTrainedConfig and can be used to control the model outputs. Read the documentation from PreTrainedConfig for more information.
Dots3NoteTextConfig
class transformers.Dots3NoteTextConfig
< source >( transformers_version: str | None = Nonearchitectures: list[str] | None = Noneoutput_hidden_states: bool | None = Falsereturn_dict: bool | None = Truedtype: str | torch.dtype | None = Nonechunk_size_feed_forward: int = 0is_encoder_decoder: bool = Falseid2label: dict[int, str] | dict[str, str] | None = Nonelabel2id: dict[str, int] | dict[str, str] | None = Noneproblem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = Nonevocab_size: int = 152064hidden_size: int = 5120intermediate_size: int = 13824moe_intermediate_size: int = 1536num_hidden_layers: int = 46num_attention_heads: int = 128num_key_value_heads: int = 128n_shared_experts: int = 1n_routed_experts: int = 256output_router_logits: bool = Falserouted_scaling_factor: float = 1.0kv_lora_rank: int = 512q_lora_rank: int | None = 1024qk_rope_head_dim: int = 64v_head_dim: int = 128qk_nope_head_dim: int = 128n_group: int = 1topk_group: int = 1num_experts_per_tok: int = 8norm_topk_prob: bool = Truehidden_act: str = 'silu'max_position_embeddings: int = 524288initializer_range: float = 0.02rms_norm_eps: float = 1e-05use_cache: bool = Truepad_token_id: int | None = 151659bos_token_id: int | None = 151643eos_token_id: int | list[int] | None = 151668tie_word_embeddings: bool = Falserope_parameters: dict | None = Nonemlp_layer_types: list[str] | None = Noneattention_bias: bool = Falseattention_dropout: float | int = 0.0index_topk: int = 2048index_head_dim: int = 128index_n_heads: int = 64mlp_bias: bool = Falsehead_dim: int = 256layer_types: list[str] | None = Nonesliding_window: int | None = Noneshared_experts_intermediate_size: int = 1536 )
Parameters
- vocab_size (
int, optional, defaults to152064) — Vocabulary size of the model. Defines the number of different tokens that can be represented by theinput_ids. - hidden_size (
int, optional, defaults to5120) — Dimension of the hidden representations. - intermediate_size (
int, optional, defaults to13824) — Dimension of the MLP representations. - moe_intermediate_size (
int, optional, defaults to1536) — Intermediate size of the routed expert MLPs. - num_hidden_layers (
int, optional, defaults to46) — Number of hidden layers in the Transformer decoder. - num_attention_heads (
int, optional, defaults to128) — Number of attention heads for each attention layer in the Transformer decoder. - num_key_value_heads (
int, optional, defaults to128) — This is the number of key_value heads that should be used to implement Grouped Query Attention. Ifnum_key_value_heads=num_attention_heads, the model will use Multi Head Attention (MHA), ifnum_key_value_heads=1the 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 this paper. If it is not specified, will default tonum_attention_heads. - n_shared_experts (
int, optional, defaults to1) — Number of shared experts. - n_routed_experts (
int, optional, defaults to256) — Number of routed experts. - output_router_logits (
bool, optional, defaults toFalse) — Whether or not the router logits should be returned by the model. Enabling this will also allow the model to output the auxiliary loss, including load balancing loss and router z-loss. - routed_scaling_factor (
float, optional, defaults to1.0) — Scaling factor or routed experts. - kv_lora_rank (
int, optional, defaults to512) — Rank of the LoRA matrices for key and value projections. - q_lora_rank (
int, optional, defaults to1024) — Rank of the LoRA matrices for query projections. - qk_rope_head_dim (
int, optional, defaults to64) — Dimension of the query/key heads that use rotary position embeddings. - v_head_dim (
int, optional, defaults to128) — Dimension of the value heads. - qk_nope_head_dim (
int, optional, defaults to128) — Dimension of the query/key heads that don’t use rotary position embeddings. - n_group (
int, optional, defaults to 1) — Number of groups into which routed experts are partitioned during selection. - topk_group (
int, optional, defaults to1) — Number of selected groups for each token (for each token, ensuring the selected experts is only withintopk_groupgroups). - num_experts_per_tok (
int, optional, defaults to8) — Number of experts to route each token to. This is the top-k value for the token-choice routing. - norm_topk_prob (
bool, optional, defaults toTrue) — Whether to normalize the weights of the routed experts. - hidden_act (
str, optional, defaults tosilu) — The non-linear activation function (function or string) in the decoder. For example,"gelu","relu","silu", etc. - max_position_embeddings (
int, optional, defaults to524288) — The maximum sequence length that this model might ever be used with. - initializer_range (
float, optional, defaults to0.02) — The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - rms_norm_eps (
float, optional, defaults to1e-05) — The epsilon used by the rms normalization layers. - use_cache (
bool, optional, defaults toTrue) — Whether or not the model should return the last key/values attentions (not used by all models). Only relevant ifconfig.is_decoder=Trueor when the model is a decoder-only generative model. - pad_token_id (
int, optional, defaults to151659) — Token id used for padding in the vocabulary. - bos_token_id (
int, optional, defaults to151643) — Token id used for beginning-of-stream in the vocabulary. - eos_token_id (
Union[int, list[int]], optional, defaults to151668) — Token id used for end-of-stream in the vocabulary. - tie_word_embeddings (
bool, optional, defaults toFalse) — Whether to tie weight embeddings according to model’stied_weights_keysmapping. - rope_parameters (
dict, optional) — Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain a value forrope_thetaand optionally parameters used for scaling in case you want to use RoPE with longermax_position_embeddings. - mlp_layer_types (
list[str], optional) — Per-layer"dense"or"sparse"MLP types, derived from the released MoE schedule when omitted. - attention_bias (
bool, optional, defaults toFalse) — Whether to use a bias in the query, key, value and output projection layers during self-attention. - attention_dropout (
Union[float, int], optional, defaults to0.0) — The dropout ratio for the attention probabilities. - index_topk (
int, optional, defaults to 2048) — Number of key positions selected by dynamic sparse attention. - index_head_dim (
int, optional, defaults to 128) — Per-head width of the dynamic sparse attention indexer. - index_n_heads (
int, optional, defaults to 64) — Number of heads in the dynamic sparse attention indexer. - mlp_bias (
bool, optional, defaults toFalse) — Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers. - head_dim (
int, optional, defaults to256) — The attention head dimension. If None, it will default to hidden_size // num_attention_heads - layer_types (
list[str], optional) — A list that explicitly maps each layer index with its layer type. If not provided, it will be automatically generated based on config values. - sliding_window (
int, optional) — Sliding window attention window size. IfNone, no sliding window is applied. - shared_experts_intermediate_size (
int, optional, defaults to 1536) — Intermediate width of each shared expert.
This is the configuration class to store the configuration of a Dots3NoteModel. It is used to instantiate a Dots3 Note 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 dots-studio/dots3-note-prev
Configuration objects inherit from PreTrainedConfig and can be used to control the model outputs. Read the documentation from PreTrainedConfig for more information.
Convert legacy RoPE settings to separate DSA/SWA entries, using each layer type’s rotary head fraction.
Dots3NoteVisionConfig
class transformers.Dots3NoteVisionConfig
< source >( transformers_version: str | None = Nonearchitectures: list[str] | None = Noneoutput_hidden_states: bool | None = Falsereturn_dict: bool | None = Truedtype: str | torch.dtype | None = Nonechunk_size_feed_forward: int = 0is_encoder_decoder: bool = Falseid2label: dict[int, str] | dict[str, str] | None = Nonelabel2id: dict[str, int] | dict[str, str] | None = Noneproblem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = Nonehidden_size: int = 1536intermediate_size: int = 4224num_hidden_layers: int = 42num_attention_heads: int = 24num_channels: int = 3patch_size: int = 14hidden_act: str = 'silu'attention_dropout: float | int = 0.0initializer_range: float = 0.02rope_parameters: dict | None = Nonemoe_intermediate_size: int = 2112spatial_merge_size: int = 2rms_norm_eps: float = 1e-05attention_bias: bool = Falsemlp_bias: bool = Falsemlp_layer_types: list[str] | None = Nonenum_local_experts: int = 64num_experts_per_tok: int | None = Nonerouter_scaling_factor: float | None = Noneadapter_in_dim: int = 1536adapter_out_dim: int = 5120adapter_merge_size: int = 2 )
Parameters
- hidden_size (
int, optional, defaults to1536) — Dimension of the hidden representations. - intermediate_size (
int, optional, defaults to4224) — Dimension of the MLP representations. - num_hidden_layers (
int, optional, defaults to42) — Number of hidden layers in the Transformer decoder. - num_attention_heads (
int, optional, defaults to24) — Number of attention heads for each attention layer in the Transformer decoder. - num_channels (
int, optional, defaults to3) — The number of input channels. - patch_size (
int, optional, defaults to14) — The size (resolution) of each patch. - hidden_act (
str, optional, defaults tosilu) — The non-linear activation function (function or string) in the decoder. For example,"gelu","relu","silu", etc. - attention_dropout (
Union[float, int], optional, defaults to0.0) — The dropout ratio for the attention probabilities. - initializer_range (
float, optional, defaults to0.02) — The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - rope_parameters (
dict, optional) — Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain a value forrope_thetaand optionally parameters used for scaling in case you want to use RoPE with longermax_position_embeddings. - moe_intermediate_size (
int, optional, defaults to2112) — Intermediate size of the routed expert MLPs. - spatial_merge_size (
int, optional, defaults to2) — The size of the spatial merge window used to reduce the number of visual tokens by merging neighboring patches. - rms_norm_eps (
float, optional, defaults to1e-05) — The epsilon used by the rms normalization layers. - attention_bias (
bool, optional, defaults toFalse) — Whether to use a bias in the query, key, value and output projection layers during self-attention. - mlp_bias (
bool, optional, defaults toFalse) — Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers. - mlp_layer_types (
list[str], optional) — Dense or sparse MLP for each layer. Expert counts are specified throughper_layer_config. - num_local_experts (
int, optional, defaults to64) — Number of local experts on each device.num_expertsshould be divisible bynum_local_experts. - num_experts_per_tok (
int, optional) — Number of experts to route each token to. This is the top-k value for the token-choice routing. - router_scaling_factor (
float, optional, defaults to 1.0) — Scale applied to the vision router scores. - adapter_in_dim (
int, optional, defaults to 1536) — Input width of the vision adapter. It must matchhidden_size. - adapter_out_dim (
int, optional, defaults to 5120) — Output width of the vision adapter. It must match the text hidden size. - adapter_merge_size (
int, optional, defaults to 2) — Spatial merge factor used by the vision adapter.
This is the configuration class to store the configuration of a Dots3NoteModel. It is used to instantiate a Dots3 Note 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 dots-studio/dots3-note-prev
Configuration objects inherit from PreTrainedConfig and can be used to control the model outputs. Read the documentation from PreTrainedConfig for more information.
Dots3NoteAudioConfig
class transformers.Dots3NoteAudioConfig
< source >( transformers_version: str | None = Nonearchitectures: list[str] | None = Noneoutput_hidden_states: bool | None = Falsereturn_dict: bool | None = Truedtype: str | torch.dtype | None = Nonechunk_size_feed_forward: int = 0is_encoder_decoder: bool = Falseid2label: dict[int, str] | dict[str, str] | None = Nonelabel2id: dict[str, int] | dict[str, str] | None = Noneproblem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = Nonehidden_size: int = 1280intermediate_size: int = 5120num_hidden_layers: int = 32num_attention_heads: int = 20num_key_value_heads: int | None = Nonehidden_act: str = 'silu'max_position_embeddings: int = 6000initializer_range: float = 0.02rope_parameters: dict | None = Noneattention_dropout: float | int = 0.0dropout: float = 0.0sampling_rate: int = 16000feature_size: int = 128hop_length: int = 160downsample_hidden_size: int = 480head_dim: int | None = Noneattention_bias: bool = Trueadapter_input_size: int = 1280adapter_out_dim: int = 5120 )
Parameters
- hidden_size (
int, optional, defaults to1280) — Dimension of the hidden representations. - intermediate_size (
int, optional, defaults to5120) — Dimension of the MLP representations. - num_hidden_layers (
int, optional, defaults to32) — Number of hidden layers in the Transformer decoder. - num_attention_heads (
int, optional, defaults to20) — Number of attention heads for each attention layer in the Transformer decoder. - num_key_value_heads (
int, optional) — This is the number of key_value heads that should be used to implement Grouped Query Attention. Ifnum_key_value_heads=num_attention_heads, the model will use Multi Head Attention (MHA), ifnum_key_value_heads=1the 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 this paper. If it is not specified, will default tonum_attention_heads. - hidden_act (
str, optional, defaults tosilu) — The non-linear activation function (function or string) in the decoder. For example,"gelu","relu","silu", etc. - max_position_embeddings (
int, optional, defaults to6000) — The maximum sequence length that this model might ever be used with. - initializer_range (
float, optional, defaults to0.02) — The standard deviation of the truncated_normal_initializer for initializing all weight matrices. - rope_parameters (
dict, optional) — Dictionary containing the configuration parameters for the RoPE embeddings. The dictionary should contain a value forrope_thetaand optionally parameters used for scaling in case you want to use RoPE with longermax_position_embeddings. - attention_dropout (
Union[float, int], optional, defaults to0.0) — The dropout ratio for the attention probabilities. - dropout (
float, optional, defaults to0.0) — The ratio for all dropout layers. - sampling_rate (
int, optional, defaults to16000) — The sampling rate at which the audio files should be digitalized expressed in hertz (Hz). - feature_size (
int, optional, defaults to 128) — Number of log-mel filter-bank channels. - hop_length (
int, optional, defaults to 160) — Number of waveform samples between adjacent log-mel frames. - downsample_hidden_size (
int, optional, defaults to 480) — Hidden width of the temporal downsampling projection. - head_dim (
int, optional) — The attention head dimension. If None, it will default to hidden_size // num_attention_heads - attention_bias (
bool, optional, defaults toTrue) — Whether to use a bias in the query, key, value and output projection layers during self-attention. - adapter_input_size (
int, optional, defaults to 1280) — Input width of the audio-to-text adapter. - adapter_out_dim (
int, optional, defaults to 5120) — Output width of the audio-to-text adapter. It must match the text hidden size.
This is the configuration class to store the configuration of a Dots3NoteModel. It is used to instantiate a Dots3 Note 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 dots-studio/dots3-note-prev
Configuration objects inherit from PreTrainedConfig and can be used to control the model outputs. Read the documentation from PreTrainedConfig for more information.
Dots3NoteForCausalLM
class transformers.Dots3NoteForCausalLM
< source >( config: Dots3NoteTextConfig )
Parameters
- config (Dots3NoteTextConfig) — 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 from_pretrained() method to load the model weights.
The Dots3 Note Model for causal language modeling.
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( input_ids: typing.Optional[torch.LongTensor] = Noneattention_mask: typing.Optional[torch.Tensor] = Noneposition_ids: typing.Optional[torch.LongTensor] = Nonepast_key_values: transformers.cache_utils.Cache | None = Noneinputs_embeds: typing.Optional[torch.Tensor] = Nonelabels: typing.Optional[torch.LongTensor] = Noneuse_cache: bool | None = Nonelogits_to_keep: typing.Union[int, torch.Tensor] = 0**kwargs: *<class 'transformers.utils.generic.TransformersKwargs'> ) → MoeCausalLMOutputWithPast or tuple(torch.Tensor)
Parameters
- input_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.Indices can be obtained using AutoTokenizer. See PreTrainedTokenizer.encode() and PreTrainedTokenizer.call() for details.
- attention_mask (
torch.Tensorof shape(batch_size, sequence_length), optional) — Mask to avoid performing attention on padding token indices. Mask values selected in[0, 1]:- 1 for tokens that are not masked,
- 0 for tokens that are masked.
- position_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of positions of each input sequence tokens in the position embeddings. Selected in the range[0, config.n_positions - 1]. - past_key_values (
~cache_utils.Cache, optional) — 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 thepast_key_valuesreturned by the model at a previous stage of decoding, whenuse_cache=Trueorconfig.use_cache=True.Only Cache instance is allowed as input, see our kv cache guide. If no
past_key_valuesare passed, DynamicCache will be initialized by default.The model will output the same cache format that is fed as input.
If
past_key_valuesare used, the user is expected to input only unprocessedinput_ids(those that don’t have their past key value states given to this model) of shape(batch_size, unprocessed_length)instead of allinput_idsof shape(batch_size, sequence_length). - inputs_embeds (
torch.Tensorof shape(batch_size, sequence_length, hidden_size), optional) — Optionally, instead of passinginput_idsyou can choose to directly pass an embedded representation. This is useful if you want more control over how to convertinput_idsindices into associated vectors than the model’s internal embedding lookup matrix. - labels (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Labels for computing the causal language modeling loss. Indices should be in[-100, 0, ..., config.vocab_size](seeinput_idsdocstring). Tokens with indices set to-100are ignored (masked), the loss is only computed for the tokens with labels in[0, ..., config.vocab_size].The labels are shifted internally so that
labels[..., 1:]are used to predictlogits[..., :-1, :]. Pass unshifted labels matchinginput_ids(i.e.labels = input_ids). Do not shift the labels yourself before passing them.If the labels are already shifted (for example with sequence parallelism), pass them as the
shift_labelskeyword argument and they are used as is.labelsmust still be passed for the loss to be computed. - use_cache (
bool, optional) — If set toTrue,past_key_valueskey value states are returned and can be used to speed up decoding (seepast_key_values). - logits_to_keep (
Union[int, torch.Tensor], optional, defaults to0) — If anint, compute logits for the lastlogits_to_keeptokens. If0, calculate logits for allinput_ids(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 atorch.Tensor, 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).
Returns
MoeCausalLMOutputWithPast or tuple(torch.Tensor)
A MoeCausalLMOutputWithPast or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteForCausalLM forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
loss (
torch.Tensorof shape(1,), optional, returned whenlabelsis provided) — Language modeling loss (for next-token prediction).logits (
torch.Tensorof shape(batch_size, sequence_length, config.vocab_size)) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).aux_loss (
torch.Tensor, optional, returned whenoutput_router_logits=Trueis passed or whenconfig.output_router_logits=True, and the model trains its router with a load-balancing loss) — Load-balancing auxiliary loss for the sparse modules. Models that balance their experts with a router bias instead (DeepSeek-V3 and the architectures derived from it) returnNonehere while still returningrouter_logits.router_logits (
tuple(torch.Tensor), optional, returned whenoutput_router_logits=Trueis passed or whenconfig.output_router_logits=True) — Tuple oftorch.Tensor(one for each sparse layer) of shape(batch_size * sequence_length, num_experts).Raw router logits computed by the MoE routers. They can be used to compute a load-balancing loss or to inspect how tokens are dispatched to experts.
past_key_values (
Cache, optional, returned whenuse_cache=Trueis passed or whenconfig.use_cache=True) — It is a Cache instance. For more details, see our kv cache guide.Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
past_key_valuesinput) to speed up sequential decoding.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
Example:
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> model_id = "dots-studio/dots3-note-prev"
>>> tokenizer = AutoTokenizer.from_pretrained(model_id)
>>> model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
>>> inputs = tokenizer("Briefly introduce yourself.", return_tensors="pt").to(model.device)
>>> output = model.generate(**inputs, max_new_tokens=32)
>>> text = tokenizer.batch_decode(output, skip_special_tokens=True)Dots3NoteModel
class transformers.Dots3NoteModel
< source >( config: Dots3NoteConfig )
Parameters
- config (Dots3NoteConfig) — 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 from_pretrained() method to load the model weights.
The bare Dots3 Note Model outputting raw hidden-states without any specific head on top.
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( input_ids: typing.Optional[torch.LongTensor] = Noneattention_mask: typing.Optional[torch.Tensor] = Noneposition_ids: typing.Optional[torch.LongTensor] = Nonepast_key_values: transformers.cache_utils.Cache | None = Noneinputs_embeds: typing.Optional[torch.FloatTensor] = Nonepixel_values: typing.Optional[torch.Tensor] = Noneimage_grid_thw: typing.Optional[torch.Tensor] = Nonepixel_values_videos: typing.Optional[torch.Tensor] = Nonevideo_grid_thw: typing.Optional[torch.Tensor] = Noneinput_features: typing.Optional[torch.Tensor] = Nonechunk_sample_lengths: typing.Optional[torch.Tensor] = Nonemm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None**kwargs ) → MoeModelOutputWithPast or tuple(torch.Tensor)
Parameters
- input_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.Indices can be obtained using AutoTokenizer. See PreTrainedTokenizer.encode() and PreTrainedTokenizer.call() for details.
- attention_mask (
torch.Tensorof shape(batch_size, sequence_length), optional) — Mask to avoid performing attention on padding token indices. Mask values selected in[0, 1]:- 1 for tokens that are not masked,
- 0 for tokens that are masked.
- position_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of positions of each input sequence tokens in the position embeddings. Selected in the range[0, config.n_positions - 1]. - past_key_values (
~cache_utils.Cache, optional) — 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 thepast_key_valuesreturned by the model at a previous stage of decoding, whenuse_cache=Trueorconfig.use_cache=True.Only Cache instance is allowed as input, see our kv cache guide. If no
past_key_valuesare passed, DynamicCache will be initialized by default.The model will output the same cache format that is fed as input.
If
past_key_valuesare used, the user is expected to input only unprocessedinput_ids(those that don’t have their past key value states given to this model) of shape(batch_size, unprocessed_length)instead of allinput_idsof shape(batch_size, sequence_length). - inputs_embeds (
torch.FloatTensorof shape(batch_size, sequence_length, hidden_size), optional) — Optionally, instead of passinginput_idsyou can choose to directly pass an embedded representation. This is useful if you want more control over how to convertinput_idsindices into associated vectors than the model’s internal embedding lookup matrix. - pixel_values (
torch.Tensorof shape(batch_size, num_channels, image_size, image_size), optional) — The tensors corresponding to the input images. Pixel values can be obtained using Qwen2VLImageProcessor. See Qwen2VLImageProcessor.call() for details (Dots3NoteProcessor uses Qwen2VLImageProcessor for processing images). - image_grid_thw (
torch.Tensorof shape(num_images, 3), optional) — The temporal, height and width of feature shape of each image in LLM. - pixel_values_videos (
torch.Tensorof shape(batch_size, num_frames, num_channels, frame_size, frame_size), optional) — The tensors corresponding to the input video. Pixel values for videos can be obtained using Qwen3VLVideoProcessor. See Qwen3VLVideoProcessor.call() for details (Dots3NoteProcessor uses Qwen3VLVideoProcessor for processing videos). - video_grid_thw (
torch.Tensorof shape(num_videos, 3), optional) — The temporal, height and width of feature shape of each video in LLM. - input_features (
torch.Tensorof shape(batch_size, sequence_length, feature_dim), optional) — The tensors corresponding to the input audio features. Audio features can be obtained using Dots3NoteFeatureExtractor. SeeDots3NoteFeatureExtractor.__call__()for details (Dots3NoteProcessor uses Dots3NoteFeatureExtractor for processing audios). - chunk_sample_lengths (
torch.Tensor, optional) — Waveform sample count for each audio feature chunk. - mm_encoder_outputs (
dict[str, ~modeling_outputs.BaseModelOutputWithPooling], optional) — Dict where keys are supported modalities and values are encoded outputs for that modality. Each encoded output is a tuple that consists of (pooler_output, optional:last_hidden_states, optional:hidden_states, optional:attentions)pooler_outputof shape(batch_size, sequence_length, hidden_size), optional) is a sequence of multimmodal features of the encoder merged into text embeddings.
Returns
MoeModelOutputWithPast or tuple(torch.Tensor)
A MoeModelOutputWithPast or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteModel forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
last_hidden_state (
torch.Tensorof shape(batch_size, sequence_length, hidden_size)) — Sequence of hidden-states at the output of the last layer of the model.past_key_values (
Cache, optional, returned whenuse_cache=Trueis passed or whenconfig.use_cache=True) — It is a Cache instance. For more details, see our kv cache guide.Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
config.is_encoder_decoder=Truein the cross-attention blocks) that can be used (seepast_key_valuesinput) to speed up sequential decoding.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
router_logits (
tuple(torch.Tensor), optional, returned whenoutput_router_probs=Trueandconfig.add_router_probs=Trueis passed or whenconfig.output_router_probs=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, sequence_length, num_experts).Raw router logits (post-softmax) that are computed by MoE routers, these terms are used to compute the auxiliary loss for Mixture of Experts models.
Dots3NoteForConditionalGeneration
class transformers.Dots3NoteForConditionalGeneration
< source >( config: Dots3NoteConfig )
Parameters
- config (Dots3NoteConfig) — 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 from_pretrained() method to load the model weights.
The Dots3 Note Model for token generation conditioned on other modalities (e.g. image-text-to-text generation).
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( input_ids: typing.Optional[torch.LongTensor] = Noneinput_features: typing.Optional[torch.FloatTensor] = Noneattention_mask: typing.Optional[torch.Tensor] = Noneposition_ids: typing.Optional[torch.LongTensor] = Nonepast_key_values: transformers.cache_utils.Cache | None = Noneinputs_embeds: typing.Optional[torch.FloatTensor] = Nonelabels: typing.Optional[torch.LongTensor] = Noneuse_cache: bool | None = Nonelogits_to_keep: typing.Union[int, torch.Tensor] = 0pixel_values: typing.Optional[torch.Tensor] = Nonepixel_values_videos: typing.Optional[torch.Tensor] = Noneimage_grid_thw: typing.Optional[torch.LongTensor] = Nonevideo_grid_thw: typing.Optional[torch.LongTensor] = Nonechunk_sample_lengths: typing.Optional[torch.Tensor] = Nonemm_encoder_outputs: dict[str, transformers.modeling_outputs.BaseModelOutputWithPooling] | None = None**kwargs: *<class 'transformers.utils.generic.TransformersKwargs'> ) → MoeCausalLMOutputWithPast or tuple(torch.Tensor)
Parameters
- input_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.Indices can be obtained using AutoTokenizer. See PreTrainedTokenizer.encode() and PreTrainedTokenizer.call() for details.
- input_features (
torch.FloatTensorof shape(batch_size, sequence_length, feature_dim), optional) — The tensors corresponding to the input audio features. Audio features can be obtained using Dots3NoteFeatureExtractor. SeeDots3NoteFeatureExtractor.__call__()for details (Dots3NoteProcessor uses Dots3NoteFeatureExtractor for processing audios). - attention_mask (
torch.Tensorof shape(batch_size, sequence_length), optional) — Mask to avoid performing attention on padding token indices. Mask values selected in[0, 1]:- 1 for tokens that are not masked,
- 0 for tokens that are masked.
- position_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of positions of each input sequence tokens in the position embeddings. Selected in the range[0, config.n_positions - 1]. - past_key_values (
~cache_utils.Cache, optional) — 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 thepast_key_valuesreturned by the model at a previous stage of decoding, whenuse_cache=Trueorconfig.use_cache=True.Only Cache instance is allowed as input, see our kv cache guide. If no
past_key_valuesare passed, DynamicCache will be initialized by default.The model will output the same cache format that is fed as input.
If
past_key_valuesare used, the user is expected to input only unprocessedinput_ids(those that don’t have their past key value states given to this model) of shape(batch_size, unprocessed_length)instead of allinput_idsof shape(batch_size, sequence_length). - inputs_embeds (
torch.FloatTensorof shape(batch_size, sequence_length, hidden_size), optional) — Optionally, instead of passinginput_idsyou can choose to directly pass an embedded representation. This is useful if you want more control over how to convertinput_idsindices into associated vectors than the model’s internal embedding lookup matrix. - labels (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Labels for computing the masked language modeling loss. Indices should either be in[0, ..., config.vocab_size]or -100 (seeinput_idsdocstring). Tokens with indices set to-100are ignored (masked), the loss is only computed for the tokens with labels in[0, ..., config.vocab_size]. - use_cache (
bool, optional) — If set toTrue,past_key_valueskey value states are returned and can be used to speed up decoding (seepast_key_values). - logits_to_keep (
Union[int, torch.Tensor], optional, defaults to0) — If anint, compute logits for the lastlogits_to_keeptokens. If0, calculate logits for allinput_ids(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 atorch.Tensor, 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). - pixel_values (
torch.Tensorof shape(batch_size, num_channels, image_size, image_size), optional) — The tensors corresponding to the input images. Pixel values can be obtained using Qwen2VLImageProcessor. See Qwen2VLImageProcessor.call() for details (Dots3NoteProcessor uses Qwen2VLImageProcessor for processing images). - pixel_values_videos (
torch.Tensorof shape(batch_size, num_frames, num_channels, frame_size, frame_size), optional) — The tensors corresponding to the input video. Pixel values for videos can be obtained using Qwen3VLVideoProcessor. See Qwen3VLVideoProcessor.call() for details (Dots3NoteProcessor uses Qwen3VLVideoProcessor for processing videos). - image_grid_thw (
torch.LongTensorof shape(num_images, 3), optional) — The temporal, height and width of feature shape of each image in LLM. - video_grid_thw (
torch.LongTensorof shape(num_videos, 3), optional) — The temporal, height and width of feature shape of each video in LLM. - chunk_sample_lengths (
torch.Tensor, optional) — Number of waveform samples in each audio chunk. - mm_encoder_outputs (
dict[str, ~modeling_outputs.BaseModelOutputWithPooling], optional) — Dict where keys are supported modalities and values are encoded outputs for that modality. Each encoded output is a tuple that consists of (pooler_output, optional:last_hidden_states, optional:hidden_states, optional:attentions)pooler_outputof shape(batch_size, sequence_length, hidden_size), optional) is a sequence of multimmodal features of the encoder merged into text embeddings.
Returns
MoeCausalLMOutputWithPast or tuple(torch.Tensor)
A MoeCausalLMOutputWithPast or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteForConditionalGeneration forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
loss (
torch.Tensorof shape(1,), optional, returned whenlabelsis provided) — Language modeling loss (for next-token prediction).logits (
torch.Tensorof shape(batch_size, sequence_length, config.vocab_size)) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).aux_loss (
torch.Tensor, optional, returned whenoutput_router_logits=Trueis passed or whenconfig.output_router_logits=True, and the model trains its router with a load-balancing loss) — Load-balancing auxiliary loss for the sparse modules. Models that balance their experts with a router bias instead (DeepSeek-V3 and the architectures derived from it) returnNonehere while still returningrouter_logits.router_logits (
tuple(torch.Tensor), optional, returned whenoutput_router_logits=Trueis passed or whenconfig.output_router_logits=True) — Tuple oftorch.Tensor(one for each sparse layer) of shape(batch_size * sequence_length, num_experts).Raw router logits computed by the MoE routers. They can be used to compute a load-balancing loss or to inspect how tokens are dispatched to experts.
past_key_values (
Cache, optional, returned whenuse_cache=Trueis passed or whenconfig.use_cache=True) — It is a Cache instance. For more details, see our kv cache guide.Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
past_key_valuesinput) to speed up sequential decoding.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
Example:
>>> from PIL import Image
>>> from transformers import AutoProcessor, Dots3NoteForConditionalGeneration
>>> model = Dots3NoteForConditionalGeneration.from_pretrained("dots-studio/dots3-note-prev")
>>> processor = AutoProcessor.from_pretrained("dots-studio/dots3-note-prev")
>>> messages = [
... {
... "role": "user", "content": [
... {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"},
... {"type": "text", "text": "Where is the cat standing?"},
... ]
... },
... ]
>>> inputs = processor.apply_chat_template(
... messages,
... tokenize=True,
... return_dict=True,
... return_tensors="pt",
... add_generation_prompt=True
... )
>>> # Generate
>>> generate_ids = model.generate(**inputs)
>>> processor.batch_decode(generate_ids, skip_special_tokens=True)[0]Dots3NoteTextModel
class transformers.Dots3NoteTextModel
< source >( config: Dots3NoteTextConfig )
Parameters
- config (Dots3NoteTextConfig) — 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 from_pretrained() method to load the model weights.
The bare Dots3 Note Text Model outputting raw hidden-states without any specific head on top.
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( input_ids: typing.Optional[torch.LongTensor] = Noneattention_mask: typing.Optional[torch.Tensor] = Noneposition_ids: typing.Optional[torch.LongTensor] = Nonepast_key_values: transformers.cache_utils.Cache | None = Noneinputs_embeds: typing.Optional[torch.FloatTensor] = Noneuse_cache: bool | None = None**kwargs: *<class 'transformers.utils.generic.TransformersKwargs'> ) → MoeModelOutputWithPast or tuple(torch.Tensor)
Parameters
- input_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.Indices can be obtained using AutoTokenizer. See PreTrainedTokenizer.encode() and PreTrainedTokenizer.call() for details.
- attention_mask (
torch.Tensorof shape(batch_size, sequence_length), optional) — Mask to avoid performing attention on padding token indices. Mask values selected in[0, 1]:- 1 for tokens that are not masked,
- 0 for tokens that are masked.
- position_ids (
torch.LongTensorof shape(batch_size, sequence_length), optional) — Indices of positions of each input sequence tokens in the position embeddings. Selected in the range[0, config.n_positions - 1]. - past_key_values (
~cache_utils.Cache, optional) — 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 thepast_key_valuesreturned by the model at a previous stage of decoding, whenuse_cache=Trueorconfig.use_cache=True.Only Cache instance is allowed as input, see our kv cache guide. If no
past_key_valuesare passed, DynamicCache will be initialized by default.The model will output the same cache format that is fed as input.
If
past_key_valuesare used, the user is expected to input only unprocessedinput_ids(those that don’t have their past key value states given to this model) of shape(batch_size, unprocessed_length)instead of allinput_idsof shape(batch_size, sequence_length). - inputs_embeds (
torch.FloatTensorof shape(batch_size, sequence_length, hidden_size), optional) — Optionally, instead of passinginput_idsyou can choose to directly pass an embedded representation. This is useful if you want more control over how to convertinput_idsindices into associated vectors than the model’s internal embedding lookup matrix. - use_cache (
bool, optional) — If set toTrue,past_key_valueskey value states are returned and can be used to speed up decoding (seepast_key_values).
Returns
MoeModelOutputWithPast or tuple(torch.Tensor)
A MoeModelOutputWithPast or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteTextModel forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
last_hidden_state (
torch.Tensorof shape(batch_size, sequence_length, hidden_size)) — Sequence of hidden-states at the output of the last layer of the model.past_key_values (
Cache, optional, returned whenuse_cache=Trueis passed or whenconfig.use_cache=True) — It is a Cache instance. For more details, see our kv cache guide.Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
config.is_encoder_decoder=Truein the cross-attention blocks) that can be used (seepast_key_valuesinput) to speed up sequential decoding.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
router_logits (
tuple(torch.Tensor), optional, returned whenoutput_router_probs=Trueandconfig.add_router_probs=Trueis passed or whenconfig.output_router_probs=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, sequence_length, num_experts).Raw router logits (post-softmax) that are computed by MoE routers, these terms are used to compute the auxiliary loss for Mixture of Experts models.
Dots3NoteVisionModel
class transformers.Dots3NoteVisionModel
< source >( config: Dots3NoteVisionConfig )
Parameters
- config (Dots3NoteVisionConfig) — 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 from_pretrained() method to load the model weights.
The bare Dots3 Note Model outputting raw hidden-states without any specific head on top.
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( pixel_values: Tensorgrid_thw: Tensor**kwargs ) → BaseModelOutputWithPooling or tuple(torch.Tensor)
Parameters
- pixel_values (
torch.Tensorof shape(batch_size, num_channels, image_size, image_size)) — The tensors corresponding to the input images. Pixel values can be obtained using Qwen2VLImageProcessor. See Qwen2VLImageProcessor.call() for details (Dots3NoteProcessor uses Qwen2VLImageProcessor for processing images). - grid_thw (
torch.Tensor) — Temporal, height, and width patch-grid dimensions for each input.
Returns
BaseModelOutputWithPooling or tuple(torch.Tensor)
A BaseModelOutputWithPooling or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteVisionModel forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
last_hidden_state (
torch.Tensorof shape(batch_size, sequence_length, hidden_size)) — Sequence of hidden-states at the output of the last layer of the model.pooler_output (
torch.Tensorof shape(batch_size, hidden_size)) — 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.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
Dots3NoteAudioModel
class transformers.Dots3NoteAudioModel
< source >( config: Dots3NoteAudioConfig )
Parameters
- config (Dots3NoteAudioConfig) — 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 from_pretrained() method to load the model weights.
The bare Dots3 Note Model outputting raw hidden-states without any specific head on top.
This model inherits from PreTrainedModel. 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.)
This model is also a PyTorch torch.nn.Module subclass. Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and behavior.
forward
< source >( input_features: Tensorchunk_sample_lengths: Tensor**kwargs: *<class 'transformers.utils.generic.TransformersKwargs'> ) → BaseModelOutputWithPooling or tuple(torch.Tensor)
Parameters
- input_features (
torch.Tensorof shape(batch_size, sequence_length, feature_dim)) — The tensors corresponding to the input audio features. Audio features can be obtained using Dots3NoteFeatureExtractor. SeeDots3NoteFeatureExtractor.__call__()for details (Dots3NoteProcessor uses Dots3NoteFeatureExtractor for processing audios). - chunk_sample_lengths (
torch.LongTensorof shape(num_chunks,)) — Number of waveform samples in each audio chunk.
Returns
BaseModelOutputWithPooling or tuple(torch.Tensor)
A BaseModelOutputWithPooling or a tuple of
torch.Tensor (if return_dict=False is passed or when config.return_dict=False) comprising various
elements depending on the configuration (Dots3NoteConfig) and inputs.
The Dots3NoteAudioModel forward method, overrides the __call__ special method.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
last_hidden_state (
torch.Tensorof shape(batch_size, sequence_length, hidden_size)) — Sequence of hidden-states at the output of the last layer of the model.pooler_output (
torch.Tensorof shape(batch_size, hidden_size)) — 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.hidden_states (
tuple(torch.Tensor), optional, returned whenoutput_hidden_states=Trueis passed or whenconfig.output_hidden_states=True) — Tuple oftorch.Tensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size).Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (
tuple(torch.Tensor), optional, returned whenoutput_attentions=Trueis passed or whenconfig.output_attentions=True) — Tuple oftorch.Tensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length).Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
Dots3NoteProcessor
class transformers.Dots3NoteProcessor
< source >( image_processor = Nonetokenizer = Nonevideo_processor = Nonefeature_extractor = Nonechat_template = None )
Parameters
- image_processor (
Qwen2VLImageProcessor) — The image processor is a required input. - tokenizer (
Qwen2Tokenizer) — The tokenizer is a required input. - video_processor (
Qwen3VLVideoProcessor) — The video processor is a required input. - feature_extractor (
Dots3NoteFeatureExtractor) — The feature extractor is a required input. - chat_template (
str) — A Jinja template to convert lists of messages in a chat into a tokenizable string.
Constructs a Dots3NoteProcessor which wraps a image processor, a tokenizer, a video processor, and a feature extractor into a single processor.
Dots3NoteProcessor offers all the functionalities of Qwen2VLImageProcessor, Qwen2Tokenizer, Qwen3VLVideoProcessor, and Dots3NoteFeatureExtractor. See the ~Qwen2VLImageProcessor, ~Qwen2Tokenizer, ~Qwen3VLVideoProcessor, and ~Dots3NoteFeatureExtractor for more information.
__call__
< source >( images: typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor'], NoneType] = Nonetext: str | list[str] | list[list[str]] | None = Nonevideos: 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] = Noneaudio: typing.Union[numpy.ndarray, ForwardRef('torch.Tensor'), collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence['torch.Tensor'], NoneType] = None**kwargs: *<class 'transformers.processing_utils.ProcessingKwargs'> )
Parameters
- images (
Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]], optional) — 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, setdo_rescale=False. - text (
Union[str, list[str], list[list[str]]], optional) — 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, setis_split_into_words=Trueto avoid ambiguity with batched inputs. - videos (
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]]], optional) — 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, setdo_rescale=False. - audio (
Union[numpy.ndarray, torch.Tensor, collections.abc.Sequence[numpy.ndarray], collections.abc.Sequence[torch.Tensor]], optional) — 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. - return_mm_token_type_ids (
bool, kwargs) — Whether to return multimodal token type ids indicating multimodal placeholder token positions. - return_text_replacement_offsets (
bool, kwargs) — Whether to return character offsets for each multimodal placeholder and its replacement. - return_tensors (
stror TensorType, optional) — If set, will return tensors of a particular framework. Acceptable values are:'pt': Return PyTorchtorch.Tensorobjects.'np': Return NumPynp.ndarrayobjects.
- **kwargs (ProcessingKwargs, optional) — 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.
Dots3NoteFeatureExtractor
class transformers.Dots3NoteFeatureExtractor
< source >( feature_size: int = 128sampling_rate: int = 16000padding_value: float = 0.0n_fft: int = 400hop_length: int = 160chunk_length: int = 60chunk_seconds: int | None = Nonereturn_attention_mask: bool = Falsedither: float = 0.0**kwargs )
Convert 16 kHz mono waveforms into Dots 3 Note Preview log-mel chunks.