mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-16 13:41:30 +08:00
fix is_permuted (#3100)
This commit is contained in:
@@ -386,7 +386,7 @@ class FusedMoE(nn.Layer):
|
||||
self.gate_weight.set_value(gate_weight_tensor.astype("float32"))
|
||||
|
||||
if self.fd_config.model_config.is_quantized:
|
||||
if getattr(self.fd_config.quant_config, "is_permuted", False):
|
||||
if getattr(self.fd_config.quant_config, "is_permuted", True):
|
||||
self.quant_method.process_prequanted_weights(self, state_dict)
|
||||
else:
|
||||
self.quant_method.create_weights(self, state_dict)
|
||||
|
@@ -36,7 +36,7 @@ class MixQuantConfig(QuantConfigBase):
|
||||
image_moe_quant_type: str = None,
|
||||
is_channel_wise: bool = False,
|
||||
has_zero_point: bool = False,
|
||||
is_permuted: bool = False,
|
||||
is_permuted: bool = True,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.dense_quant_type = dense_quant_type
|
||||
@@ -65,7 +65,7 @@ class MixQuantConfig(QuantConfigBase):
|
||||
config.get("image_moe_quant_type", None),
|
||||
config.get("is_channel_wise", False),
|
||||
config.get("has_zero_point", False),
|
||||
config.get("is_permuted", False),
|
||||
config.get("is_permuted", True),
|
||||
)
|
||||
|
||||
def get_quant_method(self, layer) -> Optional[QuantMethodBase]:
|
||||
@@ -73,13 +73,13 @@ class MixQuantConfig(QuantConfigBase):
|
||||
if layer.moe_tag == "Image":
|
||||
return (
|
||||
get_quantization_config(self.image_moe_quant_type)
|
||||
.from_config(layer.fd_config.quant_config)
|
||||
.from_config({"is_permuted": self.is_permuted})
|
||||
.get_quant_method(layer)
|
||||
)
|
||||
else:
|
||||
return (
|
||||
get_quantization_config(self.moe_quant_type)
|
||||
.from_config(layer.fd_config.quant_config)
|
||||
.from_config({"is_permuted": self.is_permuted})
|
||||
.get_quant_method(layer)
|
||||
)
|
||||
elif isinstance(layer, Attention):
|
||||
|
@@ -34,7 +34,7 @@ class W4A8Config(QuantConfigBase):
|
||||
|
||||
@classmethod
|
||||
def from_config(cls, config: dict) -> "W4A8Config":
|
||||
is_permuted = getattr(config, "is_permuted", False)
|
||||
is_permuted = config.get("is_permuted", True)
|
||||
return cls(is_permuted)
|
||||
|
||||
def get_quant_method(self, layer) -> Optional[QuantMethodBase]:
|
||||
|
Reference in New Issue
Block a user