nemo_automodel.components.models.ministral_bidirectional.reranker_export
nemo_automodel.components.models.ministral_bidirectional.reranker_export
Portable checkpoint export for the Mistral3 pooled reranker.
Module Contents
Classes
API
Snapshot the trained head on every rank, then write portable metadata on the writer rank.
Serialized head values are preserved, but consumers may cast them to the backbone dtype at load time. Stock Sentence Transformers Dense scoring therefore need not be bitwise identical to FP32 projection.
Save a Transformer/Pooling/Dense chain using the snapshot from this checkpoint step.
Write stock configs and the small standalone Transformers scoring adapter.
Validate the export and collectively snapshot the small trained head before rank-zero I/O.
Bases: StateDictAdapter
Preserve backbone weights and expose the head at the native vLLM classifier path.
Map the current head name to the name used by older training checkpoints.
Rename one parameter without gathering or copying it.
Parameters:
Native parameter name.
Parameter in its native layout; the scoring head has shape [labels, hidden].
Unused adapter options.
Returns: list[tuple[str, torch.Tensor]]
One HF name and the original tensor with unchanged shape, dtype, device and placement.
Keep the trained head’s dtype so its exported Dense copy describes the same weights.
Parameters:
HF tensors, including language_model.score.weight of shape [labels, hidden].
Returns: dict[str, str]
The scoring head’s current dtype, overriding a potentially lower-precision source checkpoint.
Restore the native head name, accepting legacy score.weight checkpoints too.
Parameters:
HF tensors in native layouts; the head has shape [labels, hidden].
Unused mesh; this adapter preserves placements and does not gather.
Unused adapter options.
Returns: dict[str, torch.Tensor]
Native names mapped to the same tensors, preserving device, dtype and distributed placements.
Rename the native scoring head without changing tensor values.
Parameters:
Native parameters in their original layouts; score.weight has shape [labels, hidden].
Unused adapter options.
Returns: dict[str, torch.Tensor]
HF names mapped to the same tensors, with the head at language_model.score.weight.