ChatGLM3 是智谱AI和清华大学 KEG 实验室联合发布的对话预训练模型。ChatGLM3-6B 是 ChatGLM3 系列中的开源模型,在保留了前两代模型对话流畅、部署门槛低等众多优秀特性的基础上,ChatGLM3-6B引入了多项重要的新特性和改进。
项目地址: https://github.com/THUDM/ChatGLM3
ChatGLM3-6B 的基础模型 ChatGLM3-6B-Base 采用了更多样的训练数据、更充分的训练步数和更合理的训练策略。在语义、数学、推理、代码、知识等不同角度的数据集上测评显示,ChatGLM3-6B-Base 具有在 10B 以下的基础模型中最强的性能。
提供多个版本以满足不同需求:
在8个中英文典型数据集上的测试结果:
模型 | GSM8K | MATH | BBH | MMLU | C-Eval | CMMLU | MBPP | AGIEval |
---|---|---|---|---|---|---|---|---|
ChatGLM2-6B-Base | 32.4 | 6.5 | 33.7 | 47.9 | 51.7 | 50.0 | - | - |
ChatGLM3-6B-Base | 72.3 | 25.7 | 66.1 | 61.4 | 69.0 | 67.5 | 52.4 | 53.7 |
在多个长文本应用场景下对 ChatGLM3-6B-32K 进行了人工评估测试。与二代模型相比,其效果平均提升了超过 50%。在论文阅读、文档摘要和财报分析等应用中提升尤为显著。
git clone https://github.com/THUDM/ChatGLM3
cd ChatGLM3
pip install -r requirements.txt
from transformers import AutoTokenizer, AutoModel
# 加载模型
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True, device='cuda')
model = model.eval()
# 对话交互
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
# Gradio版本
python web_demo_gradio.py
# Streamlit版本
streamlit run web_demo_streamlit.py
python cli_demo.py
cd openai_api_demo
python api_server.py
提供OpenAI兼容的API接口,支持:
项目提供完整的微调套件,支持:
支持多个优秀的开源项目:
推理加速:
微调框架:
应用框架:
项目提供集成三种模式的综合Demo:
项目积极拥抱开源社区,与多个优秀项目深度合作,形成了完整的生态系统。开发者可以基于ChatGLM3进行各种创新应用的开发。