[Feature] Add an unquantized option for MoE and Dense quant type (#4813)

This commit is contained in:
Sunny-bot1
2025-11-19 16:24:03 +08:00
committed by GitHub
parent 9ff418db73
commit 43f0c7557e
3 changed files with 48 additions and 34 deletions
+5 -2
View File
@@ -182,10 +182,13 @@ class FusedMoE(nn.Layer):
self._dtype = self._helper.get_default_dtype()
self.weight_dtype = self._dtype
self.is_quantized = fd_config.model_config.is_quantized and not (
fd_config.quant_config.name() == "mix_quant" and fd_config.quant_config.moe_quant_type is None
)
moe_quant_config = fd_config.quant_config
self.moe_quant_config = moe_quant_config
self.moe_quant_type = None
if moe_quant_config:
if moe_quant_config and moe_quant_config.get_quant_method(self):
self.quant_method = moe_quant_config.get_quant_method(self)
self.moe_quant_type = moe_quant_config.name()
else:
@@ -561,7 +564,7 @@ class FusedMoE(nn.Layer):
"""
load_state_dict function.
"""
if self.fd_config.model_config.is_quantized:
if self.is_quantized:
if getattr(self.fd_config.quant_config, "is_permuted", True):
self.quant_method.process_prequanted_weights(self, state_dict, is_rearrange)
else: