lm-sys / lm-sys/FastChat

Better device_map and max_memory for loading vicuna model

Open
#3,214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

Hi! Thank you for this wonderful repo.
When I was trying to load vicuna model with limited VRAM across different GPUs. I discovered that your "max_memory" part would cause the loading to fail:
in model_adapter.py line 219 to 231.

        if num_gpus != 1:
            kwargs["device_map"] = "auto"
            if max_gpu_memory is None:
                kwargs[
                    "device_map"
                ] = "sequential"  # This is important for not the same VRAM sizes
                available_gpu_memory = get_gpu_memory(num_gpus)
                kwargs["max_memory"] = {
                    i: str(int(available_gpu_memory[i] * 0.85)) + "GiB"
                    for i in range(num_gpus)
                }
            else:
                kwargs["max_memory"] = {i: max_gpu_memory for i in range(num_gpus)}

If comment "available_gpu_memory" and "kwargs["max_memory"]", the loading would succeed.
I wonder why you compute max_memory here and use it as one of kwargs to load the model, since this could cause the failure of loading.

Thanks again for your time and effort!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in model_adapter.py around lines 219-231 and reproduce Vicuna loading with limited VRAM across GPUs. Compare the loading behavior with and without the available_gpu_memory and max_memory handling, then establish a configuration that loads successfully without breaking the intended device_map behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.