nemo_automodel.components.models.pixtral.compat
nemo_automodel.components.models.pixtral.compat
Temporary Pixtral forward backport for Transformers 5.17.0, 5.18.0, and 5.19.0.
Adapted from Hugging Face Transformers (Apache-2.0), with the image-boundary fix from https://github.com/huggingface/transformers/pull/49373 (ff704ffd47d800e31b31f2f81a5a2952fb0fbf71). Remove this module and its binding when AutoModel pins a release containing that fix.
Module Contents
Functions
API
Preserve axial positions while passing explicit FlashAttention image boundaries.
Parameters:
Tensor of shape [images, channels, height, width], padded to a common image size.
Tensor of shape [images, 2] containing each unpadded height and width. A list of height/width pairs is also accepted upstream.
Options following PixtralVisionModel.forward’s contract.
Returns: tuple | BaseModelOutput | BaseModelOutputWithPooling
The PixtralVisionModel.forward output contract: last hidden state
Apply HF #49373 to one vision tower on the affected Transformers releases.
Remove this compatibility hook and its callers when the pinned release contains the upstream fix and passes the Pixtral regression tests.
Parameters:
The owning model’s Pixtral tower. Its forward method is replaced in place; independently constructed HF towers are unchanged.