nemo_automodel.components.models.llama_nemotron_vl.model
nemo_automodel.components.models.llama_nemotron_vl.model
Module Contents
Classes
Functions
Data
_HAS_NATIVE_BIDIRECTIONAL_MASK
API
Bases: LlamaConfig
Configuration for bidirectional (non-causal) LLaMA model.
Bases: LlamaModel
Legacy Llama retrieval model supporting causal and bidirectional attention.
Supports Transformers 4.44 through 5.x with a compatibility forward path.
Encode tokens using the selected attention mode.
Parameters:
Integer tensor of shape [batch, sequence], mutually exclusive with inputs_embeds.
Optional padding mask of shape [batch, key_sequence], including cached tokens.
Optional integer tensor of shape [batch, sequence] or [1, sequence].
Optional cache of key/value tensors of shape [batch, kv_heads, cached_sequence, head_dim].
Optional tensor of shape [batch, sequence, hidden], mutually exclusive with input_ids.
Optional integer tensor of shape [sequence].
Whether to retain attention keys and values.
Whether to return each layer’s hidden states.
Additional arguments forwarded to the stock causal decoder.
Returns: BaseModelOutputWithPast
Output with last_hidden_state of shape [batch, sequence, hidden], optional
Bases: PretrainedConfig
Base configuration for vision-language models combining vision and language components. This serves as the foundation for LlamaNemotronVL configurations.
Resolve the language config through the Transformers composite contract.
Parameters:
Select the text-output configuration when true.
Select the text-input configuration when true.
Returns: PretrainedConfig
The language decoder config for decoder or unrestricted requests;
Bases: PreTrainedModel
LlamaNemotron VL model for vision-language reranking. Combines a vision encoder (SigLIP) with a bidirectional language model (LLaMA) for cross-modal reranking tasks.
Encodes the inputs into a tensor of embeddings. Args: inputs: A dictionary of inputs to the model. You can prepare the inputs using the processor.process_queries and processor.process_documents methods. pool_type: The type of pooling to use. If None, the pooling type is set to the pooling type configured in the model. Returns: A tensor of embeddings.
Encodes the input document images and texts into a tensor of embeddings. Args: images: A list of PIL.Image of document pages images. texts: A list of document page texts. Returns: A tensor of embeddings.
Encodes the input queries into a tensor of embeddings. Args: queries: A list of queries. Returns: A tensor of embeddings.
Extract and project vision features to language model space.
Return the language tower used as the retrieval text decoder.
Keep only vision embeddings marked as real images.
Register bidirectional models with HuggingFace Auto classes.
This is needed so that AutoModel.from_config(LlamaBidirectionalConfig) works inside LlamaForSequenceClassification.init.
Replace image placeholder token embeddings with vision embeddings.