Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-malininn committed Jan 24, 2025
1 parent 08f5992 commit 89b3afc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions optimum/intel/openvino/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,8 @@ def to_nncf_dict(self) -> Dict[str, Any]:
overflow_fix=self.advanced_parameters["overflow_fix"],
)
if "smooth_quant_alphas" in self.advanced_parameters:
advanced_parameters.smooth_quant_alphas = (
nncf.AdvancedSmoothQuantParameters(**self.advanced_parameters["smooth_quant_alphas"]),
advanced_parameters.smooth_quant_alphas = nncf.AdvancedSmoothQuantParameters(
**self.advanced_parameters["smooth_quant_alphas"]
)

self._nncf_dict = {
Expand Down
14 changes: 13 additions & 1 deletion tests/openvino/test_exporters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ class OVCLIExportTestCase(unittest.TestCase):
(13,),
(16,),
),
(
"text-generation",
"llama",
"nf4_f8e4m3",
"--dataset wikitext2 --num-samples 1 --smooth-quant-alpha 0.9 --group-size 16 --trust-remote-code",
(4,),
(14,),
),
]

TEST_4BIT_CONFIGURATIONS = [
Expand Down Expand Up @@ -446,7 +454,11 @@ def test_exporters_cli_full_quantization(
for i, model in enumerate(models):
num_fake_nodes, num_weight_nodes = get_num_quantized_nodes(model)
self.assertEqual(expected_fake_nodes[i], num_fake_nodes)
self.assertEqual(expected_low_precision_nodes[i], num_weight_nodes[quant_mode])
weight_types = quant_mode.split("_")
num_weights = 0
for weight_type in weight_types:
num_weights += num_weight_nodes[weight_type]
self.assertEqual(expected_low_precision_nodes[i], num_weights)

def test_exporters_cli_int4_with_local_model_and_default_config(self):
with TemporaryDirectory() as tmpdir:
Expand Down

0 comments on commit 89b3afc

Please sign in to comment.