From d17f8ee7336b3b3ca3e6ca2574863e3eb1dc62b3 Mon Sep 17 00:00:00 2001 From: Vasily Shamporov Date: Mon, 23 Oct 2023 13:18:19 +0200 Subject: [PATCH] mt --- examples/experimental/openvino/bert/main.py | 2 +- nncf/quantization/algorithms/bias_correction/onnx_backend.py | 1 - .../algorithms/bias_correction/openvino_backend.py | 1 - nncf/quantization/algorithms/min_max/onnx_backend.py | 1 - nncf/quantization/algorithms/min_max/openvino_backend.py | 1 - nncf/quantization/algorithms/min_max/torch_backend.py | 1 - tests/torch/sparsity/movement/helpers/run_recipe.py | 2 +- tests/torch/sparsity/movement/helpers/trainer.py | 2 +- tests/torch/sparsity/movement/test_model_saving.py | 2 +- tests/torch/sparsity/movement/training_scripts/run_glue.py | 3 +-- 10 files changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/experimental/openvino/bert/main.py b/examples/experimental/openvino/bert/main.py index 34dd31094b5..ea7a3772430 100644 --- a/examples/experimental/openvino/bert/main.py +++ b/examples/experimental/openvino/bert/main.py @@ -13,13 +13,13 @@ from pathlib import Path from typing import Any, Iterable +import datasets import evaluate import numpy as np import openvino.runtime as ov import torch import transformers -import datasets import nncf from nncf.parameters import ModelType diff --git a/nncf/quantization/algorithms/bias_correction/onnx_backend.py b/nncf/quantization/algorithms/bias_correction/onnx_backend.py index a6be54a2355..4923de26111 100644 --- a/nncf/quantization/algorithms/bias_correction/onnx_backend.py +++ b/nncf/quantization/algorithms/bias_correction/onnx_backend.py @@ -35,7 +35,6 @@ from nncf.quantization.algorithms.bias_correction.backend import BiasCorrectionAlgoBackend -@ALGO_BACKENDS.register(BackendType.ONNX) class ONNXBiasCorrectionAlgoBackend(BiasCorrectionAlgoBackend): @property def tensor_processor(self) -> ONNXNNCFCollectorTensorProcessor: diff --git a/nncf/quantization/algorithms/bias_correction/openvino_backend.py b/nncf/quantization/algorithms/bias_correction/openvino_backend.py index 0f38da3cc2f..15dd12e9698 100644 --- a/nncf/quantization/algorithms/bias_correction/openvino_backend.py +++ b/nncf/quantization/algorithms/bias_correction/openvino_backend.py @@ -35,7 +35,6 @@ from nncf.quantization.algorithms.bias_correction.backend import BiasCorrectionAlgoBackend -@ALGO_BACKENDS.register(BackendType.OPENVINO) class OVBiasCorrectionAlgoBackend(BiasCorrectionAlgoBackend): @property def tensor_processor(self) -> OVNNCFCollectorTensorProcessor: diff --git a/nncf/quantization/algorithms/min_max/onnx_backend.py b/nncf/quantization/algorithms/min_max/onnx_backend.py index 16c033c81c1..dc1f79d9bb9 100644 --- a/nncf/quantization/algorithms/min_max/onnx_backend.py +++ b/nncf/quantization/algorithms/min_max/onnx_backend.py @@ -43,7 +43,6 @@ from nncf.quantization.range_estimator import RangeEstimatorParameters -@ALGO_BACKENDS.register(BackendType.ONNX) class ONNXMinMaxAlgoBackend(MinMaxAlgoBackend): @property def mat_mul_metatypes(self) -> List[OperatorMetatype]: diff --git a/nncf/quantization/algorithms/min_max/openvino_backend.py b/nncf/quantization/algorithms/min_max/openvino_backend.py index 9c8b833c69c..096d0cc111f 100644 --- a/nncf/quantization/algorithms/min_max/openvino_backend.py +++ b/nncf/quantization/algorithms/min_max/openvino_backend.py @@ -43,7 +43,6 @@ from nncf.quantization.fake_quantize import FakeQuantizeParameters -@ALGO_BACKENDS.register(BackendType.OPENVINO) class OVMinMaxAlgoBackend(MinMaxAlgoBackend): @property def mat_mul_metatypes(self) -> List[OperatorMetatype]: diff --git a/nncf/quantization/algorithms/min_max/torch_backend.py b/nncf/quantization/algorithms/min_max/torch_backend.py index f0fb7415124..b941a9ed279 100644 --- a/nncf/quantization/algorithms/min_max/torch_backend.py +++ b/nncf/quantization/algorithms/min_max/torch_backend.py @@ -47,7 +47,6 @@ from nncf.torch.tensor_statistics.statistics import PTMinMaxTensorStatistic -@ALGO_BACKENDS.register(BackendType.TORCH) class PTMinMaxAlgoBackend(MinMaxAlgoBackend): TARGET_TYPE_TO_PT_INS_TYPE_MAP = { TargetType.PRE_LAYER_OPERATION: TargetType.OPERATOR_PRE_HOOK, diff --git a/tests/torch/sparsity/movement/helpers/run_recipe.py b/tests/torch/sparsity/movement/helpers/run_recipe.py index 4afac63c7c8..5967e6c0c89 100644 --- a/tests/torch/sparsity/movement/helpers/run_recipe.py +++ b/tests/torch/sparsity/movement/helpers/run_recipe.py @@ -20,6 +20,7 @@ import torch.nn import torch.nn.functional as F import torch.utils.data +from datasets import Dataset from transformers import AutoModelForAudioClassification from transformers import AutoModelForImageClassification from transformers import AutoModelForSequenceClassification @@ -33,7 +34,6 @@ from transformers import SwinConfig from transformers import Wav2Vec2Config -from datasets import Dataset from nncf import NNCFConfig from nncf.experimental.torch.sparsity.movement.scheduler import MovementSchedulerParams from nncf.torch.dynamic_graph.graph_tracer import ModelInputInfo diff --git a/tests/torch/sparsity/movement/helpers/trainer.py b/tests/torch/sparsity/movement/helpers/trainer.py index ffab20c772f..83bc5d94575 100644 --- a/tests/torch/sparsity/movement/helpers/trainer.py +++ b/tests/torch/sparsity/movement/helpers/trainer.py @@ -14,6 +14,7 @@ import numpy as np import torch +from datasets import Dataset from transformers import TrainingArguments from transformers.trainer import Trainer from transformers.trainer_callback import TrainerCallback @@ -21,7 +22,6 @@ from transformers.trainer_callback import TrainerState from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR -from datasets import Dataset from nncf.api.compression import CompressionAlgorithmController from nncf.common.compression import BaseCompressionAlgorithmController from nncf.common.utils.tensorboard import prepare_for_tensorboard diff --git a/tests/torch/sparsity/movement/test_model_saving.py b/tests/torch/sparsity/movement/test_model_saving.py index 557f64cf895..4da72441a74 100644 --- a/tests/torch/sparsity/movement/test_model_saving.py +++ b/tests/torch/sparsity/movement/test_model_saving.py @@ -18,6 +18,7 @@ import pytest import torch from addict import Dict +from datasets import Dataset from onnx import numpy_helper from openvino.runtime import Core from openvino.runtime import serialize @@ -28,7 +29,6 @@ from scipy.special import softmax from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR -from datasets import Dataset from nncf.torch import create_compressed_model from nncf.torch.checkpoint_loading import load_state from tests.torch.helpers import PTTensorListComparator diff --git a/tests/torch/sparsity/movement/training_scripts/run_glue.py b/tests/torch/sparsity/movement/training_scripts/run_glue.py index 9ead89557cb..4261fd0c54e 100644 --- a/tests/torch/sparsity/movement/training_scripts/run_glue.py +++ b/tests/torch/sparsity/movement/training_scripts/run_glue.py @@ -12,13 +12,12 @@ from pathlib import Path from typing import Dict, List, Optional, Tuple +import datasets import evaluate import jstyleson import numpy as np from transformers.training_args import ParallelMode -import datasets - # isort: off from nncf import NNCFConfig from nncf.api.compression import CompressionAlgorithmController