shibing624 / MedicalGPT

MedicalGPT: Training Your Own Medical GPT Model with ChatGPT Training Pipeline. 训练医疗大模型,实现了包括增量预训练(PT)、有监督微调(SFT)、RLHF、DPO、ORPO。
Apache License 2.0
2.94k stars 452 forks source link

运行Demo出现问题:AttributeError: 'ChatGLMTokenizer' object has no attribute 'sp_tokenizer'. Did you mean: '_tokenize'? #295

Closed Peter-of-Astora closed 5 months ago

Peter-of-Astora commented 6 months ago

我使用的是ChatGLM-6B的底座模型,命令是: python gradio_demo.py --model_type chatglm --base_model ./ChatGLM-6B/chatglm-6b --template_name chatglm 不知道哪里出了问题

shibing624 commented 6 months ago

pip install transformers==4.28.1

Peter-of-Astora commented 6 months ago

pip install之后,又报了这个错: ImportError: cannot import name 'repeat_kv' from 'transformers.models.llama.modeling_llama' 是因为base_model参数后面必须要跟llama的huggingface模型目录不能和chatGLM的吗😂

shibing624 commented 6 months ago

是因为transformers升级后,跟国产的百川、chatglm的tokenizer不兼容。

  1. 要用transformers的最新版本,就需要手动改下国产模型的tokenizer 文件,修改方法:https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat/discussions/18
  2. 要么transformers降级,用旧版本兼容国产模型。
Peter-of-Astora commented 6 months ago

请问一下较新的chatGLM3也不兼容最新的transformers吗,如果是这样我就干脆换国外模型好了

shibing624 commented 6 months ago

照着改下就可以。

Peter-of-Astora commented 6 months ago

好的( •̀ ω •́ )✧

Peter-of-Astora commented 6 months ago

感谢,已经解决问题了,另外测试过ChatGLM3是可以兼容最新版本的transformers的😁