Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions docs/contributing/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,43 +201,45 @@ The profiling traces generated by the continuous profiling workflow are publicly

The Python standard library includes
[cProfile](https://docs.python.org/3/library/profile.html) for profiling Python
code. vLLM includes a couple of helpers that make it easy to apply it to a section of vLLM.
Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_context` functions can be
used to profile a section of code.
code.

!!! note
The `vllm.utils.profiling` helpers are deprecated and will be removed in
`v0.21`. Please use Python's `cProfile` module directly instead.

### Example usage - decorator
### Example usage - function call

The first helper is a Python decorator that can be used to profile a function.
If a filename is specified, the profile will be saved to that file. If no filename is
specified, profile data will be printed to stdout.
If a filename is specified, the profile will be saved to that file. If no
filename is specified, profile data can be printed to stdout.

```python
from vllm.utils.profiling import cprofile
import cProfile


@cprofile("expensive_function.prof")
def expensive_function():
# some expensive code
pass
```

### Example Usage - context manager

The second helper is a context manager that can be used to profile a block of
code. Similar to the decorator, the filename is optional.
profiler = cProfile.Profile()
profiler.runcall(expensive_function)
profiler.dump_stats("expensive_function.prof")
```

### Example usage - context manager style

```python
from vllm.utils.profiling import cprofile_context
import cProfile


def another_function():
# more expensive code
pass

with cprofile_context("another_function.prof"):

profiler = cProfile.Profile()
profiler.enable()
try:
another_function()
finally:
profiler.disable()
profiler.dump_stats("another_function.prof")
```

### Analyzing Profile Results
Expand Down
4 changes: 0 additions & 4 deletions docs/models/pooling_models/classify.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,3 @@ Example configuration:
### Remove softmax from PoolingParams

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.

### Remove `logit_bias` and `logit_scale`

`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.
42 changes: 0 additions & 42 deletions vllm/config/pooler.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,6 @@ class PoolerConfig:
activation((logit - logit_mean) / logit_sigma). Defaults to None.
"""

# Deprecated aliases — will be removed in v0.21
logit_bias: float | None = None
"""
Deprecated: Use logit_mean instead. Will be removed in v0.21.
"""

logit_scale: float | None = None
"""
Deprecated: Use logit_sigma instead (note: logit_sigma = 1/logit_scale).
Will be removed in v0.21.
"""

## for reward models
step_tag_id: int | None = None
"""
Expand All @@ -119,36 +107,6 @@ class PoolerConfig:
"""

def __post_init__(self) -> None:
# Handle deprecated logit_bias → logit_mean
if self.logit_bias is not None:
if self.logit_mean is not None:
raise ValueError(
"Cannot set both `logit_bias` and `logit_mean`. "
"`logit_bias` is deprecated, use `logit_mean` instead."
)
logger.warning(
"`logit_bias` is deprecated and will be removed in v0.21. "
"Use `logit_mean` instead."
)
self.logit_mean = self.logit_bias
self.logit_bias = None

# Handle deprecated logit_scale → logit_sigma
if self.logit_scale is not None:
if self.logit_sigma is not None:
raise ValueError(
"Cannot set both `logit_scale` and `logit_sigma`. "
"`logit_scale` is deprecated, use `logit_sigma` instead."
)
logger.warning(
"`logit_scale` is deprecated and will be removed in v0.21. "
"Use `logit_sigma` instead (logit_sigma = 1/logit_scale)."
)
if self.logit_scale == 0:
raise ValueError("logit_scale cannot be 0 (division by zero)")
self.logit_sigma = 1.0 / self.logit_scale
self.logit_scale = None

if self.logit_sigma is not None and self.logit_sigma == 0:
raise ValueError("logit_sigma cannot be 0 (division by zero)")

Expand Down
66 changes: 0 additions & 66 deletions vllm/utils/profiling.py

This file was deleted.

Loading