使用kaggle白嫖GPU搭建chatglm-6B
1、kaggle设置
1、登录kaggle
2、手机验证
不用手机验证没办法使用gpu资源
3、更换运行模式
4、网络打开
2、ChatGLM-6B环境搭建
!git clone https://github.com/THUDM/ChatGLM-6B.git
cd ChatGLM-6B
!pip install -r requirements.txt
3、运行chatglm-6b
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
model = model.eval()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)
回答
你好👋!我是人工智能助手 ChatGLM-6B,很高兴见到你,欢迎问我任何问题。