mmhh888 commited on
Commit
8756077
1 Parent(s): ea756ed

Create glm6b_test.py

Browse files
Files changed (1) hide show
  1. glm6b_test.py +9 -0
glm6b_test.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer, AutoModel
2
+
3
+
4
+ model_path = "THUDM/chatglm2-6b"
5
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
6
+ model = AutoModel.from_pretrained(model_path,trust_remote_code=True).half().quantize(4)
7
+ model = model.eval()
8
+ resp, history = model.chat(tokenizer, "美国的首都是哪里", history=[])
9
+ print(resp)