InternLM / InternLM/lmdeploy

使用pipline进行批量推理报错[Bug]

Open
#2,047 4 comments 0 reactions 0 assignees 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.

### Describe the bug

完全按照readme中的例子会报错,模型是internvl2-40B

### Reproduction

![image](https://github.com/user-attachments/assets/e852fbb4-1dd4-4e76-bf35-ddd8b6648da0)
![image](https://github.com/user-attachments/assets/4bb08096-f3d3-4c69-ad3d-6579e7f56756)

### Environment

```Shell
rt
```

### Error traceback

```Shell
Traceback (most recent call last):
File "/home/zhujihuai.zjh/cpv_check_for_huohao/huohao_image_internvl.py", line 50, in
response = pipe(prompts)
^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 304, in __call__
return self.batch_infer(prompts,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 428, in batch_infer
_get_event_loop().run_until_complete(gather())
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/nest_asyncio.py", line 98, in run_until_complete
return f.result()
^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/asyncio/futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/asyncio/tasks.py", line 279, in __step
result = coro.throw(exc)
^^^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 425, in gather
await asyncio.gather(
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/asyncio/tasks.py", line 349, in __wakeup
future.result()
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/asyncio/tasks.py", line 277, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 410, in _inner_call
async for out in generator:
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 563, in generate
prompt_input = await self._get_prompt_input(prompt, do_preprocess,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 516, in _get_prompt_input
prompt = chat_template.messages2prompt(prompt, sequence_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zhujihuai.zjh/.conda/envs/intern-vl2/lib/python3.11/site-packages/lmdeploy/model.py", line 535, in messages2prompt
if len(messages) and messages[0]['role'] != 'system':
~~~~~~~~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'
```

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.