Skip to content

Commit 4ee9d00

Browse files
authored
[AWQ] Remove Code to obtain Merge Node (#3621)
### Changes Remove Code to obtain Merge Node. Instead directly get the merge node from the match nodes. ### Reason for changes `Matmul1 -> mul -> Matmul2` pattern was causing an error when the precision for `Matmul1` was FP32. The first matmul node was not being found in `all_weight_params`. According to my experiments, in both the conditions for patterns `MatMul->Multiply->MatMul` and `Act->MatMul or Act->Multiply->MatMul` we essentially do the same task of obtaining the first node from the matched list of nodes. ### Tests Category | Job | Status | Job Number | Notes -- | -- | -- | -- | -- GH Examples | Examples | Pass| <a href="https://github.com/openvinotoolkit/nncf/actions/runs/16972167283">382</a> | GH WC | Weights Compression | Pass | <a href="https://github.com/openvinotoolkit/nncf/actions/runs/16972170869">137</a> | Perplexity Evaluation: Compression Settings: Ratio=0.8, Hessian Input Activation, backup_mode NONE Evaluation Settings: limit 10(evaluate with only 10 samples in lm_eval) Model: microsoft/Phi-3-mini-128k-instruct | Branch | AWQ | Accuracy | |--------|--------|--------| Develop Branch | No | 11.157 | Develop Branch | Yes | 11.0583 | After Change | Yes | 11.0583 | ### Related tickets 172326
1 parent 803b498 commit 4ee9d00

File tree

1 file changed

+1
-9
lines changed
  • src/nncf/quantization/algorithms/weight_compression

1 file changed

+1
-9
lines changed

src/nncf/quantization/algorithms/weight_compression/awq.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,7 @@ def _get_awq_data(
365365
if target_node.node_name in awq_data:
366366
continue
367367

368-
nncf_node = graph.get_node_by_key(match[0])
369-
370-
if self._backend_entity.is_node_with_weights(nncf_node, graph): # pattern MatMul->Multiply->MatMul
371-
merge_node_names = []
372-
for weight_op_friendly_name, _ in self._backend_entity.get_weight_names_and_port_ids(nncf_node, graph):
373-
merge_node_names.append(weight_op_friendly_name)
374-
merge_node = all_weight_params[name_mapping[merge_node_names[-1]]].node_with_weight
375-
else: # pattern Act->MatMul or Act->Multiply->MatMul
376-
merge_node = nncf_node
368+
merge_node = graph.get_node_by_key(match[0])
377369

378370
awq_data[target_node.node_name] = AWQCompressionInfo(weight_params, target_node, merge_node)
379371
return awq_data

0 commit comments

Comments
 (0)