nemo_automodel.components.models.mistral_large4.vision
nemo_automodel.components.models.mistral_large4.vision
Native-layout Pixtral correctness path; no checkpoint matrix permutation.
The released tower uses FP32 interleaved axial rotation and BF16 source weights. Packing images once per forward keeps FSDP collective counts independent of the number of images on a rank. Attention remains isolated between images.
Module Contents
Classes
Functions
API
Bases: Module
Channel-major spatial patch merging, before the GELU projector.
Merge nonoverlapping complete patch groups.
Parameters:
Per-image floating [patch_rows * patch_columns, vision_hidden] tensors.
Per-image patch grid (rows, columns), divisible by merge size.
Returns: torch.Tensor
Independent [total_merged_patches, vision_hidden] tensor, in image order.
Bases: Module
Bias-free vision-to-language GELU projection with released parameter names.
Project merged image features.
Parameters:
Floating [merged_patches, vision_hidden] features.
Returns: torch.Tensor
Independent floating [merged_patches, text_hidden] features.
Bases: Module
A single native Pixtral block and FSDP/recomputation boundary.
Apply attention and SwiGLU residuals without mutating inputs.
Parameters:
Floating packed [tokens, hidden] image features.
FP32 [tokens, head_dim / 2] axial angles.
Boolean [tokens, tokens] image membership mask.
Returns: torch.Tensor
Independent features [tokens, hidden].
Typed native vision settings, parsed once at the checkpoint boundary.
Construct the native-layout encoder without changing declarative settings.
Validate a complete preprocessed image and return its merged grid.
Parameters:
Floating tensor [channels, height, width], before patch convolution. Height/width must be positive multiples of patch_size * merge_size.
Returns: tuple[int, int]
Merged grid height and width in language image tokens.
Bases: Module
Pack variable images into one set of per-layer calls with native weight names.
Encode complete images; positions reset for each image.
Parameters:
Nonempty list of floating [channels, height, width] tensors, on the model device. Inputs are neither resized nor modified.
Returns: torch.Tensor
One independent [patch_rows * patch_columns, vision_hidden] tensor per
Bases: Module
Attend bidirectionally within each image.
Parameters:
Floating packed [tokens, hidden] image features.
FP32 [tokens, head_dim / 2] axial angles.
Boolean [tokens, tokens] image membership mask, true permits attention.
Returns: torch.Tensor
Independent projected features [tokens, hidden].
Bases: Module
Apply the native SwiGLU projections.
Parameters:
Floating [tokens, hidden] features.
Returns: torch.Tensor
Independent features [tokens, hidden].
Apply axial rotation without rounding trigonometric tables to BF16.
Parameters:
Floating [tokens, heads, head_dim], adjacent real/imaginary channel pairs.
FP32 [tokens, head_dim / 2], height frequencies followed by width frequencies.
Returns: torch.Tensor
Independent rotated tensor with x’s shape and dtype.