Skip to content

Commit

Permalink
add chatgpt
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvin-Ma committed Jul 2, 2023
1 parent 6e6622e commit d380db2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions 14-model_learning/chatGLM/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 聊天机器人
```shell
pip install protobuf transformers==4.27.1 cpm_kernels
```
## coding
```python
from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained("./chatglm-6b-int4", trust_remote_code=True)
model = AutoModel.from_pretrained("./chatglm-6b-int4", trust_remote_code=True).half().cuda()
response, history = model.chat(tokenizer, "你好", history=[])
print(response)

# 你好👋!我是人工智能助手 ChatGLM-6B,很高兴见到你,欢迎问我任何问题。

response, history = model.chat(tokenizer, "晚上睡不着应该怎么办", history=history)
print(response)
```

## pretrained model
- [链接](https://pan.baidu.com/s/1VPRGReHfnnqe_ULKjquoaQ?pwd=oaae)
- 提取码:oaae

# 参考资料
[参考资料2](https://huggingface.co/THUDM/chatglm-6b-int4)
[参考资料](https://github.com/wenda-LLM/wenda/tree/main)

0 comments on commit d380db2

Please sign in to comment.