Update README.md
Browse files
README.md
CHANGED
|
@@ -15,10 +15,10 @@ widget:
|
|
| 15 |
---
|
| 16 |
### How to use
|
| 17 |
```python
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
```
|
|
|
|
| 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 |
```
|