Skip to content

Commit 35506a1

Browse files
committed
update mixtral's module_tree
Signed-off-by: ZX-ModelCloud <zx@modelcloud.ai>
1 parent 20fa143 commit 35506a1

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

gptqmodel/models/definitions/mixtral.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
# Contact: qubitium@modelcloud.ai, x.com/qubitium
55

66
from ..base import BaseQModel
7-
from ..moe_lifecycle import W1W3W2MoELifecycleHooks
7+
from ..moe_lifecycle import GateUpDownMoELifecycleHooks
88

99

1010
class MixtralQModel(BaseQModel):
1111
pre_lm_head_norm_module = "model.norm"
1212

13-
# MoE lifecycle hooks for w1/w3/w2 pattern
14-
moe_lifecycle_hooks = W1W3W2MoELifecycleHooks()
13+
dynamic_expert_index = "num_local_experts"
14+
15+
# MoE lifecycle hooks for gate_proj/up_proj/down_proj pattern
16+
moe_lifecycle_hooks = GateUpDownMoELifecycleHooks()
1517

1618
module_tree = [
1719
"model",
@@ -21,9 +23,9 @@ class MixtralQModel(BaseQModel):
2123
"input_layernorm": ("input_layernorm:!",),
2224
"self_attn": ("q_proj:0", "k_proj:0", "v_proj:0", "o_proj:1"),
2325
"post_attention_layernorm": ("post_attention_layernorm:!",),
24-
"block_sparse_moe:moe": {
26+
"mlp:moe:?": {
2527
"experts": {
26-
"#": ("w1:0", "w3:0", "w2:1"),
28+
"#": ("gate_proj:0", "up_proj:0", "down_proj:1"),
2729
}
2830
}
2931
}

tests/models/test_mixtral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class TestMixtral(ModelTest):
1212
NATIVE_MODEL_ID = "/monster/data/model/Mixtral-8x7B-Instruct-v0.1" # "mistralai/Mixtral-8x7B-Instruct-v0.1"
1313
NATIVE_ARC_CHALLENGE_ACC = 0.5213
1414
NATIVE_ARC_CHALLENGE_ACC_NORM = 0.5247
15-
TRUST_REMOTE_CODE = True
1615
EVAL_BATCH_SIZE = 6
1716
EVAL_TASKS = {
1817
EVAL.LM_EVAL.ARC_CHALLENGE: {
@@ -21,6 +20,7 @@ class TestMixtral(ModelTest):
2120
"acc_norm": {"value": NATIVE_ARC_CHALLENGE_ACC_NORM},
2221
},
2322
}
23+
OFFLOAD_TO_DISK = False # FIXME Currently, after defuser converted the model, OFFLOAD_TO_DISK must be False for quantization.
2424

2525
def test_mixtral(self):
2626
self.quant_lm_eval()

0 commit comments

Comments
 (0)