diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml new file mode 100644 index 00000000000..c12491a5f75 --- /dev/null +++ b/.github/workflows/install.yml @@ -0,0 +1,93 @@ +name: Test install +permissions: read-all + +on: + workflow_dispatch: + inputs: + pull_request_number: + description: 'The pull request number' + default: '' + schedule: + - cron: '0 0 * * *' + +jobs: + install-cpu: + name: Test install [${{ matrix.backend }} - ${{ matrix.runner }}] + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + backend: ["torch", "tf", "onnx", "openvino"] + runner: ["windows-latest", "ubuntu-22.04"] + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + lfs: true + fetch-depth: 0 # Fetch full history to allow checking out any branch or PR + - name: Fetch and Checkout the Pull Request Branch + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + run: | + git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }} + git checkout pr-${{ github.event.inputs.pull_request_number }} + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 + with: + python-version: "3.10" + cache: pip + - name: Install test requirements + run: | + pip install -r tests/cross_fw/examples/requirements.txt + - name: Print installed modules + run: pip list + - name: Run install test scope + run: pytest tests/cross_fw/install -rA -s --host-configuration cpu --backend ${{ matrix.backend }} + + install-torch-gpu: + name: Test install [torch - ubuntu-gpu] + defaults: + run: + shell: bash + runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4 + env: + DEBIAN_FRONTEND: noninteractive + steps: + - name: Install dependencies + run : | + sudo apt-get update + sudo apt-get --assume-yes install build-essential ninja-build libgl1-mesa-dev libglib2.0-0 wget make virtualenv + - name: Download CUDA + run: | + wget -q https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run + sudo sh cuda_12.4.0_550.54.14_linux.run --toolkit --silent + - name: Runner info + continue-on-error: true + run: | + export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}} + export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + nvidia-smi + cat /proc/cpuinfo + nvcc --version + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + lfs: true + - name: Fetch and Checkout the Pull Request Branch + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + run: | + git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }} + git checkout pr-${{ github.event.inputs.pull_request_number }} + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 + with: + python-version: 3.10.14 + cache: pip + - name: Install test requirements + run: | + pip install -r tests/cross_fw/examples/requirements.txt + - name: Print installed modules + run: pip list + - name: Run install test scope + run: | + export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}} + export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + pytest tests/cross_fw/install -rA -s --host-configuration gpu --backend torch diff --git a/tests/cross_fw/examples/test_examples.py b/tests/cross_fw/examples/test_examples.py index 486a20aa45f..bbfe1cbe6ac 100644 --- a/tests/cross_fw/examples/test_examples.py +++ b/tests/cross_fw/examples/test_examples.py @@ -22,7 +22,7 @@ from tests.cross_fw.shared.helpers import create_venv_with_nncf from tests.cross_fw.shared.helpers import get_pip_executable_with_venv from tests.cross_fw.shared.helpers import get_python_executable_with_venv -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.json import load_json from tests.cross_fw.shared.paths import PROJECT_ROOT from tests.cross_fw.shared.paths import TEST_ROOT diff --git a/tests/cross_fw/install/test_install.py b/tests/cross_fw/install/test_install.py index 7d43a71df82..e335c357c67 100644 --- a/tests/cross_fw/install/test_install.py +++ b/tests/cross_fw/install/test_install.py @@ -17,9 +17,6 @@ import pytest -import nncf -from nncf.common.utils.os import is_linux -from nncf.common.utils.os import is_windows from tests.cross_fw.install.conftest import TESTED_BACKENDS from tests.cross_fw.shared.case_collection import skip_if_backend_not_selected from tests.cross_fw.shared.helpers import create_venv_with_nncf @@ -31,27 +28,9 @@ def run_install_checks(venv_path: Path, tmp_path: Path, package_type: str, backend: str, install_type: str): if install_type.lower() not in ["cpu", "gpu"]: - raise nncf.ValidationError("Unknown installation mode - must be either 'cpu' or 'gpu'") + raise ValueError("Unknown installation mode - must be either 'cpu' or 'gpu'") python_executable_with_venv = get_python_executable_with_venv(venv_path) - pip_with_venv = get_pip_executable_with_venv(venv_path) - - if package_type in ["build_s", "build_w"]: - # Do additional install step for sdist/bdist packages - def find_file_by_extension(directory: Path, extension: str) -> str: - for file_path in directory.iterdir(): - file_path_str = str(file_path) - if file_path_str.endswith(extension): - return file_path_str - raise FileNotFoundError("NNCF package not found") - - if package_type == "build_s": - package_path = find_file_by_extension(PROJECT_ROOT / "dist", ".tar.gz") - elif package_type == "build_w": - package_path = find_file_by_extension(PROJECT_ROOT / "dist", ".whl") - - run_cmd_line = f"{pip_with_venv} install {package_path}" - subprocess.run(run_cmd_line, check=True, shell=True) run_path = tmp_path / "run" install_checks_py_name = f"install_checks_{backend}.py" @@ -69,16 +48,17 @@ def find_file_by_extension(directory: Path, extension: str) -> str: ) -@pytest.fixture(name="venv_type", params=["virtualenv", "venv"]) -def venv_type_(request): +@pytest.fixture(name="package_type", params=["pip_local", "pip_git_develop", "pip_pypi", "build_s", "build_w"]) +def package_type_(request): return request.param -@pytest.fixture( - name="package_type", params=["pip_local", "pip_e_local", "pip_git_develop", "pip_pypi", "build_s", "build_w"] -) -def package_type_(request): - return request.param +@pytest.fixture +def removable_tmp_path(tmp_path: Path): + # The default tmp_path is automatically removed after some time, + # but we need to remove the venv after each test to avoid exceeding the space limit. + yield tmp_path + shutil.rmtree(tmp_path) @pytest.fixture(name="backend_to_test") @@ -96,9 +76,8 @@ def backend_to_test_(request, backend_clopt: List[str]): class TestInstall: @staticmethod def test_install( - tmp_path: Path, + removable_tmp_path: Path, backend: str, - venv_type: str, package_type: str, backend_clopt: List[str], host_configuration_clopt: str, @@ -107,34 +86,11 @@ def test_install( skip_if_backend_not_selected(backend, backend_clopt) if "pypi" in package_type: pytest.xfail("Disabled until NNCF is exposed in a release") - venv_path = create_venv_with_nncf(tmp_path, package_type, venv_type, {backend}) + venv_path = create_venv_with_nncf(removable_tmp_path, package_type, "venv", {backend}) if ov_version_override is not None: pip_with_venv = get_pip_executable_with_venv(venv_path) ov_version_cmd_line = f"{pip_with_venv} install {ov_version_override}" subprocess.run(ov_version_cmd_line, check=True, shell=True) - run_install_checks(venv_path, tmp_path, package_type, backend=backend, install_type=host_configuration_clopt) - - @staticmethod - def test_install_with_tests_requirements( - tmp_path: Path, - backend: str, - venv_type: str, - package_type: str, - backend_clopt: List[str], - host_configuration_clopt: str, - ): - skip_if_backend_not_selected(backend, backend_clopt) - if "pypi" in package_type: - pytest.xfail("Disabled until NNCF is exposed in a release") - venv_path = create_venv_with_nncf(tmp_path, package_type, venv_type, backends={backend}) - - if is_linux(): - pip_with_venv = f". {venv_path}/bin/activate && {venv_path}/bin/pip" - elif is_windows(): - pip_with_venv = f" {venv_path}\\Scripts\\activate && python -m pip" - - backend_name = "tensorflow" if backend == "tf" else backend - subprocess.check_call( - f"{pip_with_venv} install -r {PROJECT_ROOT}/tests/{backend_name}/requirements.txt", shell=True + run_install_checks( + venv_path, removable_tmp_path, package_type, backend=backend, install_type=host_configuration_clopt ) - run_install_checks(venv_path, tmp_path, package_type, backend=backend, install_type=host_configuration_clopt) diff --git a/tests/cross_fw/shared/comparator.py b/tests/cross_fw/shared/comparator.py new file mode 100644 index 00000000000..a3378a6ecd2 --- /dev/null +++ b/tests/cross_fw/shared/comparator.py @@ -0,0 +1,92 @@ +# Copyright (c) 2024 Intel Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from abc import ABC +from abc import abstractmethod +from typing import Callable, Dict, List, TypeVar, Union + +import numpy as np + +TensorType = TypeVar("TensorType") + + +class BaseTensorListComparator(ABC): + @classmethod + @abstractmethod + def _to_numpy(cls, tensor: TensorType) -> np.ndarray: + pass + + @classmethod + def _check_assertion( + cls, + test: Union[TensorType, List[TensorType]], + reference: Union[TensorType, List[TensorType]], + assert_fn: Callable[[np.ndarray, np.ndarray], bool], + ): + if not isinstance(test, list): + test = [test] + if not isinstance(reference, list): + reference = [reference] + assert len(test) == len(reference) + + for x, y in zip(test, reference): + x = cls._to_numpy(x) + y = cls._to_numpy(y) + assert_fn(x, y) + + @classmethod + def check_equal( + cls, + test: Union[TensorType, List[TensorType]], + reference: Union[TensorType, List[TensorType]], + rtol: float = 1e-1, + atol=0, + ): + cls._check_assertion(test, reference, lambda x, y: np.testing.assert_allclose(x, y, rtol=rtol, atol=atol)) + + @classmethod + def check_not_equal( + cls, + test: Union[TensorType, List[TensorType]], + reference: Union[TensorType, List[TensorType]], + rtol: float = 1e-4, + ): + cls._check_assertion( + test, + reference, + lambda x, y: np.testing.assert_raises(AssertionError, np.testing.assert_allclose, x, y, rtol=rtol), + ) + + @classmethod + def check_less( + cls, test: Union[TensorType, List[TensorType]], reference: Union[TensorType, List[TensorType]], rtol=1e-4 + ): + cls.check_not_equal(test, reference, rtol=rtol) + cls._check_assertion(test, reference, np.testing.assert_array_less) + + @classmethod + def check_greater( + cls, test: Union[TensorType, List[TensorType]], reference: Union[TensorType, List[TensorType]], rtol=1e-4 + ): + cls.check_not_equal(test, reference, rtol=rtol) + cls._check_assertion( + test, reference, lambda x, y: np.testing.assert_raises(AssertionError, np.testing.assert_array_less, x, y) + ) + + +def compare_stats(expected: Dict[str, np.ndarray], actual: Dict[str, np.ndarray]): + assert len(expected) == len(actual) + for ref_node_name, ref_stats in expected.items(): + actual_stats = actual[ref_node_name] + for param_name, ref_param in ref_stats.items(): + actual_param = actual_stats.get(param_name) + assert np.array(ref_param).shape == np.array(actual_param).shape + assert np.allclose(ref_param, actual_param, atol=1e-5) diff --git a/tests/cross_fw/shared/helpers.py b/tests/cross_fw/shared/helpers.py index 1b9b9ef2d66..eebe822973c 100644 --- a/tests/cross_fw/shared/helpers.py +++ b/tests/cross_fw/shared/helpers.py @@ -8,24 +8,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import json import subprocess import sys -from abc import ABC -from abc import abstractmethod -from copy import deepcopy from pathlib import Path -from typing import Callable, Dict, List, Set, TypeVar, Union +from typing import Callable, Set -import numpy as np - -import nncf -from nncf.common.utils.os import is_linux -from nncf.common.utils.os import is_windows from tests.cross_fw.shared.paths import GITHUB_REPO_URL from tests.cross_fw.shared.paths import PROJECT_ROOT -TensorType = TypeVar("TensorType") + +def is_windows() -> bool: + return "win32" in sys.platform + + +def is_linux() -> bool: + return "linux" in sys.platform def get_cli_dict_args(args): @@ -46,6 +43,14 @@ def get_cli_dict_args(args): } +def find_file_by_extension(directory: Path, extension: str) -> str: + for file_path in directory.iterdir(): + file_path_str = str(file_path) + if file_path_str.endswith(extension): + return file_path_str + raise FileNotFoundError("NNCF package not found") + + def create_venv_with_nncf(tmp_path: Path, package_type: str, venv_type: str, backends: Set[str] = None): venv_path = tmp_path / "venv" venv_path.mkdir() @@ -70,6 +75,12 @@ def create_venv_with_nncf(tmp_path: Path, package_type: str, venv_type: str, bac run_path = tmp_path / "run" run_path.mkdir() + if package_type in ["build_s", "build_w"]: + dist_path = tmp_path / "dist" + dist_path.mkdir(exist_ok=True) + build_path = tmp_path / "build" + build_path.mkdir(exist_ok=True) + if package_type == "pip_pypi": run_cmd_line = f"{pip_with_venv} install nncf" elif package_type == "pip_local": @@ -79,13 +90,19 @@ def create_venv_with_nncf(tmp_path: Path, package_type: str, venv_type: str, bac elif package_type == "pip_git_develop": run_cmd_line = f"{pip_with_venv} install git+{GITHUB_REPO_URL}@develop#egg=nncf" elif package_type == "build_s": - run_cmd_line = f"{python_executable_with_venv} -m build -s" + run_cmd_line = f"{python_executable_with_venv} -m build -s --outdir {dist_path}" elif package_type == "build_w": - run_cmd_line = f"{python_executable_with_venv} -m build -w" + run_cmd_line = f"{python_executable_with_venv} -m build -w --outdir {dist_path}" else: - raise nncf.ValidationError(f"Invalid package type: {package_type}") + raise ValueError(f"Invalid package type: {package_type}") subprocess.run(run_cmd_line, check=True, shell=True, cwd=PROJECT_ROOT) + + if package_type in ["build_s", "build_w"]: + package_path = find_file_by_extension(dist_path, ".tar.gz" if package_type == "build_s" else ".whl") + cmd_install_package = f"{pip_with_venv} install {package_path}" + subprocess.run(cmd_install_package, check=True, shell=True) + if backends: # Install backend specific packages with according version from constraints.txt packages = [item for b in backends for item in MAP_BACKEND_PACKAGES[b]] @@ -100,70 +117,6 @@ def create_venv_with_nncf(tmp_path: Path, package_type: str, venv_type: str, bac return venv_path -class BaseTensorListComparator(ABC): - @classmethod - @abstractmethod - def _to_numpy(cls, tensor: TensorType) -> np.ndarray: - pass - - @classmethod - def _check_assertion( - cls, - test: Union[TensorType, List[TensorType]], - reference: Union[TensorType, List[TensorType]], - assert_fn: Callable[[np.ndarray, np.ndarray], bool], - ): - if not isinstance(test, list): - test = [test] - if not isinstance(reference, list): - reference = [reference] - assert len(test) == len(reference) - - for x, y in zip(test, reference): - x = cls._to_numpy(x) - y = cls._to_numpy(y) - assert_fn(x, y) - - @classmethod - def check_equal( - cls, - test: Union[TensorType, List[TensorType]], - reference: Union[TensorType, List[TensorType]], - rtol: float = 1e-1, - atol=0, - ): - cls._check_assertion(test, reference, lambda x, y: np.testing.assert_allclose(x, y, rtol=rtol, atol=atol)) - - @classmethod - def check_not_equal( - cls, - test: Union[TensorType, List[TensorType]], - reference: Union[TensorType, List[TensorType]], - rtol: float = 1e-4, - ): - cls._check_assertion( - test, - reference, - lambda x, y: np.testing.assert_raises(AssertionError, np.testing.assert_allclose, x, y, rtol=rtol), - ) - - @classmethod - def check_less( - cls, test: Union[TensorType, List[TensorType]], reference: Union[TensorType, List[TensorType]], rtol=1e-4 - ): - cls.check_not_equal(test, reference, rtol=rtol) - cls._check_assertion(test, reference, np.testing.assert_array_less) - - @classmethod - def check_greater( - cls, test: Union[TensorType, List[TensorType]], reference: Union[TensorType, List[TensorType]], rtol=1e-4 - ): - cls.check_not_equal(test, reference, rtol=rtol) - cls._check_assertion( - test, reference, lambda x, y: np.testing.assert_raises(AssertionError, np.testing.assert_array_less, x, y) - ) - - def telemetry_send_event_test_driver(mocker, use_nncf_fn: Callable): from nncf.telemetry import telemetry @@ -172,39 +125,6 @@ def telemetry_send_event_test_driver(mocker, use_nncf_fn: Callable): telemetry_send_event_spy.assert_called() -def load_json(stats_path: Path): - with open(stats_path, "r", encoding="utf8") as json_file: - return json.load(json_file) - - -class NumpyEncoder(json.JSONEncoder): - """Special json encoder for numpy types""" - - def default(self, o): - if isinstance(o, np.integer): - return int(o) - if isinstance(o, np.floating): - return float(o) - if isinstance(o, np.ndarray): - return o.tolist() - return json.JSONEncoder.default(self, o) - - -def dump_to_json(local_path: Path, data: Dict[str, np.ndarray]): - with open(local_path, "w", encoding="utf8") as file: - json.dump(deepcopy(data), file, indent=4, cls=NumpyEncoder) - - -def compare_stats(expected: Dict[str, np.ndarray], actual: Dict[str, np.ndarray]): - assert len(expected) == len(actual) - for ref_node_name, ref_stats in expected.items(): - actual_stats = actual[ref_node_name] - for param_name, ref_param in ref_stats.items(): - actual_param = actual_stats.get(param_name) - assert np.array(ref_param).shape == np.array(actual_param).shape - assert np.allclose(ref_param, actual_param, atol=1e-5) - - def get_python_executable_with_venv(venv_path: Path) -> str: if is_linux(): python_executable_with_venv = f". {venv_path}/bin/activate && {venv_path}/bin/python" diff --git a/tests/cross_fw/shared/json.py b/tests/cross_fw/shared/json.py new file mode 100644 index 00000000000..263a00870f9 --- /dev/null +++ b/tests/cross_fw/shared/json.py @@ -0,0 +1,39 @@ +# Copyright (c) 2024 Intel Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import json +from copy import deepcopy +from pathlib import Path +from typing import Dict + +import numpy as np + + +def load_json(stats_path: Path): + with open(stats_path, "r", encoding="utf8") as json_file: + return json.load(json_file) + + +class NumpyEncoder(json.JSONEncoder): + """Special json encoder for numpy types""" + + def default(self, o): + if isinstance(o, np.integer): + return int(o) + if isinstance(o, np.floating): + return float(o) + if isinstance(o, np.ndarray): + return o.tolist() + return json.JSONEncoder.default(self, o) + + +def dump_to_json(local_path: Path, data: Dict[str, np.ndarray]): + with open(local_path, "w", encoding="utf8") as file: + json.dump(deepcopy(data), file, indent=4, cls=NumpyEncoder) diff --git a/tests/cross_fw/test_templates/test_calculate_quantizer_parameters.py b/tests/cross_fw/test_templates/test_calculate_quantizer_parameters.py index 791cdfad629..6c0169d8911 100644 --- a/tests/cross_fw/test_templates/test_calculate_quantizer_parameters.py +++ b/tests/cross_fw/test_templates/test_calculate_quantizer_parameters.py @@ -25,8 +25,8 @@ from nncf.quantization.fake_quantize import FakeQuantizeParameters from nncf.quantization.fake_quantize import calculate_quantizer_parameters from nncf.tensor import functions as fns -from tests.cross_fw.shared.helpers import dump_to_json -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.json import dump_to_json +from tests.cross_fw.shared.json import load_json FQ_CALCULATED_PARAMETERS_PATH = Path(__file__).parent / "fq_params" / "fq_params.json" diff --git a/tests/onnx/quantization/test_qdq_params_calculation.py b/tests/onnx/quantization/test_qdq_params_calculation.py index 9968706ecbd..c62f2d6afcc 100644 --- a/tests/onnx/quantization/test_qdq_params_calculation.py +++ b/tests/onnx/quantization/test_qdq_params_calculation.py @@ -18,8 +18,8 @@ from nncf.onnx.graph.onnx_helper import get_tensor_value from nncf.quantization.advanced_parameters import AdvancedQuantizationParameters from nncf.quantization.advanced_parameters import OverflowFix -from tests.cross_fw.shared.helpers import compare_stats -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.comparator import compare_stats +from tests.cross_fw.shared.json import load_json from tests.onnx.conftest import ONNX_TEST_ROOT from tests.onnx.models import EmbeddingModel from tests.onnx.models import GEMMTransposeWeightModel diff --git a/tests/openvino/native/quantization/test_fq_params_calculation.py b/tests/openvino/native/quantization/test_fq_params_calculation.py index 3053330cc77..5751a34f39b 100644 --- a/tests/openvino/native/quantization/test_fq_params_calculation.py +++ b/tests/openvino/native/quantization/test_fq_params_calculation.py @@ -21,8 +21,8 @@ from nncf.parameters import QuantizationMode from nncf.quantization.advanced_parameters import OverflowFix from nncf.quantization.algorithms.min_max.algorithm import MinMaxQuantization -from tests.cross_fw.shared.helpers import compare_stats -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.comparator import compare_stats +from tests.cross_fw.shared.json import load_json from tests.openvino.native.common import convert_torch_model from tests.openvino.native.common import get_actual_reference_for_current_openvino from tests.openvino.native.common import get_dataset_for_test diff --git a/tests/openvino/native/quantization/test_weights_compression.py b/tests/openvino/native/quantization/test_weights_compression.py index 541b8a386e5..7f8ccea21ec 100644 --- a/tests/openvino/native/quantization/test_weights_compression.py +++ b/tests/openvino/native/quantization/test_weights_compression.py @@ -44,9 +44,9 @@ from nncf.scopes import IgnoredScope from nncf.tensor import Tensor from nncf.tensor import TensorDataType -from tests.cross_fw.shared.helpers import compare_stats -from tests.cross_fw.shared.helpers import dump_to_json -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.comparator import compare_stats +from tests.cross_fw.shared.json import dump_to_json +from tests.cross_fw.shared.json import load_json from tests.openvino.native.common import get_actual_reference_for_current_openvino from tests.openvino.native.models import AWQActMatmulModel from tests.openvino.native.models import AWQMatmulModel diff --git a/tests/tensorflow/helpers.py b/tests/tensorflow/helpers.py index a7ab7e26803..83f783e6b84 100644 --- a/tests/tensorflow/helpers.py +++ b/tests/tensorflow/helpers.py @@ -20,7 +20,7 @@ from nncf import NNCFConfig from nncf.common.compression import BaseCompressionAlgorithmController from nncf.tensorflow.helpers.model_creation import create_compressed_model -from tests.cross_fw.shared.helpers import BaseTensorListComparator +from tests.cross_fw.shared.comparator import BaseTensorListComparator TensorType = Union[tf.Tensor, tf.Variable, np.ndarray, numbers.Number] diff --git a/tests/torch/helpers.py b/tests/torch/helpers.py index 1e3d102f2ed..f13492c8b7c 100644 --- a/tests/torch/helpers.py +++ b/tests/torch/helpers.py @@ -51,7 +51,7 @@ from nncf.torch.nncf_network import NNCFNetwork from nncf.torch.utils import get_all_modules_by_type from tests.cross_fw.shared.command import Command as BaseCommand -from tests.cross_fw.shared.helpers import BaseTensorListComparator +from tests.cross_fw.shared.comparator import BaseTensorListComparator TensorType = Union[torch.Tensor, np.ndarray, numbers.Number] diff --git a/tests/torch/ptq/test_fq_params_calculation.py b/tests/torch/ptq/test_fq_params_calculation.py index af5d061262b..6d71760cd33 100644 --- a/tests/torch/ptq/test_fq_params_calculation.py +++ b/tests/torch/ptq/test_fq_params_calculation.py @@ -25,8 +25,8 @@ from nncf.torch.nncf_network import NNCFNetwork from nncf.torch.quantization.layers import QUANTIZATION_MODULES from nncf.torch.utils import get_all_modules_by_type -from tests.cross_fw.shared.helpers import compare_stats -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.comparator import compare_stats +from tests.cross_fw.shared.json import load_json from tests.cross_fw.shared.paths import TEST_ROOT from tests.torch.helpers import TwoConvTestModel from tests.torch.helpers import create_random_mock_dataloader diff --git a/tests/torch/test_dataset_generators.py b/tests/torch/test_dataset_generators.py index 6e888232c5f..64447e55b87 100644 --- a/tests/torch/test_dataset_generators.py +++ b/tests/torch/test_dataset_generators.py @@ -15,7 +15,7 @@ import nncf from nncf.data import generate_text_data -from tests.cross_fw.shared.helpers import load_json +from tests.cross_fw.shared.json import load_json from tests.cross_fw.shared.paths import TEST_ROOT from tests.torch.helpers import set_torch_seed