Skip to content

Commit 6ba0b5e

Browse files
authored
Add ability to pass options to VLLM (#621)
* Add ability to pass options to VLLM * Add link to engine args
1 parent b5a3050 commit 6ba0b5e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lmms_eval/models/vllm.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,21 @@ def __init__(
5454
self.max_frame_num = max_frame_num
5555
self.threads = threads
5656

57+
init_params = ["model_version", "tensor_parallel_size", "gpu_memory_utilization", "batch_size", "timeout", "max_images", "max_videos", "max_audios", "max_frame_num", "threads", "trust_remote_code"]
58+
59+
# filter out the parameters already defined in __init__ to pass options to VLLM
60+
# this enables support for all VLLM Engine args:
61+
# https://github.com/vllm-project/vllm/blob/3147586ebdb36ceae653e9dceec8cf9922fe2c28/vllm/engine/arg_utils.py#L93
62+
filtered_kwargs = {k: v for k, v in kwargs.items() if k not in init_params}
63+
5764
accelerator = Accelerator()
5865
self.client = LLM(
5966
model=self.model_version,
6067
tensor_parallel_size=tensor_parallel_size,
6168
gpu_memory_utilization=gpu_memory_utilization,
6269
limit_mm_per_prompt={"image": max_images, "video": max_videos, "audio": max_audios},
6370
trust_remote_code=trust_remote_code,
71+
**filtered_kwargs,
6472
)
6573
if accelerator.num_processes > 1:
6674
assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."

0 commit comments

Comments
 (0)