Update README.md
Browse files
README.md
CHANGED
@@ -13,3 +13,12 @@ widget:
|
|
13 |
- text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..."
|
14 |
example_title: "Reading comprehension"
|
15 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
- text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..."
|
14 |
example_title: "Reading comprehension"
|
15 |
---
|
16 |
+
### How to use
|
17 |
+
```python
|
18 |
+
>>> from transformers import AutoTokenizer, AutoModel
|
19 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True)
|
20 |
+
>>> model = AutoModel.from_pretrained("THUDM/chatglm2-6b-int4", trust_remote_code=True).half().cuda()
|
21 |
+
>>> model = model.eval()
|
22 |
+
>>> response, history = model.chat(tokenizer, "你好", history=[])
|
23 |
+
>>> print(response)
|
24 |
+
```
|