@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / cd49a05d5a
Fork 0

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, 09:15 UTC

[Refactor] Remove dead code (#42889)

Signed-off-by: yewentao256 <zhyanwentao@126.com>

Wentao Ye committed May 18, 2026 at 16:41 UTC cd49a05d5aa3cc296912297b3c2b577efe4183c8
5 files changed +2 -168
vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py
+2 -14
@@ -39,7 +39,6 @@ from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tenso
39 )
40 from vllm.model_executor.layers.quantization.compressed_tensors.schemes import (
41 WNA16_SUPPORTED_BITS,
42 - CompressedTensors24,
42 CompressedTensorsScheme,
43 CompressedTensorsW4A4Fp4,
44 CompressedTensorsW4A4Mxfp4,
@@ -760,19 +759,8 @@ class CompressedTensorsConfig(QuantizationConfig):
759 input_quant=input_quant,
760 sparsity_scheme=sparsity_scheme,
761 ):
763 - # Have a valid sparsity scheme
764 - # Validate layer is supported by Cutlass 2:4 Kernel
765 - model_compression_config = (
766 - None
767 - if sparsity_scheme is None or sparsity_scheme.format == "dense"
768 - else self.config
769 - )
770 -
771 - scheme = CompressedTensors24(
772 - quantized=weight_quant is not None or input_quant is not None,
773 - weight_quant=weight_quant,
774 - input_quant=input_quant,
775 - model_compression_config=model_compression_config,
762 + raise NotImplementedError(
763 + "Sparse24 models are no longer supported by vLLM."
764 )
765 elif weight_quant is None:
766 # Falling back to UnquantizedLinearMethod
vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py
-4
@@ -13,9 +13,6 @@ from .compressed_tensors_w8a8_mxfp8 import CompressedTensorsW8A8Mxfp8
13 from .compressed_tensors_w8a16_fp8 import CompressedTensorsW8A16Fp8
14 from .compressed_tensors_wNa16 import WNA16_SUPPORTED_BITS, CompressedTensorsWNA16
15
16 -# This avoids circular import error
17 -from .compressed_tensors_24 import CompressedTensors24 # isort: skip
18 -
16 __all__ = [
17 "CompressedTensorsScheme",
18 "CompressedTensorsWNA16",
@@ -23,7 +20,6 @@ __all__ = [
20 "CompressedTensorsW8A8Int8",
21 "CompressedTensorsW8A8Fp8",
22 "WNA16_SUPPORTED_BITS",
26 - "CompressedTensors24",
23 "CompressedTensorsW4A16Fp4",
24 "CompressedTensorsW4A4Mxfp4",
25 "CompressedTensorsW4A4Fp4",
vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py deleted
-54
@@ -1,54 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -
4 -from collections.abc import Callable
5 -from typing import Any
6 -
7 -import torch
8 -from compressed_tensors.quantization import (
9 - QuantizationArgs,
10 -)
11 -
12 -from vllm.model_executor.layers.quantization.compressed_tensors.schemes import (
13 - CompressedTensorsScheme,
14 -)
15 -
16 -__all__ = ["CompressedTensors24"]
17 -
18 -
19 -class CompressedTensors24(CompressedTensorsScheme):
20 - def __init__(
21 - self,
22 - quantized: bool = False,
23 - weight_quant: QuantizationArgs | None = None,
24 - input_quant: QuantizationArgs | None = None,
25 - model_compression_config: dict[str, Any] | None = None,
26 - ):
27 - raise NotImplementedError("Sparse24 models are no longer supported by vLLM")
28 -
29 - @classmethod
30 - def get_min_capability(cls) -> int:
31 - raise NotImplementedError("Sparse24 models are no longer supported by vLLM")
32 -
33 - def create_weights(
34 - self,
35 - layer: torch.nn.Module,
36 - input_size: int,
37 - output_partition_sizes: list[int],
38 - input_size_per_partition: int,
39 - params_dtype: torch.dtype,
40 - weight_loader: Callable,
41 - **kwargs,
42 - ):
43 - raise NotImplementedError("Sparse24 models are no longer supported by vLLM")
44 -
45 - def process_weights_after_loading(self, layer: torch.nn.Module) -> None:
46 - raise NotImplementedError("Sparse24 models are no longer supported by vLLM")
47 -
48 - def apply_weights(
49 - self,
50 - layer: torch.nn.Module,
51 - x: torch.Tensor,
52 - bias: torch.Tensor | None = None,
53 - ) -> torch.Tensor:
54 - raise NotImplementedError("Sparse24 models are no longer supported by vLLM")
vllm/model_executor/layers/quantization/schema.py deleted
-90
@@ -1,90 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -"""
4 -This file contains the Pydantic schemas for various quantization-related
5 -parameters. When a relevant quantization technique is specified, these
6 -parameters are loaded in the form of a JSON alongside the model weights
7 -and augment the model with additional information needed for use of that
8 -technique. The format of this JSON should be specified by one or more
9 -schemas contained here.
10 -
11 -For example, when the KV cache is quantized to FP8-E4M3 (currently only
12 -possible on ROCm), the model can be optionally augmented with KV cache
13 -scaling factors.
14 -"""
15 -
16 -from pydantic import BaseModel, ConfigDict, ValidationInfo, model_validator
17 -
18 -
19 -class KVCacheQuantSchema(BaseModel):
20 - dtype: str
21 - # Each key is a TP rank. Each value is a dictionary mapping a TP rank's
22 - # layer indices to their per-tensor KV cache scaling factor.
23 - # TODO: Consider pulling this and its validation methods out into its
24 - # own schema class (tricky as its members are variable)
25 - scaling_factor: dict[int, dict[int, float]]
26 -
27 - @model_validator(mode="after")
28 - def check_is_fp8(self) -> "KVCacheQuantSchema":
29 - assert self.dtype == "float8_e4m3fn", (
30 - "Loaded scaling factors intended for KV cache dtype = "
31 - f"{self.dtype} rather than float8_e4m3fn!"
32 - )
33 - return self
34 -
35 - @model_validator(mode="after")
36 - def check_tp_ranks(self, info: ValidationInfo) -> "KVCacheQuantSchema":
37 - context = info.context
38 - if context:
39 - tp_size = context["tp_size"]
40 - num_hidden_layers = context["num_hidden_layers"]
41 - assert len(self.scaling_factor) == tp_size, (
42 - f"Loaded dictionary has TP size {len(self.scaling_factor)} "
43 - f"but LLM engine is currently running with TP size {tp_size}."
44 - )
45 - for tp_rank, layer_maps in self.scaling_factor.items():
46 - assert len(layer_maps) == num_hidden_layers, (
47 - f"KV cache scales map for TP rank {tp_rank} is malformed. "
48 - f"Expected {num_hidden_layers} layers, got "
49 - f"{len(layer_maps)}."
50 - )
51 - for i in range(tp_size):
52 - assert i in self.scaling_factor, (
53 - f"KV cache scales map for TP rank {i} not found."
54 - )
55 - return self
56 -
57 - @model_validator(mode="after")
58 - def check_current_rank(self, info: ValidationInfo) -> "KVCacheQuantSchema":
59 - context = info.context
60 - if context:
61 - tp_rank = context["tp_rank"]
62 - num_hidden_layers = context["num_hidden_layers"]
63 - layer_scales_map = self.scaling_factor[tp_rank]
64 - for i in range(num_hidden_layers):
65 - assert i in layer_scales_map, (
66 - f"Could not find KV cache scales for layer {i} in "
67 - f"TP rank {tp_rank}."
68 - )
69 - return self
70 -
71 -
72 -class QuantParamSchema(BaseModel):
73 - # TODO: Generalize and extend with more fields
74 - # (e.g. weights/activations params) once functionality is enabled
75 - model_config = ConfigDict(protected_namespaces=())
76 - model_type: str | None
77 - kv_cache: KVCacheQuantSchema
78 -
79 - @model_validator(mode="after")
80 - def check_model_type(self, info: ValidationInfo) -> "QuantParamSchema":
81 - context = info.context
82 - if context:
83 - model_type = context.get("model_type", None)
84 - if model_type is not None:
85 - assert model_type == self.model_type, (
86 - f"Model type is {model_type} but loaded "
87 - f"scaling factors belonging to different "
88 - f"model type {self.model_type}!"
89 - )
90 - return self
vllm/model_executor/layers/quantization/turboquant/quantizer.py deleted
-6
@@ -1,6 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -"""TurboQuant quantizer utilities.
4 -
5 -Triton kernels handle all quantization, packing, and dequantization on GPU.
6 -"""