vllm.benchmarks.datasets.utils ¶
Shared utilities for benchmark dataset sampling.
_resolve_range_ratios ¶
Return (input_range_ratio, output_range_ratio) from range_ratio.
range_ratio is either a single float (used for both input and output) or a dict with "input" and "output" keys.
Source code in vllm/benchmarks/datasets/utils.py
get_sampling_params ¶
get_sampling_params(
rng: Generator,
num_requests: int,
range_ratio: RangeRatio,
input_len: int,
output_len: int,
tokenizer: TokenizerLike,
) -> tuple[ndarray, ndarray, ndarray]
Sample per-request input/output token lengths and vocab offsets.
Lengths are drawn uniformly from integer ranges around the configured means, controlled by range_ratio. It may be a single float (applied to both input and output) or a dict with "input" and "output" keys for independent control.
Tokenizer special tokens are subtracted from input_len before computing the sampling interval.
Returns:
| Type | Description |
|---|---|
ndarray | (input_lens, output_lens, offsets) – three 1-D |
ndarray | shape |