Skip to content

Add support for vLLM KV-cache quantization #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion src/lighteval/models/vllm/vllm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ class VLLMModelConfig(ModelConfig):
max_num_seqs: PositiveInt = 128 # maximum number of sequences per iteration; This variable and `max_num_batched_tokens` effectively control the batch size at prefill stage. See https://github.com/vllm-project/vllm/issues/2492 for detailed explaination.
max_num_batched_tokens: PositiveInt = 2048 # maximum number of tokens per batch
subfolder: str | None = None
kv_cache_dtype: str = "auto"
calculate_kv_scales: bool = False
is_async: bool = False # Whether to use the async version or sync version of the model


class VLLMModel(LightevalModel):
def __init__(
self,
Expand Down Expand Up @@ -187,6 +188,8 @@ def _create_auto_model(self, config: VLLMModelConfig) -> Optional[LLM]:
"seed": int(config.seed),
"max_num_seqs": int(config.max_num_seqs),
"max_num_batched_tokens": int(config.max_num_batched_tokens),
"kv_cache_dtype": config.kv_cache_dtype,
"calculate_kv_scales": config.calculate_kv_scales,
}

if config.quantization is not None:
Expand Down
Loading