Skip to content

[Usage]: Spread two big LLMs across four GPUs #4029

@fozziethebeat

Description

@fozziethebeat

Your current environment

This is about API usage rather than an environment issue.

How would you like to use vllm

I want to run batch inference using two models in the same process and spread them across distinct GPUs.

Here's an example code snippet i've been trying to figure out how to get correct:

from vllm import LLM

llm1 = LLM(
    model="meta-llama/Llama-2-70b-hf",
    tensor_parallel_size=2
)
llm2 = LLM(
    model="CohereForAI/c4ai-command-r-v01",
    tensor_parallel_size=2,
)

In this scenario, if I have 4 A100 80Gs on a single node, I should be able to fit model one on GPUs 1 and 2, then fit model two on GPUs 3 and 4. I was hoping that Ray's backend would get this right but instead this doesn't work. I typically run out of vRAM.

Is there a way to configure two LLM instances such that they work on distinct subsets of my available GPUs all while running the same process? Do I need to use device right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    usageHow to use vllm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions