曦远 (DealiAxy)一份私人的文字刊物

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 许可协议。转载请注明出处!

相关文章

2GB 显存还能跑大模型吗?我在 MX250 老笔记本上部署 Qwen3.5 2BB

七年前的Matebook14,MX250显存2GB,硬塞Qwen3.5 2B——这届玩家是真的敢。核心思路倒是比模型选择更值得学:先看清楚硬件预算,再决定能跑什么,而不是硬上7B然后等CPU掉帧到怀疑人生。1.81GiB直接顶满2GB显存,KV Cache挤出来的空间里,4K Context刚好够用。至于Agent场景?省省吧,2B让MX250当推理节点做轻量任务已经仁至义尽。

2026-09-15 · LLM · 约 1 分钟

讨论

共 0 条

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

加载评论中…