Loading

使用kaggle白嫖GPU搭建chatglm-6B

1、kaggle设置

1、登录kaggle

2、手机验证

不用手机验证没办法使用gpu资源

3、更换运行模式

image-20240429162803107

4、网络打开

image-20240429162832439

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,很高兴见到你,欢迎问我任何问题。
posted @ 2024-04-29 16:30  xine  阅读(45)  评论(0编辑  收藏  举报