From a43dad2083a26ff9234a1fd96e9a0f6897818858 Mon Sep 17 00:00:00 2001 From: Kyle Sayers Date: Fri, 1 Nov 2024 13:19:37 -0400 Subject: [PATCH] apply style and quality (#201) --- src/compressed_tensors/quantization/lifecycle/forward.py | 4 ++-- src/compressed_tensors/quantization/utils/helpers.py | 2 -- tests/conftest.py | 5 ----- .../test_compressors/quantized_compressors/test_fp8_quant.py | 1 - .../quantized_compressors/test_pack_quant.py | 1 - .../sparse_quantized_compressors/test_marlin_24.py | 1 - tests/test_quantization/lifecycle/test_lifecycle.py | 1 - 7 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/compressed_tensors/quantization/lifecycle/forward.py b/src/compressed_tensors/quantization/lifecycle/forward.py index 19a22a39..dcab122a 100644 --- a/src/compressed_tensors/quantization/lifecycle/forward.py +++ b/src/compressed_tensors/quantization/lifecycle/forward.py @@ -14,7 +14,7 @@ from functools import wraps from math import ceil -from typing import Callable, Optional +from typing import Optional import torch from compressed_tensors.quantization.quant_args import ( @@ -28,7 +28,7 @@ calculate_range, compute_dynamic_scales_and_zp, ) -from compressed_tensors.utils import safe_permute, update_parameter_data +from compressed_tensors.utils import safe_permute from torch.nn import Module diff --git a/src/compressed_tensors/quantization/utils/helpers.py b/src/compressed_tensors/quantization/utils/helpers.py index 6f05524a..9f65ee33 100644 --- a/src/compressed_tensors/quantization/utils/helpers.py +++ b/src/compressed_tensors/quantization/utils/helpers.py @@ -233,7 +233,6 @@ def iter_named_leaf_modules(model: Module) -> Generator[Tuple[str, Module], None named_children, children = zip(*list(submodule.named_children())) has_non_observer_children = False for i in range(len(children)): - child = children[i] child_name = named_children[i] if "observer" not in child_name: @@ -268,7 +267,6 @@ def iter_named_quantizable_modules( has_non_observer_children = False for i in range(len(children)): child_name = named_children[i] - child = children[i] if "observer" not in child_name: has_non_observer_children = True diff --git a/tests/conftest.py b/tests/conftest.py index 97790458..a1c1d861 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,14 +13,9 @@ # limitations under the License. from math import ceil -from typing import Any, Iterable, Optional, Union import pytest import torch -from compressed_tensors.quantization.quant_args import ( - QuantizationArgs, - QuantizationStrategy, -) from compressed_tensors.quantization.utils import calculate_qparams from compressed_tensors.utils.offload import update_parameter_data diff --git a/tests/test_compressors/quantized_compressors/test_fp8_quant.py b/tests/test_compressors/quantized_compressors/test_fp8_quant.py index 4a253711..c131e216 100644 --- a/tests/test_compressors/quantized_compressors/test_fp8_quant.py +++ b/tests/test_compressors/quantized_compressors/test_fp8_quant.py @@ -25,7 +25,6 @@ QuantizationStatus, QuantizationStrategy, apply_quantization_config, - apply_quantization_status, ) from compressed_tensors.quantization.lifecycle.forward import fake_quantize from safetensors.torch import save_file diff --git a/tests/test_compressors/quantized_compressors/test_pack_quant.py b/tests/test_compressors/quantized_compressors/test_pack_quant.py index 834b482c..fde57c4b 100644 --- a/tests/test_compressors/quantized_compressors/test_pack_quant.py +++ b/tests/test_compressors/quantized_compressors/test_pack_quant.py @@ -30,7 +30,6 @@ QuantizationScheme, QuantizationStatus, apply_quantization_config, - apply_quantization_status, ) from compressed_tensors.quantization.lifecycle.forward import fake_quantize from compressed_tensors.quantization.quant_args import ActivationOrdering diff --git a/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py b/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py index c9fc678b..590b839c 100644 --- a/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py +++ b/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py @@ -29,7 +29,6 @@ QuantizationStatus, QuantizationStrategy, apply_quantization_config, - apply_quantization_status, ) from compressed_tensors.utils import mask_creator, merge_names from torch.nn.modules import Linear, Sequential diff --git a/tests/test_quantization/lifecycle/test_lifecycle.py b/tests/test_quantization/lifecycle/test_lifecycle.py index cabfee76..8f3e2dd0 100644 --- a/tests/test_quantization/lifecycle/test_lifecycle.py +++ b/tests/test_quantization/lifecycle/test_lifecycle.py @@ -14,7 +14,6 @@ from copy import deepcopy -import pytest import torch from compressed_tensors.quantization.lifecycle.initialize import ( initialize_module_for_quantization,