Update README.md
Browse files
README.md
CHANGED
@@ -12,10 +12,18 @@ widget:
|
|
12 |
## Model description
|
13 |
|
14 |
This model is pre-trained by [UER-py](https://arxiv.org/abs/1909.05658).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
## How to use
|
17 |
|
18 |
-
You can use this model directly with a pipeline for text2text generation :
|
19 |
|
20 |
```python
|
21 |
>>> from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
|
@@ -33,14 +41,14 @@ You can use this model directly with a pipeline for text2text generation :
|
|
33 |
## Training procedure
|
34 |
|
35 |
The model is pre-trained by [UER-py](https://github.com/dbiir/UER-py/) on [Tencent Cloud](https://cloud.tencent.com/). We pre-train 1,000,000 steps with a sequence length of 512.
|
36 |
-
|
37 |
|
38 |
```
|
39 |
python3 preprocess.py --corpus_path corpora/cluecorpussmall.txt \
|
40 |
--vocab_path models/google_zh_vocab.txt \
|
41 |
--dataset_path cluecorpussmall_bart_seq512_dataset.pt \
|
42 |
--processes_num 32 --seq_length 512 \
|
43 |
-
--data_processor bart
|
44 |
```
|
45 |
|
46 |
```
|
@@ -50,14 +58,14 @@ python3 pretrain.py --dataset_path cluecorpussmall_bart_seq512_dataset.pt \
|
|
50 |
--output_model_path models/cluecorpussmall_bart_base_seq512_model.bin \
|
51 |
--world_size 8 --gpu_ranks 0 1 2 3 4 5 6 7 \
|
52 |
--total_steps 1000000 --save_checkpoint_steps 100000 --report_steps 50000 \
|
53 |
-
--learning_rate
|
54 |
--span_masking --span_max_length 3
|
55 |
```
|
56 |
|
57 |
Finally, we convert the pre-trained model into Huggingface's format:
|
58 |
|
59 |
```
|
60 |
-
python3 scripts/convert_bart_from_uer_to_huggingface.py --input_model_path cluecorpussmall_bart_base_seq512_model.bin-
|
61 |
--output_model_path pytorch_model.bin \
|
62 |
--layers_num 6
|
63 |
```
|
@@ -80,4 +88,7 @@ python3 scripts/convert_bart_from_uer_to_huggingface.py --input_model_path cluec
|
|
80 |
pages={241},
|
81 |
year={2019}
|
82 |
}
|
83 |
-
```
|
|
|
|
|
|
|
|
12 |
## Model description
|
13 |
|
14 |
This model is pre-trained by [UER-py](https://arxiv.org/abs/1909.05658).
|
15 |
+
This model is pre-trained by [UER-py](https://github.com/dbiir/UER-py/), which is introduced in [this paper](https://arxiv.org/abs/1909.05658).
|
16 |
+
|
17 |
+
You can download the set of Chinese BART models either from the [UER-py Modelzoo page](https://github.com/dbiir/UER-py/wiki/Modelzoo), or via HuggingFace from the links below:
|
18 |
+
|
19 |
+
| | Link |
|
20 |
+
| ----------------- | :----------------------------: |
|
21 |
+
| **BART-Base** | [**L=6/H=768 (Base)**][base] |
|
22 |
+
| **BART-Large** | [**L=12/H=1024 (Large)**][large] |
|
23 |
|
24 |
## How to use
|
25 |
|
26 |
+
You can use this model directly with a pipeline for text2text generation (take the case of BART-Base):
|
27 |
|
28 |
```python
|
29 |
>>> from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
|
|
|
41 |
## Training procedure
|
42 |
|
43 |
The model is pre-trained by [UER-py](https://github.com/dbiir/UER-py/) on [Tencent Cloud](https://cloud.tencent.com/). We pre-train 1,000,000 steps with a sequence length of 512.
|
44 |
+
Taking the case of BART-Base
|
45 |
|
46 |
```
|
47 |
python3 preprocess.py --corpus_path corpora/cluecorpussmall.txt \
|
48 |
--vocab_path models/google_zh_vocab.txt \
|
49 |
--dataset_path cluecorpussmall_bart_seq512_dataset.pt \
|
50 |
--processes_num 32 --seq_length 512 \
|
51 |
+
--data_processor bart
|
52 |
```
|
53 |
|
54 |
```
|
|
|
58 |
--output_model_path models/cluecorpussmall_bart_base_seq512_model.bin \
|
59 |
--world_size 8 --gpu_ranks 0 1 2 3 4 5 6 7 \
|
60 |
--total_steps 1000000 --save_checkpoint_steps 100000 --report_steps 50000 \
|
61 |
+
--learning_rate 5e-5 --batch_size 8 \
|
62 |
--span_masking --span_max_length 3
|
63 |
```
|
64 |
|
65 |
Finally, we convert the pre-trained model into Huggingface's format:
|
66 |
|
67 |
```
|
68 |
+
python3 scripts/convert_bart_from_uer_to_huggingface.py --input_model_path cluecorpussmall_bart_base_seq512_model.bin-1000000 \
|
69 |
--output_model_path pytorch_model.bin \
|
70 |
--layers_num 6
|
71 |
```
|
|
|
88 |
pages={241},
|
89 |
year={2019}
|
90 |
}
|
91 |
+
```
|
92 |
+
|
93 |
+
[base]:https://huggingface.co/uer/bart-base-chinese-cluecorpussmall
|
94 |
+
[large]:https://huggingface.co/uer/bart-large-chinese-cluecorpussmall
|