Skip to content
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

[Bug] llava, cuda out of memory #1593

Open
1 of 2 tasks
AmazDeng opened this issue May 15, 2024 · 4 comments
Open
1 of 2 tasks

[Bug] llava, cuda out of memory #1593

AmazDeng opened this issue May 15, 2024 · 4 comments

Comments

@AmazDeng
Copy link

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.

Describe the bug

I hava one A100 gpu card.
following the instruction (https://github.com/InternLM/lmdeploy/blob/main/docs/zh_cn/inference/vl_pipeline.md), run HelloWorld llava program,error occurs. The llava model is llava-v1.5-7b, and is not very big. So, why "cuda out of memory" error occurs?

error info:

Exception in thread Thread-139 (_create_weight_func):
Traceback (most recent call last):
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 766, in run_closure
    _threading_Thread_run(self)
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/site-packages/lmdeploy/turbomind/turbomind.py", line 199, in _create_weight_func
    model_comm.create_shared_weights(device_id, rank)
RuntimeError: [TM][ERROR] CUDA runtime error: out of memory /lmdeploy/src/turbomind/utils/memory_utils.cu:32 

Exception in thread Thread-140 (_get_params):
Traceback (most recent call last):
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 766, in run_closure
    _threading_Thread_run(self)
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/media/star/8T/20231130/eas_demo/llava-vllm/ENV/lib/python3.10/site-packages/lmdeploy/turbomind/turbomind.py", line 215, in _get_params
    out = model_comm.get_params(device_id, rank)
RuntimeError: [TM][ERROR]  Assertion fail: /lmdeploy/src/turbomind/triton_backend/llama/LlamaTritonModel.cc:417

1234

Reproduction

from lmdeploy import pipeline
from lmdeploy.vl import load_image
from lmdeploy import pipeline, ChatTemplateConfig
model_path='/media/star/8T/model/gpt/llava/llava-v1.5-7b'
image_path='/media/star/8T/tmp/gpt4v/1/1.png'
question="desc the image in detail "
pipe = pipeline(model_path)
image = load_image('/media/star/8T/tmp/gpt4v/1/1.png')

pipe = pipeline(model_path,
                chat_template_config=ChatTemplateConfig(model_name='vicuna'))

image = load_image(image)
response = pipe((question, image))
print(response)

Environment

can't find lmdeploy check_env file

Error traceback

No response

@irexyc
Copy link
Collaborator

irexyc commented May 15, 2024

The loading process of vlm is:
load vision model -> load llm weight -> allocate kv cache.

For llava-v1.5-7b, the first two steps will takes up about 14.5G cuda memory. But according to your log, the out of memory occured in step 2. Is there any other programs taking up gpu memory?

@AmazDeng
Copy link
Author

The loading process of vlm is: load vision model -> load llm weight -> allocate kv cache.

For llava-v1.5-7b, the first two steps will takes up about 14.5G cuda memory. But according to your log, the out of memory occured in step 2. Is there any other programs taking up gpu memory?

no,there is only one lmdeploy program running on the gpu.
101
102
103

@irexyc
Copy link
Collaborator

irexyc commented May 16, 2024

Can you try run the code without jupyter or ipython.

@AmazDeng
Copy link
Author

Can you try run the code without jupyter or ipython.

I only have one card and it's currently running a program, so I can't test it right now. I'll test it next week and will share the results then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants