nemo_automodel.components.models.common.bidirectional
nemo_automodel.components.models.common.bidirectional
Module Contents
Classes
API
Bases: StateDictAdapter
Adapter for encoder model state dicts.
Internal format uses a model. prefix on all keys. HF format does not.
This adapter strips or adds the model. prefix as needed, including
for PEFT-wrapped keys (base_model.model.model.X <-> base_model.model.X).
Forward backbone aliases, which are already expressed in exported HF names.
Convert a wrapped parameter using the backbone’s per-tensor contract.
Parameters:
Wrapped native parameter name.
Tensor in its native model-specific shape, dtype, device and distributed placement.
Options passed to the backbone adapter.
Returns:
HF name/tensor pairs following the backbone adapter’s layouts; without an adapter the tensor aliases input.
Preserve backbone export dtype requirements through the encoder wrapper.
Parameters:
HF parameter names and tensors in their unchanged model-specific layouts.
Returns: dict[str, str]
HF parameter names mapped to safetensors dtype names required by the backbone adapter.
Apply the backbone conversion before restoring the wrapper prefix.
Parameters:
HF tensors in the backbone adapter’s documented layouts.
Mesh forwarded to the backbone adapter without modification.
Options passed to the backbone adapter.
Returns:
Native tensors in the wrapped model’s layouts and distributed placements.
Remove the wrapper prefix, then apply the backbone conversion.
Parameters:
Native tensors in the wrapped model’s documented layouts and distributed placements.
Options passed to the backbone adapter.
Returns:
HF tensors in the backbone adapter’s documented layouts, or unchanged tensors without an adapter.