Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/megatron/bridge/training/mixed_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import logging
from dataclasses import dataclass, fields
from typing import TYPE_CHECKING, Callable, Optional
from typing import TYPE_CHECKING, Any, Callable, Optional

import torch
from megatron.core.distributed import DistributedDataParallelConfig
Expand Down Expand Up @@ -50,6 +50,8 @@ class MixedPrecisionConfig:
fp8_recipe: str = (
"tensorwise" # "tensorwise", "delayed", "mxfp8" (for Blackwell only), "blockwise" (for Hopper only)
)
fp8_recipe_attrs: Optional[dict[str, Any]] = None
fp8_quantizer_factory: Optional[str] = None
first_last_layers_bf16: bool = False
fp8_margin: int = 0
fp8_amax_history_len: int = 1
Expand All @@ -62,6 +64,8 @@ class MixedPrecisionConfig:
# fp4 related
fp4: Optional[str] = None
fp4_recipe: str = "nvfp4"
fp4_recipe_attrs: Optional[dict[str, Any]] = None
fp4_quantizer_factory: Optional[str] = None
fp4_param: Optional[bool] = None
fp4_param_gather: bool = False
# FP16 Loss scaling
Expand Down
Loading