From 281149b79d488b6573bc9d3618630a0939f308f4 Mon Sep 17 00:00:00 2001 From: Alexander Dokuchaev Date: Mon, 27 Jan 2025 17:43:27 +0200 Subject: [PATCH] Fix fail on macos (#3215) ### Changes - Skip `test_non_convertable_division` on MacOS - Cut values to 1e-10, more digits after zero dont change a result - Use onle line `pip install` in gha ### Reason for changes https://github.com/openvinotoolkit/nncf/actions/runs/12969549430/job/36208496733 ``` FAILED tests/openvino/native/test_node_utils.py::test_non_convertable_division[0.058599039912223816-15-True-0.003906603] - AssertionError: Not equal to tolerance rtol=0, atol=0 Mismatched elements: 1 / 1 (100%) Max absolute difference among violations: 3.5297126e-07 Max relative difference among violations: 9.035248e-05 ACTUAL: array([0.003906], dtype=float32) DESIRED: array([0.003907], dtype=float32) FAILED tests/openvino/native/test_node_utils.py::test_non_convertable_division[0.058599039912223816-15-False-0.003906602505594492] - AssertionError: Not equal to tolerance rtol=0, atol=0 Mismatched elements: 1 / 1 (100%) Max absolute difference among violations: 3.525056e-07 Max relative difference among violations: 9.023329e-05 ACTUAL: array([0.003906], dtype=float32) DESIRED: array([0.003907], dtype=float32) ``` ### Tests https://github.com/openvinotoolkit/nncf/actions/runs/12991342528/job/36228616650 --------- Co-authored-by: Nikita Savelyev --- .github/workflows/macos.yml | 6 ++---- tests/openvino/native/test_node_utils.py | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6746db181d6..9a6b2174372 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -28,8 +28,7 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - pip install . - pip install -r tests/common/requirements.txt + pip install . -r tests/common/requirements.txt - name: Print installed modules run: pip list - name: Run pre-commit @@ -53,8 +52,7 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - pip install . - pip install -r tests/openvino/requirements.txt + pip install . -r tests/openvino/requirements.txt - name: Print installed modules run: pip list - name: Run pre-commit diff --git a/tests/openvino/native/test_node_utils.py b/tests/openvino/native/test_node_utils.py index a2e319d6a20..bcec4f22fc9 100644 --- a/tests/openvino/native/test_node_utils.py +++ b/tests/openvino/native/test_node_utils.py @@ -15,6 +15,7 @@ from openvino.runtime import opset13 as opset from nncf.common.graph.graph import NNCFNode +from nncf.common.utils.os import is_macos from nncf.openvino.graph.layer_attributes import OVLayerAttributes from nncf.openvino.graph.metatypes.openvino_metatypes import OVMatMulMetatype from nncf.openvino.graph.nncf_graph_builder import GraphConverter @@ -153,10 +154,11 @@ def test_get_weight_channel_axes_for_matmul(weights_port_id, transpose, shape, d @pytest.mark.parametrize( "a,b,convertable,ref_result", [ - (0.058599039912223816, 15, True, 0.003906603), - (0.058599039912223816, 15, False, 0.003906602505594492), + (0.0585990399, 15, True, 0.003906603), + (0.0585990399, 15, False, 0.0039066025), ], ) +@pytest.mark.skipif(is_macos(), reason="Not relevant for MacOS, returns 0.0039062500 in both cases.") def test_non_convertable_division(a, b, convertable, ref_result): a, b, ref_result = tuple(map(lambda x: np.array([x], np.float32), [a, b, ref_result])) a_param = opset.parameter((-1,), ov.Type.f32)