File size: 767 Bytes
9bcff91 9866627 9bcff91 2ae4f3f 9bcff91 2ae4f3f 9bcff91 1018474 9bcff91 695434a 1018474 9bcff91 1018474 9bcff91 1018474 9bcff91 695434a 9bcff91 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
---
tags:
- text-generation
language: zh
---
## Note
**This repo is under development.**
## Usage
```
pip install transformers
```
```python
from transformers import CPMAntTokenizer, CPMAntForCausalLM
texts = "今天天气不错,"
model = CPMAntForCausalLM.from_pretrained("openbmb/cpm-ant-10b")
tokenizer = CPMAntTokenizer.from_pretrained("openbmb/cpm-ant-10b")
input_ids = tokenizer(texts, return_tensors="pt")
outputs = model.generate(**input_ids)
output_texts = tokenizer.batch_decode(outputs)
print(output_texts)
```
## pipeline
```python
texts = ["今天天气不错,","新年快乐,万事如意,"]
generator = pipeline("text-generation", model="openbmb/cpm-ant-10b", tokenizer="openbmb/cpm-ant-10b")
result = generator(texts)
print(result)
``` |