li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4
MIT License
2.84k stars 327 forks source link

Update convert.py #280

Closed futz12 closed 4 months ago

futz12 commented 4 months ago

fix: Fixed a conversion error caused by a version recognition error

futz12 commented 4 months ago

错误原因是,转换工具通过识别tranformer版本号判断是glm2还是3。但是chatglm3-6b-128k的tranformer版本和glm2相同,导致识别错误。在推理过程中会出现异常输出。

li-plus commented 4 months ago

感谢,我换了一种写法,因为 ChatGLM3 支持 system prompt,所以 tokenizer 里一定有 <|system|> token,这样来判断 ChatGLM2 vs ChatGLM3 应该是比较鲁棒的。之前根据版本来判断模型还是太 hack 了。