Update README.md
Browse files
README.md
CHANGED
@@ -15,16 +15,16 @@ pip install transformers
|
|
15 |
```
|
16 |
|
17 |
```python
|
18 |
-
from transformers import CPMAntTokenizer,
|
19 |
|
20 |
-
texts =
|
21 |
-
model =
|
22 |
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
|
23 |
-
input_ids = tokenizer
|
24 |
-
|
|
|
25 |
|
26 |
-
print(
|
27 |
-
print(hidden.shape)
|
28 |
```
|
29 |
## pipeline
|
30 |
```python
|
|
|
15 |
```
|
16 |
|
17 |
```python
|
18 |
+
from transformers import CPMAntTokenizer, CPMAntForCausalLM
|
19 |
|
20 |
+
texts = "今天天气真好!"
|
21 |
+
model = CPMAntForCausalLM.from_pretrained("openbmb/cpm-ant-10b")
|
22 |
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
|
23 |
+
input_ids = tokenizer(texts, return_tensors="pt")
|
24 |
+
outputs = model.generate(**input_ids)
|
25 |
+
output_texts = tokenizer.batch_decode(outputs)
|
26 |
|
27 |
+
print(output_texts)
|
|
|
28 |
```
|
29 |
## pipeline
|
30 |
```python
|