From 687a7afbdc579c2fe989f3298aa4e5c70461524c Mon Sep 17 00:00:00 2001 From: Xavier Dupre Date: Sat, 22 Jul 2023 10:36:10 +0200 Subject: [PATCH] lint --- onnxruntime/python/tools/quantization/calibrate.py | 2 +- onnxruntime/python/tools/quantization/onnx_model.py | 2 +- onnxruntime/test/python/quantization/test_op_gemm.py | 1 - pyproject.toml | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/onnxruntime/python/tools/quantization/calibrate.py b/onnxruntime/python/tools/quantization/calibrate.py index 5f841b445dba..46c9f07bd8f9 100644 --- a/onnxruntime/python/tools/quantization/calibrate.py +++ b/onnxruntime/python/tools/quantization/calibrate.py @@ -21,7 +21,7 @@ class TensorData: - _allowed = {"avg", "std", "lowest", "highest", "hist", "hist_edges"} + _allowed: set[str] = {"avg", "std", "lowest", "highest", "hist", "hist_edges"} def __init__(self, **kwargs): for k, v in kwargs.items(): diff --git a/onnxruntime/python/tools/quantization/onnx_model.py b/onnxruntime/python/tools/quantization/onnx_model.py index c51430b69497..c430d2aabd9d 100644 --- a/onnxruntime/python/tools/quantization/onnx_model.py +++ b/onnxruntime/python/tools/quantization/onnx_model.py @@ -297,7 +297,7 @@ def __replace_gemm_with_matmul(graph_path): if input.name == inputB: Bs_graph.input.remove(input) break - self._check(B_trans) + Bs_graph._check(B_trans) Bs_graph.initializer.extend([B_trans]) else: inputB += "_Transposed" # noqa: N806 diff --git a/onnxruntime/test/python/quantization/test_op_gemm.py b/onnxruntime/test/python/quantization/test_op_gemm.py index 8d300dec6e4a..bccfeeefa6e3 100644 --- a/onnxruntime/test/python/quantization/test_op_gemm.py +++ b/onnxruntime/test/python/quantization/test_op_gemm.py @@ -166,7 +166,6 @@ def static_quant_test( ["o", 0, activation_proto_qtype], ] } - qtop if activation_type_str == "f8e4m3fn" and weight_type_str == "f8e4m3fn": with open(model_int8_path, "rb") as f: diff --git a/pyproject.toml b/pyproject.toml index 54dadc2911af..7795de54a69c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,4 +87,4 @@ unfixable = [ "orttraining/orttraining/test/**" = ["N802"] # Function casing "tools/nuget/generate_nuspec_for_native_nuget.py" = ["ISC003"] # Too many errors to fix "onnxruntime/test/python/quantization/test_op_gemm.py" = ["N806"] # use of A for a matrix -"onnxruntime/test/python/quantization/op_test_utils.py" = ["N806"] # use of A for a matrix +"onnxruntime/test/python/quantization/op_test_utils.py" = ["N806", "PERF203", "RUF012"] # use of A for a matrix