Skip to navigation

nemo_automodel.components.models.hy_v4_flash.fsdp

View as MarkdownOpen in Claude

FSDP policy of the Hy4-flash decoder root.

The decoder blocks are sharded by dtype by the shared MoE parallelizer, but the root HYV4FlashModel also owns the fp32 output hyper-connection (hc_head) next to the bf16 final norm. FSDP requires one parameter dtype per unit and would cast hc_head to the bf16 policy dtype, so hc_head gets its own fp32 unit before the root is sharded.

Module Contents

Classes

NameDescription
HYV4FlashModelParallelizerGive the fp32 output hyper-connection a dtype-uniform FSDP unit.

Data

PARALLELIZER

API

class nemo_automodel.components.models.hy_v4_flash.fsdp.HYV4FlashModelParallelizer()

Bases: ModelParallelizer

Give the fp32 output hyper-connection a dtype-uniform FSDP unit.

nemo_automodel.components.models.hy_v4_flash.fsdp.HYV4FlashModelParallelizer._fully_shard_module(
module: torch.nn.Module | list[torch.nn.Module],
mesh: torch.distributed.device_mesh.DeviceMesh,
mp_policy: torch.distributed.fsdp.MixedPrecisionPolicy,
offload_policy: torch.distributed.fsdp.OffloadPolicy | None = None,
reshard_after_forward: bool | int | None = None,
ignored_params: set[torch.nn.Parameter] | None = None
) -> torch.nn.Module | list[torch.nn.Module]

Shard module in place like the base parallelizer, first isolating a directly owned hc_head.

nemo_automodel.components.models.hy_v4_flash.fsdp.PARALLELIZER = HYV4FlashModelParallelizer()