InternLM / InternLM/lmdeploy

[Bug] lmdeploy部署的微调后的qwen2vl模型,能正常部署加载,但调用时候报错

Open
#3,373 10 comments 0 reactions 1 assignee Claimed by @CUHKSZzxy View on GitHub
Dominant language
Python
Stars
8.1k
Forks
748
Avg merge
6d 2h
Merged PRs (30d)
54

Description

### Checklist

- [x] 1. I have searched related issues but cannot get the expected help.
- [x] 2. The bug has not been fixed in the latest version.
- [x] 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

### Describe the bug

ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in __call__
await self.app(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/routing.py", line 714, in __call__
await self.middleware_stack(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/serve/openai/api_server.py", line 451, in chat_completions_v1
async for res in result_generator:
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/serve/async_engine.py", line 663, in generate
prompt_input = await self._get_prompt_input(prompt,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/serve/vl_async_engine.py", line 89, in _get_prompt_input
results = await self.vl_encoder.wrap_for_pytorch(results, self.chat_template, self.tokenizer,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/vl/engine.py", line 81, in wrap_for_pytorch
result = self.model.to_pytorch(messages, chat_template, tokenizer, sequence_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/vl/model/qwen2.py", line 108, in to_pytorch
return self.to_pytorch_aux(messages, prompt, IMAGE_TOKEN, tokenizer, sequence_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs01/gyh20_2/anaconda3/envs/lmdeploy-env/lib/python3.12/site-packages/lmdeploy/vl/model/base.py", line 187, in to_pytorch_aux
segs = prompt.split(IMAGE_TOKEN)
^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'
INFO: 127.0.0.1:38726 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error

### Reproduction

![Image](https://github.com/user-attachments/assets/bcc0f3e9-3876-4096-b2b9-bd4d89e9697b)

![Image](https://github.com/user-attachments/assets/ba0e22f8-cce6-4c79-bf92-a4530ed484b5)

![Image](https://github.com/user-attachments/assets/03a4fd20-0585-472e-8150-0ff4c3ebccc0)

### Environment

```Shell
cuda 12.4
lmdeploy 2.7.4.post1
qwenvl
```

### Error traceback

```Shell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.