bridge.models.conversion.gtp#

Translate between stored GTP shards and the TP-local tensors used by mappings.

Module Contents#

Functions#

_is_gtp_param

_get_mapping_shape

Return the logical TP-local shape, excluding GTP padding and sharding.

_gtp_weight_load_context

Let TE update native FP8 storage while preserving the GTP parameter subclass.

_slice_gtp_weight

Take the stored GTP row shard after the mapping has applied TP splitting.

_gather_gtp_weight

Gather only the GTP axis, leaving TP/EP/PP handling to the mapping.

API#

bridge.models.conversion.gtp._is_gtp_param(param: torch.Tensor | None) → bool#
bridge.models.conversion.gtp._get_mapping_shape(param: torch.Tensor) → torch.Size#

Return the logical TP-local shape, excluding GTP padding and sharding.

bridge.models.conversion.gtp._gtp_weight_load_context(
param: torch.Tensor,
module: torch.nn.Module,
) → collections.abc.Iterator[None]#

Let TE update native FP8 storage while preserving the GTP parameter subclass.

bridge.models.conversion.gtp._slice_gtp_weight(
weight: torch.Tensor,
param: torch.Tensor,
) → torch.Tensor#

Take the stored GTP row shard after the mapping has applied TP splitting.

bridge.models.conversion.gtp._gather_gtp_weight(param: torch.Tensor | None) → torch.Tensor | None#

Gather only the GTP axis, leaving TP/EP/PP handling to the mapping.