A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 05:30 UTC
Remove additional dead code as a follow-up to #42889 (#43144)
Signed-off-by: Dipika Sikka <dipikasikka1@gmail.com>
Dipika Sikka committed
May 20, 2026 at 10:01 UTC
df84fb07a6e57969941841c6363d1efbac1ba1e8
2 files changed
+13
-108
tests/quantization/test_compressed_tensors.py
-2
@@ -589,8 +589,6 @@ def _make_ct_config(*, target: str = "Linear") -> CompressedTensorsConfig:
589
},
590
ignore=[],
591
quant_format="pack-quantized",
592
- sparsity_scheme_map={},
593
- sparsity_ignore_list=[],
592
)
593
594
vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py
+13
-106
@@ -5,11 +5,7 @@ from functools import partial
5
from typing import TYPE_CHECKING, Any, Literal, cast
6
7
import torch
8
-from compressed_tensors.config import (
9
- CompressionFormat,
10
- SparsityCompressionConfig,
11
- SparsityStructure,
12
-)
8
+from compressed_tensors.config import CompressionFormat, SparsityCompressionConfig
9
from compressed_tensors.quantization import (
10
QuantizationArgs,
11
QuantizationStrategy,
@@ -81,8 +77,6 @@ class CompressedTensorsConfig(QuantizationConfig):
77
target_scheme_map: dict[str, Any],
78
ignore: list[str],
79
quant_format: str,
84
- sparsity_scheme_map: dict[str, SparsityCompressionConfig],
85
- sparsity_ignore_list: list[str],
80
kv_cache_scheme: dict[str, Any] | None = None,
81
config: dict[str, Any] | None = None,
82
transform_config: dict[str, Any] | None = None,
@@ -95,8 +89,6 @@ class CompressedTensorsConfig(QuantizationConfig):
89
# Map from [target -> scheme]
90
self.target_scheme_map = target_scheme_map
91
self.kv_cache_scheme = kv_cache_scheme
98
- self.sparsity_scheme_map = sparsity_scheme_map
99
- self.sparsity_ignore_list = sparsity_ignore_list
92
self.config = config
93
self.total_num_heads = total_num_heads
94
self.total_num_kv_heads = total_num_kv_heads
@@ -147,8 +139,6 @@ class CompressedTensorsConfig(QuantizationConfig):
139
140
self.target_scheme_map = _apply_dict(self.target_scheme_map)
141
self.ignore = _apply_list(self.ignore)
150
- self.sparsity_scheme_map = _apply_dict(self.sparsity_scheme_map)
151
- self.sparsity_ignore_list = _apply_list(self.sparsity_ignore_list)
142
if self.kv_cache_scheme is not None:
143
self.kv_cache_scheme = _apply_dict(self.kv_cache_scheme)
144
@@ -233,16 +223,14 @@ class CompressedTensorsConfig(QuantizationConfig):
223
ignore: list[str] = cast(list[str], config.get("ignore", []))
224
quant_format = cast(str, config.get("format"))
225
target_scheme_map = cls._quantization_scheme_map_from_config(config=config)
236
- sparsity_scheme_map, sparsity_ignore_list = cls._parse_sparsity_config(
237
- config=config
238
- )
226
+
227
+ # Check for deprecated sparsity config
228
+ cls._parse_sparsity_config(config=config)
229
230
return cls(
231
target_scheme_map=target_scheme_map,
232
ignore=ignore,
233
quant_format=quant_format,
244
- sparsity_scheme_map=sparsity_scheme_map,
245
- sparsity_ignore_list=sparsity_ignore_list,
234
config=config,
235
transform_config=config.get("transform_config"),
236
kv_cache_scheme=config.get("kv_cache_scheme"),
@@ -269,6 +257,14 @@ class CompressedTensorsConfig(QuantizationConfig):
257
target: sparsity_config for target in sparsity_config.targets or list()
258
}
259
sparsity_ignore_list = sparsity_config.ignore or list()
260
+
261
+ # Raise DeprecationError if non-empty sparse_scheme_map is detected
262
+ if sparse_scheme_map:
263
+ raise DeprecationWarning(
264
+ "Sparsity support has been removed from compressed-tensors. "
265
+ "Please use a model without sparsity configuration."
266
+ )
267
+
268
return sparse_scheme_map, sparsity_ignore_list
269
270
@classmethod
@@ -739,30 +735,7 @@ class CompressedTensorsConfig(QuantizationConfig):
735
input_quant = scheme_dict.get("input_activations")
736
format = scheme_dict.get("format")
737
742
- # Find the sparsity scheme of the layer
743
- # assume that fused layers inherit first component's sparsity scheme
744
- sparsity_targets = self.sparsity_scheme_map.keys() - set(
745
- self.sparsity_ignore_list
746
- )
747
- sparsity_scheme: SparsityCompressionConfig | None = None
748
- matched_target = find_matched_target(
749
- layer_name=layer_name,
750
- module=layer,
751
- targets=sparsity_targets,
752
- fused_mapping=self.packed_modules_mapping,
753
- )
754
- if matched_target is not None:
755
- sparsity_scheme = self.sparsity_scheme_map[matched_target]
756
-
757
- if self.supports_cutlass_24(
758
- weight_quant=weight_quant,
759
- input_quant=input_quant,
760
- sparsity_scheme=sparsity_scheme,
761
- ):
762
- raise NotImplementedError(
763
- "Sparse24 models are no longer supported by vLLM."
764
- )
765
- elif weight_quant is None:
738
+ if weight_quant is None:
739
# Falling back to UnquantizedLinearMethod
740
return None
741
@@ -826,72 +799,6 @@ class CompressedTensorsConfig(QuantizationConfig):
799
return True
800
return False
801
829
- @staticmethod
830
- def supports_cutlass_24(
831
- weight_quant: QuantizationArgs | None,
832
- input_quant: QuantizationArgs | None,
833
- sparsity_scheme: SparsityCompressionConfig | None = None,
834
- ) -> bool:
835
- """
836
- Check if the layer is supported by the Cutlass 2:4 Kernel
837
- Conditions:
838
- - Overarching condition: Sparsity Structure is 2:4
839
- - Unquantized cases are supported
840
- - Weight only quantization is not-supported
841
- - Supported weight quantization strategies are TENSOR and CHANNEL
842
- - Supported input quantization strategies are TENSOR and TOKEN
843
- - Only 8 bit quantization is supported
844
-
845
- :return: True if the layer is supported by the Cutlass 2:4 Kernel
846
- False otherwise
847
- """
848
- if sparsity_scheme is None:
849
- return False
850
-
851
- is_valid_sparsity_structure: bool = (
852
- sparsity_scheme.sparsity_structure == SparsityStructure.TWO_FOUR.value
853
- )
854
-
855
- valid_compressors = {
856
- CompressionFormat.dense.value,
857
- CompressionFormat.sparse_24_bitmask.value,
858
- }
859
-
860
- is_valid_sparsity = (
861
- is_valid_sparsity_structure and sparsity_scheme.format in valid_compressors
862
- )
863
-
864
- if not is_valid_sparsity:
865
- return False
866
-
867
- # Unquantized cases are supported
868
- if weight_quant is None and input_quant is None:
869
- return True
870
-
871
- # Weight only quantization is not-supported
872
- if weight_quant is not None and input_quant is None:
873
- return False
874
-
875
- supported_weight_quant_strategies = [
876
- QuantizationStrategy.TENSOR.value,
877
- QuantizationStrategy.CHANNEL.value,
878
- ]
879
-
880
- assert weight_quant is not None
881
- assert input_quant is not None
882
- if weight_quant.strategy not in supported_weight_quant_strategies:
883
- return False
884
-
885
- supported_input_quant_strategies = [
886
- QuantizationStrategy.TENSOR.value,
887
- QuantizationStrategy.TOKEN.value,
888
- ]
889
-
890
- if input_quant.strategy not in supported_input_quant_strategies:
891
- return False
892
-
893
- return weight_quant.num_bits == input_quant.num_bits == 8
894
-
802
803
class CompressedTensorsLinearMethod(LinearMethodBase):
804
def __init__(self, quantization_config: CompressedTensorsConfig):