Update README.md
Browse files
README.md
CHANGED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- text2text-generation
|
4 |
+
- Chinese
|
5 |
+
- seq2seq
|
6 |
+
- BART
|
7 |
+
language: zh
|
8 |
+
---
|
9 |
+
|
10 |
+
# Chinese BART-Base
|
11 |
+
|
12 |
+
## Model description
|
13 |
+
|
14 |
+
This is an implementation of Chinese BART-Base.
|
15 |
+
|
16 |
+
[**CPT: A Pre-Trained Unbalanced Transformer for Both Chinese Language Understanding and Generation**](https://arxiv.org/pdf/2109.05729.pdf)
|
17 |
+
|
18 |
+
Yunfan Shao, Zhichao Geng, Yitao Liu, Junqi Dai, Fei Yang, Li Zhe, Hujun Bao, Xipeng Qiu
|
19 |
+
|
20 |
+
**Github Link:** https://github.com/fastnlp/CPT
|
21 |
+
|
22 |
+
|
23 |
+
## Usage
|
24 |
+
|
25 |
+
```python
|
26 |
+
>>> from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
|
27 |
+
>>> tokenizer = BertTokenizer.from_pretrained("fnlp/bart-base-chinese")
|
28 |
+
>>> model = BartForConditionalGeneration.from_pretrained("fnlp/bart-base-chinese")
|
29 |
+
>>> text2text_generator = Text2TextGenerationPipeline(model, tokenizer)
|
30 |
+
>>> text2text_generator("北京是[MASK]的首都", max_length=50, do_sample=False)
|
31 |
+
[{'generated_text': '北 京 是 中 国 的 首 都'}]
|
32 |
+
```
|
33 |
+
|
34 |
+
**Note: Please use BertTokenizer for the model vocabulary. DO NOT use original BartTokenizer.**
|
35 |
+
|
36 |
+
## Citation
|
37 |
+
|
38 |
+
```bibtex
|
39 |
+
@article{shao2021cpt,
|
40 |
+
title={CPT: A Pre-Trained Unbalanced Transformer for Both Chinese Language Understanding and Generation},
|
41 |
+
author={Yunfan Shao and Zhichao Geng and Yitao Liu and Junqi Dai and Fei Yang and Li Zhe and Hujun Bao and Xipeng Qiu},
|
42 |
+
journal={arXiv preprint arXiv:2109.05729},
|
43 |
+
year={2021}
|
44 |
+
}
|
45 |
+
```
|