add new ckpt
Browse files
README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- feature-extraction
|
4 |
+
language: zh
|
5 |
+
license: apache-2.0
|
6 |
+
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
## Usage (HuggingFace Transformers)
|
11 |
+
|
12 |
+
```
|
13 |
+
pip install transformers
|
14 |
+
```
|
15 |
+
|
16 |
+
```python
|
17 |
+
from transformers import CPMAntTokenizer, CPMAntModel
|
18 |
+
|
19 |
+
texts = ["今天天气真好!"]
|
20 |
+
model = CPMAntModel.from_pretrained("openbmb/cpm-ant-10b")
|
21 |
+
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
|
22 |
+
input_ids = tokenizer.get_model_input(texts)
|
23 |
+
logits, hidden = model(**input_ids)
|
24 |
+
|
25 |
+
print(logits.shape)
|
26 |
+
print(hidden.shape)
|
27 |
+
```
|
28 |
+
## pipeline
|
29 |
+
```python
|
30 |
+
texts = ["昨天多云转阴,", "今天天气不错,"]
|
31 |
+
generator = pipeline("text-generation", model="openbmb/cpm-ant-10b", tokenizer="openbmb/cpm-ant-10b")
|
32 |
+
result = generator(texts)
|
33 |
+
print(result)
|
34 |
+
```
|