conversion
Convert/restore/update entrypoints for TriAttention mode.
TriAttention is a calibration-only mode. Convert is a no-op on model weights. Calibration data is stored in metadata and fused into the checkpoint at save time.
Functions
Apply TriAttention mode to model. |
|
Restore TriAttention mode from saved state. |
|
Update metadata before saving. |
- convert_triattention(model, config)
Apply TriAttention mode to model.
This is a no-op on model weights. It stores the configuration in metadata so that calibration can be run subsequently.
- Parameters:
model (nn.Module)
config (TriAttentionConfig)
- Return type:
ConvertReturnType
- restore_triattention(model, config, metadata)
Restore TriAttention mode from saved state.
Loads calibration data from metadata if present.
- Parameters:
model (nn.Module)
config (TriAttentionConfig)
metadata (MetadataDict)
- Return type:
nn.Module
- update_triattention_metadata(model, config, metadata)
Update metadata before saving.
Ensures calibration data and config are current in metadata.
- Parameters:
model (nn.Module)
config (TriAttentionConfig)
metadata (MetadataDict)
- Return type:
None