ChatGLM-6B 是一个开源的、支持中英双语问答的对话语言模型,基于 Geeral Laguage Model (GLM) 架构,具有 62 亿参数。结合模型量化技术,用户可以在消费级的显卡上进行本地部署(INT4 量化级别下最低只需 6GB 显存)。ChatGLM-6B 使用了和 ChatGLM 相同的技术,针对中文问答和对话进行了优化。经过约 1T 标识符的中英双语训练,辅以监督微调、反馈自助、人类反馈强化学习等技术的加持,62 亿参数的 ChatGLM-6B 已经能生成相当符合人类偏好的回答。 ChatGLM-6B is a ope biligual laguage model based o Geeral Laguage Model (GLM) framework, with 6.2 billio parameters. With the quatizatio techique, users ca deploy locally o cosumer-grade graphics cards (oly 6GB of GPU memory is required at the INT4 quatizatio level). ChatGLM-6B uses techology similar to ChatGPT, optimized for Chiese QA ad dialogue. The model is traied for about 1T tokes of Chiese ad Eglish corpus, supplemeted by supervised fie-tuig, feedback bootstrap, ad reiforcemet learig wit huma feedback. With oly about 6.2 billio parameters, the model is able to geerate aswers that are i lie with huma preferece. 本模型环境需安装最新版的midlp 本仓库的代码依照 Apache-2.0 协议开源,ChatGLM-6B 模型的权重的使用则需要遵循 Model Licese。ChatGLM-6B模型介绍
环境搭建
pip istall git+https://github.com/midspore-lab/midlp.git
软件依赖
pip istall "midspore>=2.2"
代码范例
from midlp.trasformers import AutoTokeizer, AutoModelForSeq2SeqLM
tokeizer = AutoTokeizer.from_pretraied("THUDM/chatglm-6b", from_pt=True)
model = AutoModelForSeq2SeqLM.from_pretraied("THUDM/chatglm-6b", from_pt=True).half()
model.set_trai(False)
prompt = "你好"
history = []
respose, history = model.chat(tokeizer, prompt, history=history)
prit(respose)
# '你好?!我是人工智能助手 ChatGLM-6B,很高兴见到你,欢迎问我任何问题。'
协议
点击空白处退出提示
评论