[Bug] response里需要生成空格's时,text会错误的输出
- 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
当response中有` 's`时,输出会丢失掉`s`,目前测试出相同的情况还包括字母`m`和`v`,注意还必须在`'`前面有一个空格时才会丢失
输入query:"这张图里面是否有人,有则返回{ 's'},否则返回{ 'm'} "
结果:Response(text="{ '' }", generate_token_len=5, input_token_len=1863, session_id=0, finish_reason='stop', token_ids=[339, 495, 269, 259, 466], logprobs=None)
但如果将query改为没有空格:"这张图里面是否有人,有则返回{'s'},否则返回{'m'} "
结果:Response(text="{'s'}", generate_token_len=3, input_token_len=1861, session_id=0, finish_reason='stop', token_ids=[339, 725, 8407], logprobs=None)
{'error_code': 0, 'error_msg': '', 'res': "{'s'}"}
### Reproduction
模型:internvl2-2b (其他未测试)
推理:
random_seed=42
backend_config = PytorchEngineConfig(session_len=8192)
pipe = pipeline(model_path=model_path, model_name=model_name, backend_config=backend_config)
### Environment
```Shell
环境:lmdeploy==0.5.2.post1 (0.5.1和0.5.2也测试过,有相同的问题), transformers==4.37.2
```
### Error traceback
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.