💻 GitHub 仓库 • 🐦 Twitter • 📃 [GLM@ACL 22] [GitHub] • 📃 [GLM-130B@ICLR 23] [GitHub]
📍在 chatglm.cn 体验更大规模的 ChatGLM 模型
修改示例代码部分,增加npu支持;
修改安装依赖;
Modify example and add npu support;
Modify denpendencies;
ChatGLM3-6B 是 ChatGLM 系列最新一代的开源模型,在保留了前两代模型对话流畅、部署门槛低等众多优秀特性的基础上,ChatGLM3-6B 引入了如下特性:
ChatGLM3-6B 是 ChatGLM 系列的最新开源模型。在保留前两代模型流畅对话、低部署门槛等诸多优秀特性的基础上,ChatGLM3-6B 引入了以下新特性:
pip install protobuf transformers==4.30.2 cpm_kernels torch>=2.0 gradio mdtex2html sentencepiece accelerate openmind可以通过如下代码调用 ChatGLM3-6B 模型来生成对话:
您可以通过以下代码调用 ChatGLM3-6B 模型来生成对话:
from openmind import is_torch_npu_available, AutoTokenizer, AutoModel
if is_torch_npu_available():
device = "npu:0"
elif torch.cuda.is_available():
device = "cuda:0"
else:
device = "cpu"
tokenizer = AutoTokenizer.from_pretrained("PyTorch-NPU/chatglm3_6b", trust_remote_code=True)
model = AutoModel.from_pretrained("PyTorch-NPU/chatglm3_6b", trust_remote_code=True, device_map=device).half()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
response, history = model.chat(tokenizer, "晚上睡不着应该怎么办", history=history)
print(response)关于更多的使用说明,包括如何运行命令行和网页版本的 DEMO,以及使用模型量化以节省显存,请参考我们的 Github Repo。
有关更多说明,包括如何运行命令行和网页演示,以及模型量化,请参考我们的 Github Repo。
本仓库的代码依照Apache-2.0协议开源,ChatGLM3-6B 模型的权重的使用则需要遵循 Model License。
本仓库的代码基于Apache-2.0协议开源,而ChatGLM3-6B模型权重的使用需遵守 Model License。
如果你觉得我们的工作有帮助的话,请考虑引用下列论文。
如果您认为我们的工作有所帮助,请考虑引用以下论文。
@article{zeng2022glm,
title={Glm-130b: An open bilingual pre-trained model},
author={Zeng, Aohan and Liu, Xiao and Du, Zhengxiao and Wang, Zihan and Lai, Hanyu and Ding, Ming and Yang, Zhuoyi and Xu, Yifan and Zheng, Wendi and Xia, Xiao and others},
journal={arXiv preprint arXiv:2210.02414},
year={2022}
}@inproceedings{du2022glm,
title={GLM: General Language Model Pretraining with Autoregressive Blank Infilling},
author={Du, Zhengxiao and Qian, Yujie and Liu, Xiao and Ding, Ming and Qiu, Jiezhong and Yang, Zhilin and Tang, Jie},
booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
pages={320--335},
year={2022}
}