Skip to content

Commit 341c4a8

Browse files
committedMar 19, 2025
Update
1 parent 93c9cef commit 341c4a8

File tree

3 files changed

+14
-37
lines changed

3 files changed

+14
-37
lines changed
 

‎nncf/quantization/algorithms/weight_compression/gptq.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ def _quantize_weights(
215215
"""
216216
if wc_params.node_with_weight.metatype in self._backend_entity.convolution_metatypes:
217217
msg = "Convolution metatypes are not supported"
218-
raise nncf.UnsupportedModelError(msg)
218+
raise RuntimeError(msg)
219219
if not wc_params.node_with_weight.layer_attributes.constant_attributes[wc_params.weight_port_id]["transpose"]:
220220
msg = "Transpose is not supported"
221-
raise nncf.UnsupportedModelError(msg)
221+
raise RuntimeError(msg)
222222

223223
weight_tensor = self._backend_entity.get_weight(
224224
wc_params.node_with_weight, wc_params.weight_port_id, model, graph

‎nncf/quantization/algorithms/weight_compression/scale_estimation.py

-7
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ def apply(
117117
scales, zero_points = dict(), dict()
118118

119119
for wp in track(all_weight_params, description="Applying Scale Estimation"):
120-
if (
121-
wp.node_with_weight.metatype in self._backend_entity.matmul_metatypes
122-
and not wp.node_with_weight.layer_attributes.constant_attributes[wp.weight_port_id]["transpose"]
123-
):
124-
msg = "Transpose is not supported"
125-
raise nncf.UnsupportedModelError(msg)
126-
127120
weight_name = wp.weight_name
128121
node_name = wp.node_with_weight.node_name
129122
config = wp.compression_config

‎tests/openvino/native/quantization/test_weights_compression.py

+12-28
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import inspect
1313
import os
14-
from contextlib import nullcontext
1514
from typing import Callable, Dict, List, Optional
1615

1716
import numpy as np
@@ -1458,16 +1457,6 @@ def test_compression_with_different_algo_combinations(input_shape, kwargs):
14581457
)
14591458

14601459

1461-
@pytest.mark.parametrize(
1462-
("transpose_a", "transpose_b", "raises_error"),
1463-
(
1464-
(False, True, False),
1465-
(True, True, False),
1466-
(False, False, True),
1467-
(True, False, True),
1468-
),
1469-
ids=["tb_nota", "ta_tb", "nota_notb", "ta_notb"],
1470-
)
14711460
@pytest.mark.parametrize(
14721461
"kwargs",
14731462
(
@@ -1482,27 +1471,22 @@ def test_compression_with_different_algo_combinations(input_shape, kwargs):
14821471
),
14831472
ids=["se", "lora", "gptq_se_awq"],
14841473
)
1485-
def test_compression_with_transpose(transpose_a, transpose_b, raises_error, kwargs):
1474+
def test_compression_with_transpose(kwargs):
14861475
dataset_size = 4
1487-
model = LMLinearModel(transpose_a=transpose_a, transpose_b=transpose_b).ov_model
1476+
model = LMLinearModel(transpose_a=True, transpose_b=True).ov_model
14881477
input_data = [np.ones(inp.shape) for inp in model.inputs] * dataset_size
14891478
dataset = Dataset(input_data)
14901479

1491-
with (
1492-
pytest.raises(nncf.UnsupportedModelError)
1493-
if raises_error and not kwargs.get("lora_correction", False)
1494-
else nullcontext()
1495-
):
1496-
compress_weights(
1497-
model,
1498-
mode=CompressWeightsMode.INT4_SYM,
1499-
ratio=1.0,
1500-
group_size=8,
1501-
subset_size=2,
1502-
dataset=dataset,
1503-
all_layers=True,
1504-
**kwargs,
1505-
)
1480+
compress_weights(
1481+
model,
1482+
mode=CompressWeightsMode.INT4_SYM,
1483+
ratio=1.0,
1484+
group_size=8,
1485+
subset_size=2,
1486+
dataset=dataset,
1487+
all_layers=True,
1488+
**kwargs,
1489+
)
15061490

15071491

15081492
class TestOVTemplateWeightCompression(TemplateWeightCompression):

0 commit comments

Comments
 (0)