Skip to content

Commit b2c60fa

Browse files
lint
1 parent 5df35ce commit b2c60fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

torchtitan/components/quantization/float8.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,22 @@ def convert(self, model: nn.Module):
119119
# to perform dynamic float8 rowwise quantization + scaled grouped GEMMs for the target MoE FQNs.
120120
if self.moe_fqns:
121121
from torchao.quantization.quant_api import quantize_
122+
122123
try:
123124
from torchao.prototype.moe_training.conversion_utils import (
124125
MoETrainingConfig,
125126
)
126127
except ImportError as e:
127128
raise ImportError(
128129
"torchao installation does not have MoE training support. Please install torchao nightly build."
129-
)
130+
) from e
130131

131132
def moe_module_filter_fn(mod: nn.Module, cur_fqn: str) -> bool:
132133
for target_fqn in self.moe_fqns:
133134
if target_fqn in cur_fqn:
134135
return True
135136
return False
136-
137+
137138
config = MoETrainingConfig()
138139
quantize_(model, config=config, filter_fn=moe_module_filter_fn)
139140
logger.info("Converted MoE to float8")

0 commit comments

Comments
 (0)