MiniCPM icon indicating copy to clipboard operation
MiniCPM copied to clipboard

[Bug]: openai_api_server_demo.generate_minicpm:158 - Input length larger than 20

Open cxgreat2014 opened this issue 1 year ago • 2 comments

Is there an existing issue ? / 是否已有相关的 issue ?

  • [X] I have searched, and there is no existing issue. / 我已经搜索过了,没有相关的 issue。

Describe the bug / 描述这个 bug

使用 demo/openai_api_demo/openai_api_server_demo.py 无法正常对话,model.config.max_length拿到的值只有20

To Reproduce / 如何复现

  1. 运行demo/openai_api_demo/openai_api_server_demo.py,等待服务启动
  2. 修改demo/openai_api_demo/openai_api_request_demo.py的第二十一行为:"content": "我有1000元人民币,在超市花掉了80元,还剩多少?"
  3. 然后就能在server端看到错误日志:
minicpm-1  | 2024-09-07 02:00:01.108 | DEBUG    | __main__:create_chat_completion:240 - ==== request ====
minicpm-1  | {'messages': [ChatMessage(role='user', content='我有1000元人民币,在超市花掉了80元,还剩多少?', name=None)], 'temperature': 0.8, 'top_p': 0.8, 'max_tokens': 4096, 'echo': False, 'repetition_penalty': 1.1, 'tools': None}
minicpm-1  | 2024-09-07 02:00:01.109 | ERROR    | __main__:generate_minicpm:158 - Input length larger than 20
minicpm-1  | 2024-09-07 02:00:01.109 | DEBUG    | __main__:create_chat_completion:276 - ==== message ====
minicpm-1  | role='assistant' content='' name=None
minicpm-1  | INFO:     172.21.0.1:34988 - "POST /v1/chat/completions HTTP/1.1" 200 OK

Expected behavior / 期望的结果

能正常对话

Screenshots / 截图

No response

Environment / 环境

- OS: [Docker Ubuntu 22.04]
- Pytorch: [torch '2.4.1+cu121']
- CUDA: [CUDA 12.1.1]
- Device: [RTX3090]

Additional context / 其他信息

No response

cxgreat2014 avatar Sep 07 '24 02:09 cxgreat2014

你好,你可以修改model.config.max_length这个值,可以在config文件中直接修改,20并不是一个有效的值

LDLINGLINGLING avatar Sep 09 '24 01:09 LDLINGLINGLING

辛苦明确下使用的是哪个MiniCPM模型?请参考这里的回复

zh-zheng avatar Sep 10 '24 03:09 zh-zheng