xusenlinzy / api-for-open-llm

Openai style api for open large language models, using LLMs just as chatgpt! Support for LLaMA, LLaMA-2, BLOOM, Falcon, Baichuan, Qwen, Xverse, SqlCoder, CodeLLaMA, ChatGLM, ChatGLM2, ChatGLM3 etc. 开源大模型的统一后端接口
Apache License 2.0
2.36k stars 270 forks source link

Internlm2-chat-7b无法生成正确的回复 #230

Closed AlanLu0808 closed 7 months ago

AlanLu0808 commented 10 months ago

提交前必须检查以下项目 | The following items must be checked before submission

问题类型 | Type of problem

效果问题 | Effectiveness issues

操作系统 | Operating system

Linux

详细描述问题 | Detailed description of the problem

Internlm2-chat-7b无法生成正确的回复,使用的是2024.02.04版本

配置1

PORT=8945

# model related
MODEL_NAME=internlm2
MODEL_PATH=/mnt/LLM/public/LLM/internlm2-chat-7b
EMBEDDING_NAME=
ADAPTER_MODEL_PATH=
QUANTIZE=16
CONTEXT_LEN=
LOAD_IN_8BIT=false
LOAD_IN_4BIT=false
USING_PTUNING_V2=false
STREAM_INTERVERL=2
PROMPT_NAME= 

# device related
DEVICE=

# "auto", "cuda:0", "cuda:1", ...
DEVICE_MAP=auto
GPUS=
NUM_GPUs=1
DTYPE=half

# api related
API_PREFIX=/v1

USE_STREAMER_V2=false
ENGINE=default

配置2:增加PROMPT_NAME字段

PORT=8945

# model related
MODEL_NAME=internlm2
MODEL_PATH=/mnt/LLM/public/LLM/internlm2-chat-7b
EMBEDDING_NAME=
ADAPTER_MODEL_PATH=
QUANTIZE=16
CONTEXT_LEN=
LOAD_IN_8BIT=false
LOAD_IN_4BIT=false
USING_PTUNING_V2=false
STREAM_INTERVERL=2
PROMPT_NAME=internlm2

# device related
DEVICE=

# "auto", "cuda:0", "cuda:1", ...
DEVICE_MAP=auto
GPUS=
NUM_GPUs=1
DTYPE=half

# api related
API_PREFIX=/v1

USE_STREAMER_V2=false
ENGINE=default

Dependencies

# 请在此处粘贴依赖情况
# Please paste the dependencies here

运行日志或截图 | Runtime logs or screenshots

配置1 image

配置2 image

xusenlinzy commented 10 months ago

https://github.com/xusenlinzy/api-for-open-llm/blob/d2a9e6c95106288756f26d6cae3f14a77ac20025/api/adapter/template.py#L775

这一行改一下:

"strings": ["</s>", "<|im_end|>"], 
"token_ids": [92541]  # <|action_start|>

试试有没有用

AlanLu0808 commented 10 months ago

修改后InternLM2-chat-20B是正常的,但是InternLM2-chat-7B看起来效果还是不对

InternLM2-chat-7B效果如下: image