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進行各種創新應用的開發。