Views
No views yet
| Link | |
|---|---|
| BART-Base | L=6/H=768 (Base) |
| BART-Large | L=12/H=1024 (Large) |
1>>> from transformers import BertTokenizer, BartForConditionalGeneration, Text2TextGenerationPipeline
2>>> tokenizer = BertTokenizer.from_pretrained("uer/bart-base-chinese-cluecorpussmall")
3>>> model = BartForConditionalGeneration.from_pretrained("uer/bart-base-chinese-cluecorpussmall")
4>>> text2text_generator = Text2TextGenerationPipeline(model, tokenizer)
5>>> text2text_generator("中国的首都是[MASK]京", max_length=50, do_sample=False)
6 [{'generated_text': '中 国 的 首 都 是 北 京'}]python3 preprocess.py --corpus_path corpora/cluecorpussmall_bert.txt \
--vocab_path models/google_zh_vocab.txt \
--dataset_path cluecorpussmall_bart_seq512_dataset.pt \
--processes_num 32 --seq_length 512 \
--data_processor bartpython3 pretrain.py --dataset_path cluecorpussmall_bart_seq512_dataset.pt \
--vocab_path models/google_zh_vocab.txt \
--config_path models/bart/base_config.json \
--output_model_path models/cluecorpussmall_bart_base_seq512_model.bin \
--world_size 8 --gpu_ranks 0 1 2 3 4 5 6 7 \
--total_steps 1000000 --save_checkpoint_steps 100000 --report_steps 50000 \
--learning_rate 5e-5 --batch_size 8 \
--span_masking --span_max_length 3python3 scripts/convert_bart_from_uer_to_huggingface.py --input_model_path models/cluecorpussmall_bart_base_seq512_model.bin-1000000 \
--output_model_path pytorch_model.bin \
--layers_num 6@article{lewis2019bart,
title={Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension},
author={Lewis, Mike and Liu, Yinhan and Goyal, Naman and Ghazvininejad, Marjan and Mohamed, Abdelrahman and Levy, Omer and Stoyanov, Ves and Zettlemoyer, Luke},
journal={arXiv preprint arXiv:1910.13461},
year={2019}
}
@article{zhao2019uer,
title={UER: An Open-Source Toolkit for Pre-training Models},
author={Zhao, Zhe and Chen, Hui and Zhang, Jinbin and Zhao, Xin and Liu, Tao and Lu, Wei and Chen, Xi and Deng, Haotang and Ju, Qi and Du, Xiaoyong},
journal={EMNLP-IJCNLP 2019},
pages={241},
year={2019}
}
@article{zhao2023tencentpretrain,
title={TencentPretrain: A Scalable and Flexible Toolkit for Pre-training Models of Different Modalities},
author={Zhao, Zhe and Li, Yudong and Hou, Cheng and Zhao, Jing and others},
journal={ACL 2023},
pages={217},
year={2023}