Skip to content
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 lmms_eval/models/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ def __init__(
self.max_frame_num = max_frame_num
self.threads = threads

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"]

# filter out the parameters already defined in __init__ to pass options to VLLM
# this enables support for all VLLM Engine args:
# https://github.com/vllm-project/vllm/blob/3147586ebdb36ceae653e9dceec8cf9922fe2c28/vllm/engine/arg_utils.py#L93
filtered_kwargs = {k: v for k, v in kwargs.items() if k not in init_params}

accelerator = Accelerator()
self.client = LLM(
model=self.model_version,
tensor_parallel_size=tensor_parallel_size,
gpu_memory_utilization=gpu_memory_utilization,
limit_mm_per_prompt={"image": max_images, "video": max_videos, "audio": max_audios},
trust_remote_code=trust_remote_code,
**filtered_kwargs,
)
if accelerator.num_processes > 1:
assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."
Expand Down