返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
LLM

ChatGLM-6B local deployment

Download the project code git clone https://github.com/THUDM/ChatGLM-6B.git Create a virtual environment; conda is recommended for management conda create -n chatglm python==3.8 Install dependencies conda activate chatglm pip install -r requirements.txt conda install cudatoolkit=

曦远 (DealiAxy)约 5 分钟

Download the project code

git clone https://github.com/THUDM/ChatGLM-6B.git

Create a virtual environment. It is recommended to use conda for management.

conda create -n chatglm python==3.8

Install dependencies

conda activate chatglm
pip install -r requirements.txt
conda install cudatoolkit=11.7 -c nvidia

PS: If cudatoolkit is not installed, you will encounter the error RuntimeError: Library cudart is not initialized.

However, some users in the issues mention that this can be resolved by using the CPU to output a quantized model and then directly invoking it, though this has not been tried yet.

Issues address: https://github.com/THUDM/ChatGLM-6B/issues/115

Hardware Requirements

Quantization LevelMinimum GPU Memory (Inference)Minimum GPU Memory (Efficient Parameter Fine-tuning)
FP16 (No Quantization)13 GB14 GB
INT88 GB9 GB
INT46 GB7 GB

Modify the startup parameters

model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()

Use the quantized model

# Modify as needed, currently only supports 4/8 bit quantization
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).quantize(4).half().cuda()

Download the model and start the Gradio interface

cd ChatGLM-6B
python web_demo.py

Running effect

image-20230414161717147

_EOF_

ChatGLM-6B local deployment

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…