Skip to content

Commit 25cf29a

Browse files
[FIX] Qwen2.5 vl quant (#1623)
* add language_model * fix layer hook
1 parent 17c37de commit 25cf29a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

gptqmodel/models/definitions/base_qwen2_vl.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class BaseQwen2VLGPTQ(BaseGPTQModel):
3232
base_modules = ["model.embed_tokens", "model.norm"]
3333
pre_lm_head_norm_module = "model.norm"
3434

35-
layers_node = ["model.layers"]
35+
layers_node = ["model.layers", "model.language_model.layers"]
3636

3737
layer_modules = [
3838
["self_attn.k_proj", "self_attn.v_proj", "self_attn.q_proj"],
@@ -41,16 +41,22 @@ class BaseQwen2VLGPTQ(BaseGPTQModel):
4141
["mlp.down_proj"],
4242
]
4343

44-
layers_modules_tree = [
45-
"model",
46-
"layers",
44+
branch = [
4745
"#",
4846
{
4947
"self_attn": ("k_proj", "v_proj", "q_proj", "o_proj"),
5048
"mlp": ("up_proj", "gate_proj", "down_proj"),
5149
}
5250
]
5351

52+
layers_modules_tree = [
53+
"model",
54+
{
55+
"layers": branch,
56+
"language_model": {"layers": branch},
57+
}
58+
]
59+
5460
modality = [MODALITY.TEXT, MODALITY.IMAGE_TO_TEXT]
5561

5662
require_load_processor = True

gptqmodel/nn_modules/hooked_linear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def replace_module_with_hooked_tree(module, tree: Union[List,Dict] = [], level:
258258
if isinstance(tree[name], Tuple) and name in tree[name]:
259259
# do replace if name in tree and tree is a tuple
260260
_replace_module(module, child, name, level, debug)
261-
elif isinstance(tree[name], (Dict, Tuple)):
261+
elif isinstance(tree[name], (Dict, Tuple, List)):
262262
# follow tree node if name in tree and tree is a dict
263263
if debug:
264264
log.info(f"{level_indent} Hook: follow tree node: {name} -> nest into {name}")

0 commit comments

Comments
 (0)