@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / c02c758ea4
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 2, 18:15 UTC

[Deprecation] Deprecate functions as scheduled for v0.21.0 (#43358)

Signed-off-by: yewentao256 <zhyanwentao@126.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

Wentao Ye committed May 26, 2026 at 22:56 UTC c02c758ea4c5602dce39a5246b96ebd10c406c4b
4 files changed +21 -131
docs/contributing/profiling.md
+21 -19
@@ -201,43 +201,45 @@ The profiling traces generated by the continuous profiling workflow are publicly
201
202 The Python standard library includes
203 [cProfile](https://docs.python.org/3/library/profile.html) for profiling Python
204 -code. vLLM includes a couple of helpers that make it easy to apply it to a section of vLLM.
205 -Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_context` functions can be
206 -used to profile a section of code.
204 +code.
205
208 -!!! note
209 - The `vllm.utils.profiling` helpers are deprecated and will be removed in
210 - `v0.21`. Please use Python's `cProfile` module directly instead.
211 -
212 -### Example usage - decorator
206 +### Example usage - function call
207
214 -The first helper is a Python decorator that can be used to profile a function.
215 -If a filename is specified, the profile will be saved to that file. If no filename is
216 -specified, profile data will be printed to stdout.
208 +If a filename is specified, the profile will be saved to that file. If no
209 +filename is specified, profile data can be printed to stdout.
210
211 ```python
219 -from vllm.utils.profiling import cprofile
212 +import cProfile
213 +
214
221 -@cprofile("expensive_function.prof")
215 def expensive_function():
216 # some expensive code
217 pass
225 -```
218
227 -### Example Usage - context manager
219
229 -The second helper is a context manager that can be used to profile a block of
230 -code. Similar to the decorator, the filename is optional.
220 +profiler = cProfile.Profile()
221 +profiler.runcall(expensive_function)
222 +profiler.dump_stats("expensive_function.prof")
223 +```
224 +
225 +### Example usage - context manager style
226
227 ```python
233 -from vllm.utils.profiling import cprofile_context
228 +import cProfile
229 +
230
231 def another_function():
232 # more expensive code
233 pass
234
239 -with cprofile_context("another_function.prof"):
235 +
236 +profiler = cProfile.Profile()
237 +profiler.enable()
238 +try:
239 another_function()
240 +finally:
241 + profiler.disable()
242 + profiler.dump_stats("another_function.prof")
243 ```
244
245 ### Analyzing Profile Results
docs/models/pooling_models/classify.md
-4
@@ -299,7 +299,3 @@ Example configuration:
299 ### Remove softmax from PoolingParams
300
301 We have already removed `softmax` and `activation` from PoolingParams. Instead, use `use_activation`, since we allow `classify` and `token_classify` to use any activation function.
302 -
303 -### Remove `logit_bias` and `logit_scale`
304 -
305 -`logit_bias` and `logit_scale` are deprecated aliases for `logit_mean` and `logit_sigma` respectively. When using `logit_scale`, it is automatically converted to `logit_sigma = 1/logit_scale`. These deprecated parameters will be removed in v0.21.
vllm/config/pooler.py
-42
@@ -92,18 +92,6 @@ class PoolerConfig:
92 activation((logit - logit_mean) / logit_sigma). Defaults to None.
93 """
94
95 - # Deprecated aliases — will be removed in v0.21
96 - logit_bias: float | None = None
97 - """
98 - Deprecated: Use logit_mean instead. Will be removed in v0.21.
99 - """
100 -
101 - logit_scale: float | None = None
102 - """
103 - Deprecated: Use logit_sigma instead (note: logit_sigma = 1/logit_scale).
104 - Will be removed in v0.21.
105 - """
106 -
95 ## for reward models
96 step_tag_id: int | None = None
97 """
@@ -119,36 +107,6 @@ class PoolerConfig:
107 """
108
109 def __post_init__(self) -> None:
122 - # Handle deprecated logit_bias → logit_mean
123 - if self.logit_bias is not None:
124 - if self.logit_mean is not None:
125 - raise ValueError(
126 - "Cannot set both `logit_bias` and `logit_mean`. "
127 - "`logit_bias` is deprecated, use `logit_mean` instead."
128 - )
129 - logger.warning(
130 - "`logit_bias` is deprecated and will be removed in v0.21. "
131 - "Use `logit_mean` instead."
132 - )
133 - self.logit_mean = self.logit_bias
134 - self.logit_bias = None
135 -
136 - # Handle deprecated logit_scale → logit_sigma
137 - if self.logit_scale is not None:
138 - if self.logit_sigma is not None:
139 - raise ValueError(
140 - "Cannot set both `logit_scale` and `logit_sigma`. "
141 - "`logit_scale` is deprecated, use `logit_sigma` instead."
142 - )
143 - logger.warning(
144 - "`logit_scale` is deprecated and will be removed in v0.21. "
145 - "Use `logit_sigma` instead (logit_sigma = 1/logit_scale)."
146 - )
147 - if self.logit_scale == 0:
148 - raise ValueError("logit_scale cannot be 0 (division by zero)")
149 - self.logit_sigma = 1.0 / self.logit_scale
150 - self.logit_scale = None
151 -
110 if self.logit_sigma is not None and self.logit_sigma == 0:
111 raise ValueError("logit_sigma cannot be 0 (division by zero)")
112
vllm/utils/profiling.py deleted
-66
@@ -1,66 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -
4 -from __future__ import annotations
5 -
6 -import contextlib
7 -from collections.abc import Callable
8 -from functools import wraps
9 -from typing import Any
10 -
11 -from typing_extensions import deprecated
12 -
13 -
14 -@deprecated(
15 - "vllm.utils.profiling.cprofile_context() is deprecated and will be removed "
16 - "in v0.21. Use Python's cProfile module directly instead."
17 -)
18 -@contextlib.contextmanager
19 -def cprofile_context(save_file: str | None = None):
20 - """Run a cprofile
21 -
22 - Args:
23 - save_file: path to save the profile result. "1" or
24 - None will result in printing to stdout.
25 - """
26 - import cProfile
27 -
28 - prof = cProfile.Profile()
29 - prof.enable()
30 -
31 - try:
32 - yield
33 - finally:
34 - prof.disable()
35 - if save_file and save_file != "1":
36 - prof.dump_stats(save_file)
37 - else:
38 - prof.print_stats(sort="cumtime")
39 -
40 -
41 -@deprecated(
42 - "vllm.utils.profiling.cprofile() is deprecated and will be removed in "
43 - "v0.21. Use Python's cProfile module directly instead."
44 -)
45 -def cprofile(save_file: str | None = None, enabled: bool = True):
46 - """Decorator to profile a Python method using cProfile.
47 -
48 - Args:
49 - save_file: Path to save the profile result.
50 - If "1", None, or "", results will be printed to stdout.
51 - enabled: Set to false to turn this into a no-op
52 - """
53 -
54 - def decorator(func: Callable):
55 - @wraps(func)
56 - def wrapper(*args: Any, **kwargs: Any):
57 - if not enabled:
58 - # If profiling is disabled, just call the function directly.
59 - return func(*args, **kwargs)
60 -
61 - with cprofile_context(save_file):
62 - return func(*args, **kwargs)
63 -
64 - return wrapper
65 -
66 - return decorator