mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[Feature] Add an unquantized option for MoE and Dense quant type (#4813)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user