3 篇文章带有标签 “ChatGLM2-6B”

FastChat 部署多模型


* [Chatbot Arena](https://chat.lmsys.org/) * [FastChat](https://github.com/lm-sys/FastChat) * [LMSYS BLOG](https://lmsys.org/blog/) * [Use AutoGen for Local LLMs](https://microsoft.github.io/autogen/blog/2023/07/14/Local-LLMs/)

这种方式安装比较容易调试,适合开发者。

克隆代码

git clone https://github.com/lm-sys/FastChat.git
cd FastChat

创建环境

python -m venv env
source env/bin/activate

安装

pip install --upgrade pip  # enable PEP 660 support
pip install -e ".[model_worker,webui]"
pip install -U transformers==4.33.0 # AttributeError: 'ChatGLMTokenizer' object has no attribute 'tokenizer'

部署 LLM

模型 参数 精度 加速方式 显存 速度(每秒生成汉字数) 效果
[Qwen-7B-Chat][Qwen-7B-Chat] 7B float16 20G 7
[Qwen-7B-Chat][Qwen-7B-Chat] 7B float16 flash-attention 20G 9
[ChatGLM2-6B][ChatGLM2-6B] 6B float16 13G 26
[ChatGLM2-6B][ChatGLM2-6B] 6B float16 fastllm 13G 26
[ChatGLM2-6B][ChatGLM2-6B] 6B float16 chatglm.cpp 15G 22
[ChatGLM2-6B][ChatGLM2-6B] 🚀 6B int4 chatglm.cpp 6G 90
[Baichuan2-7B-Chat][Baichuan2-7B-Chat] 7B float16 14G 2
[Baichuan2-7B-Chat][Baichuan2-7B-Chat] 7B int8 11G 16
[Baichuan2-7B-Chat][Baichuan2-7B-Chat] 7B int4 8G 30
[Baichuan2-13B-Chat-4bits][Baichuan2-13B-Chat-4bits] 13B int4 13G 20

在 MacBook Pro M2 Max 上测试 ChatGLM2-6B

  1. 更强大的性能:基于 ChatGLM 初代模型的开发经验,我们全面升级了 ChatGLM2-6B 的基座模型。ChatGLM2-6B 使用了 GLM 的混合目标函数,经过了 1.4T 中英标识符的预训练与人类偏好对齐训练,评测结果显示,相比于初代模型,ChatGLM2-6B 在 MMLU(+23%)、CEval(+33%)、GSM8K(+571%) 、BBH(+60%)等数据集上的性能取得了大幅度的提升,在同尺寸开源模型中具有较强的竞争力。
  2. 更长的上下文:基于 FlashAttention 技术,我们将基座模型的上下文长度(Context Length)由 ChatGLM-6B 的 2K 扩展到了 32K,并在对话阶段使用 8K 的上下文长度训练,允许更多轮次的对话。但当前版本的 ChatGLM2-6B 对单轮超长文档的理解能力有限,我们会在后续迭代升级中着重进行优化。
  3. 更高效的推理:基于 Multi-Query Attention 技术,ChatGLM2-6B 有更高效的推理速度和更低的显存占用:在官方的模型实现下,推理速度相比初代提升了 42%,INT4 量化下,6G 显存支持的对话长度由 1K 提升到了 8K。