diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/activation_sampler.py b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/activation_sampler.py index 0d4084baea4..86df57e60af 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/activation_sampler.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/activation_sampler.py @@ -42,12 +42,12 @@ import numpy as np import onnxruntime as ort import onnx +from packaging import version from aimet_common.utils import AimetLogger from aimet_onnx.quantsim import QuantizationSimModel from aimet_onnx.utils import add_hook_to_get_activation, remove_activation_hooks, create_input_dict -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/adaround_optimizer.py b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/adaround_optimizer.py index 0d1edcbb455..b4babef579a 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/adaround_optimizer.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/adaround_optimizer.py @@ -44,6 +44,7 @@ import torch import torch.nn.functional as functional from torch.utils.data import Dataset +from packaging import version # Import AIMET specific modules from aimet_common.utils import AimetLogger @@ -56,7 +57,6 @@ from aimet_torch.adaround.adaround_tensor_quantizer import AdaroundTensorQuantizer from aimet_torch.adaround.adaround_optimizer import AdaroundOptimizer as TorchAdaroundOptimizer -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/utils.py b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/utils.py index e4365ad887f..318b5d10444 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/utils.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/adaround/utils.py @@ -38,10 +38,10 @@ from typing import Dict from collections import defaultdict import onnx +from packaging import version from aimet_onnx.meta.connectedgraph import ConnectedGraph -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/batch_norm_fold.py b/TrainingExtensions/onnx/src/python/aimet_onnx/batch_norm_fold.py index 7aac0b24339..69eb06789ac 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/batch_norm_fold.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/batch_norm_fold.py @@ -41,6 +41,7 @@ import numpy as np import onnx from onnx import numpy_helper +from packaging import version from aimet_common.bias_correction import ConvBnPatternHandler from aimet_common.graph_pattern_matcher import PatternType @@ -54,7 +55,6 @@ from aimet_onnx.meta.operations import Op from aimet_onnx.utils import get_node_attribute, remove_node, transpose_tensor, ParamUtils, retrieve_constant_input -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import NodeProto, TensorProto, ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py b/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py index eecf7c1b7b3..1e577aedc9f 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/cross_layer_equalization.py @@ -47,6 +47,7 @@ import onnx from onnx import numpy_helper from onnxruntime.quantization.onnx_quantizer import ONNXModel +from packaging import version from aimet_common.utils import AimetLogger from aimet_common.connected_graph.connectedgraph import get_ordered_ops @@ -59,7 +60,6 @@ from aimet_onnx.utils import transpose_tensor, ParamUtils, get_node_attribute, replace_relu6_with_relu from aimet_onnx.batch_norm_fold import BNLayer, fold_all_batch_norms_to_weight -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import NodeProto, ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py b/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py index ed9a75087bc..ef4e8741be2 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/layer_output_utils.py @@ -42,6 +42,7 @@ import numpy as np import onnxruntime as ort import onnx +from packaging import version from aimet_common.utils import AimetLogger from aimet_common.layer_output_utils import SaveInputOutput, save_layer_output_names @@ -49,7 +50,6 @@ from aimet_onnx.quantsim import QuantizationSimModel from aimet_onnx.utils import create_input_dict, add_hook_to_get_activation -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/meta/connectedgraph.py b/TrainingExtensions/onnx/src/python/aimet_onnx/meta/connectedgraph.py index f8b17ad7f30..eccc936834b 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/meta/connectedgraph.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/meta/connectedgraph.py @@ -47,6 +47,7 @@ from typing import List, Union, Dict from onnxruntime.quantization.onnx_quantizer import ONNXModel import onnx +from packaging import version from aimet_common.connected_graph.connectedgraph import ConnectedGraph as AimetCommonConnectedGraph, get_ordered_ops from aimet_common.utils import AimetLogger @@ -55,7 +56,6 @@ from aimet_onnx.meta.product import Product from aimet_onnx.utils import ParamUtils, retrieve_constant_input -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto, NodeProto, TensorProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/meta/utils.py b/TrainingExtensions/onnx/src/python/aimet_onnx/meta/utils.py index 4b3d2cd35b9..a4bec325c11 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/meta/utils.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/meta/utils.py @@ -37,10 +37,10 @@ """ Utilities for ONNX Connected Graph """ from typing import Dict, List import onnx +from packaging import version from aimet_onnx.meta.connectedgraph import ConnectedGraph -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim.py b/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim.py index 9cd1dc65222..90a1afd56a9 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim.py @@ -46,6 +46,7 @@ import onnxruntime as ort from onnxruntime import SessionOptions, GraphOptimizationLevel, InferenceSession from onnxruntime.quantization.onnx_quantizer import ONNXModel +from packaging import version from aimet_common import libpymo from aimet_common import libquant_info @@ -60,7 +61,6 @@ from aimet_onnx.quantsim_config.quantsim_config import QuantSimConfigurator from aimet_onnx.utils import make_dummy_input, add_hook_to_get_activation, remove_activation_hooks -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim_config/quantsim_config.py b/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim_config/quantsim_config.py index 2bb944ec3d3..6f0849e7021 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim_config/quantsim_config.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/quantsim_config/quantsim_config.py @@ -39,6 +39,7 @@ from typing import List, Dict, Tuple import onnx +from packaging import version from aimet_common.defs import QuantizationDataType from aimet_common.graph_searcher import GraphSearcher @@ -52,7 +53,6 @@ from aimet_onnx.utils import get_product_name_from_quantized_name from aimet_onnx.qc_quantize_op import OpMode, QcQuantizeOp -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import ModelProto, NodeProto diff --git a/TrainingExtensions/onnx/src/python/aimet_onnx/utils.py b/TrainingExtensions/onnx/src/python/aimet_onnx/utils.py index 30a55968516..de2adced49f 100644 --- a/TrainingExtensions/onnx/src/python/aimet_onnx/utils.py +++ b/TrainingExtensions/onnx/src/python/aimet_onnx/utils.py @@ -43,9 +43,10 @@ import numpy as np import onnx from onnx import helper, numpy_helper, mapping +from packaging import version + from aimet_common.utils import AimetLogger -from packaging import version # pylint: disable=no-name-in-module, ungrouped-imports if version.parse(onnx.__version__) >= version.parse("1.14.0"): from onnx import NodeProto, TensorProto, ModelProto, GraphProto, ValueInfoProto