bridge.utils.activation_map#
Shared bidirectional mapping between activation function names and callables.
Used by:
omegaconf_utilsfor CLI override serialization/deserializationModelBridgefor HuggingFace <-> Megatron activation conversion
Module Contents#
Functions#
Convert a known activation callable to its short string name. |
|
Resolve an activation function name to its callable. |
|
Resolve a dtype string to a |
Data#
API#
- bridge.utils.activation_map.logger#
‘getLogger(…)’
- bridge.utils.activation_map.ACTIVATION_FUNC_MAP: dict[str, Callable]#
None
- bridge.utils.activation_map._ACTIVATION_FUNC_TO_STR: dict[int, str]#
None
- bridge.utils.activation_map.callable_to_str(fn: Callable) str | None#
Convert a known activation callable to its short string name.
Returns
Noneif the callable is not in the registry.
- bridge.utils.activation_map.str_to_callable(name: str) Callable#
Resolve an activation function name to its callable.
Accepts short names (
"silu"), fully-qualified names ("torch.nn.functional.silu"), or arbitrary dotted import paths.- Raises:
ValueError – If the name cannot be resolved.
- bridge.utils.activation_map.DTYPE_MAP: dict[str, torch.dtype]#
None
- bridge.utils.activation_map.str_to_dtype(name: str) torch.dtype#
Resolve a dtype string to a
torch.dtype.Accepts short names (
"bf16"), canonical names ("bfloat16"), or fully-qualified names ("torch.bfloat16").- Raises:
ValueError – If the name cannot be resolved.