Skip to content

Added support for quantization in vLLM backend #690

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

Merged
merged 5 commits into from
May 12, 2025
Merged
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
8 changes: 8 additions & 0 deletions src/lighteval/models/vllm/vllm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class VLLMModelConfig(ModelConfig):
pipeline_parallel_size: PositiveInt = 1 # how many GPUs to use for pipeline parallelism
gpu_memory_utilization: NonNegativeFloat = 0.9 # lower this if you are running out of memory
max_model_length: PositiveInt | None = None # maximum length of the model, ussually infered automatically. reduce this if you encouter OOM issues, 4096 is usually enough
quantization: str | None = None
load_format: str | None = None
swap_space: PositiveInt = 4 # CPU swap space size (GiB) per GPU.
seed: PositiveInt = 1234
trust_remote_code: bool = False
Expand Down Expand Up @@ -176,6 +178,12 @@ def _create_auto_model(self, config: VLLMModelConfig) -> Optional[LLM]:
"max_num_seqs": int(config.max_num_seqs),
"max_num_batched_tokens": int(config.max_num_batched_tokens),
}

if config.quantization is not None:
self.model_args["quantization"] = config.quantization
if config.load_format is not None:
self.model_args["load_format"] = config.load_format

if config.data_parallel_size > 1:
self.model_args["distributed_executor_backend"] = "ray"
self._batch_size = "auto"
Expand Down
Loading