add readme
Browse files
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Chinese BART-Large
|
2 |
+
|
3 |
+
## Model description
|
4 |
+
|
5 |
+
This is an implementation of Chinese BART-Large.
|
6 |
+
|
7 |
+
## Usage
|
8 |
+
|
9 |
+
```python
|
10 |
+
>>> from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
|
11 |
+
>>> tokenizer = BertTokenizer.from_pretrained("fnlp/bart-large-chinese")
|
12 |
+
>>> model = BartForConditionalGeneration.from_pretrained("fnlp/bart-large-chinese")
|
13 |
+
>>> text2text_generator = Text2TextGenerationPipeline(model, tokenizer)
|
14 |
+
>>> text2text_generator("北京是[MASK]的首都", max_length=50, do_sample=False)
|
15 |
+
[{'generated_text': '北 京 是 中 华 人 民 共 和 国 的 首 都'}]
|
16 |
+
```
|
17 |
+
|
18 |
+
**Note: Please use BertTokenizer for the model vocabulary. DO NOT use original BartTokenizer.**
|
19 |
+
|
20 |
+
## Citation
|
21 |
+
|
22 |
+
```bibtex
|
23 |
+
@article{shao2021cpt,
|
24 |
+
title={CPT: A Pre-Trained Unbalanced Transformer for Both Chinese Language Understanding and Generation},
|
25 |
+
author={Yunfan Shao and Zhichao Geng and Yitao Liu and Junqi Dai and Fei Yang and Li Zhe and Hujun Bao and Xipeng Qiu},
|
26 |
+
journal={arXiv preprint arXiv:2109.05729},
|
27 |
+
year={2021}
|
28 |
+
}
|
29 |
+
```
|
30 |
+
|