
# Chinese RoBERTa-Base Model for QA

## Model description

The model is used for extractive question answering. It is fine-tuned by [UER-py](https://github.com/dbiir/UER-py/), which is introduced in [this paper](https://arxiv.org/abs/1909.05658). Besides, the model could also be fine-tuned by [TencentPretrain](https://github.com/Tencent/TencentPretrain) introduced in [this paper](https://arxiv.org/abs/2212.06385), which inherits UER-py to support models with parameters above one billion, and extends it to a multimodal pre-training framework.

You can download the model either from the [UER-py Modelzoo page](https://github.com/dbiir/UER-py/wiki/Modelzoo), or via HuggingFace from the link [roberta-base-chinese-extractive-qa](https://huggingface.co/uer/roberta-base-chinese-extractive-qa).

## How to use

You can use the model directly with a pipeline for extractive question answering:

```python
>>> from transformers import AutoModelForQuestionAnswering,AutoTokenizer,pipeline
>>> model = AutoModelForQuestionAnswering.from_pretrained('uer/roberta-base-chinese-extractive-qa')
>>> tokenizer = AutoTokenizer.from_pretrained('uer/roberta-base-chinese-extractive-qa')
>>> QA = pipeline('question-answering', model=model, tokenizer=tokenizer)
>>> QA_input = {'question': "著名诗歌《假如生活欺骗了你》的作者是",'context': "普希金从那里学习人民的语言，吸取了许多有益的养料，这一切对普希金后来的创作产生了很大的影响。这两年里，普希金创作了不少优秀的作品，如《囚徒》、《致大海》、《致凯恩》和《假如生活欺骗了你》等几十首抒情诗，叙事诗《努林伯爵》，历史剧《鲍里斯·戈都诺夫》，以及《叶甫盖尼·奥涅金》前六章。"}
>>> QA(QA_input)
    {'score': 0.9766426682472229, 'start': 0, 'end': 3, 'answer': '普希金'}
```

## Training data

Training data comes from three sources: [cmrc2018](https://github.com/ymcui/cmrc2018), [webqa](https://spaces.ac.cn/archives/4338), and [laisi](https://www.kesci.com/home/competition/5d142d8cbb14e6002c04e14a/content/0). We only use the train set of three datasets.

## Training procedure

The model is fine-tuned by [UER-py](https://github.com/dbiir/UER-py/) on [Tencent Cloud](https://cloud.tencent.com/). We fine-tune three epochs with a sequence length of 512 on the basis of the pre-trained model [chinese_roberta_L-12_H-768](https://huggingface.co/uer/chinese_roberta_L-12_H-768). At the end of each epoch, the model is saved when the best performance on development set is achieved.

```
python3 finetune/run_cmrc.py --pretrained_model_path models/cluecorpussmall_roberta_base_seq512_model.bin-250000 \
                             --vocab_path models/google_zh_vocab.txt \
                             --train_path datasets/extractive_qa.json \
                             --dev_path datasets/cmrc2018/dev.json \
                             --output_model_path models/extractive_qa_model.bin \
                             --learning_rate 3e-5 --epochs_num 3 --batch_size 32 --seq_length 512
```

Finally, we convert the fine-tuned model into Huggingface's format:

```
python3 scripts/convert_bert_extractive_qa_from_uer_to_huggingface.py --input_model_path models/extractive_qa_model.bin \
                                                                      --output_model_path pytorch_model.bin \
                                                                      --layers_num 12
```

### BibTeX entry and citation info

```
@article{liu2019roberta,
  title={Roberta: A robustly optimized bert pretraining approach},
  author={Liu, Yinhan and Ott, Myle and Goyal, Naman and Du, Jingfei and Joshi, Mandar and Chen, Danqi and Levy, Omer and Lewis, Mike and Zettlemoyer, Luke and Stoyanov, Veselin},
  journal={arXiv preprint arXiv:1907.11692},
  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}
```
{"language": "zh", "widget": [{"text": "\u8457\u540d\u8bd7\u6b4c\u300a\u5047\u5982\u751f\u6d3b\u6b3a\u9a97\u4e86\u4f60\u300b\u7684\u4f5c\u8005\u662f", "context": "\u666e\u5e0c\u91d1\u4ece\u90a3\u91cc\u5b66\u4e60\u4eba\u6c11\u7684\u8bed\u8a00\uff0c\u5438\u53d6\u4e86\u8bb8\u591a\u6709\u76ca\u7684\u517b\u6599\uff0c\u8fd9\u4e00\u5207\u5bf9\u666e\u5e0c\u91d1\u540e\u6765\u7684\u521b\u4f5c\u4ea7\u751f\u4e86\u5f88\u5927\u7684\u5f71\u54cd\u3002\u8fd9\u4e24\u5e74\u91cc\uff0c\u666e\u5e0c\u91d1\u521b\u4f5c\u4e86\u4e0d\u5c11\u4f18\u79c0\u7684\u4f5c\u54c1\uff0c\u5982\u300a\u56da\u5f92\u300b\u3001\u300a\u81f4\u5927\u6d77\u300b\u3001\u300a\u81f4\u51ef\u6069\u300b\u548c\u300a\u5047\u5982\u751f\u6d3b\u6b3a\u9a97\u4e86\u4f60\u300b\u7b49\u51e0\u5341\u9996\u6292\u60c5\u8bd7\uff0c\u53d9\u4e8b\u8bd7\u300a\u52aa\u6797\u4f2f\u7235\u300b\uff0c\u5386\u53f2\u5267\u300a\u9c8d\u91cc\u65af\u00b7\u6208\u90fd\u8bfa\u592b\u300b\uff0c\u4ee5\u53ca\u300a\u53f6\u752b\u76d6\u5c3c\u00b7\u5965\u6d85\u91d1\u300b\u524d\u516d\u7ae0\u3002"}]}
transformers pytorch tf jax bert question-answering zh arxiv:1909.05658 arxiv:2212.06385 endpoints_compatible has_space region:us
TAGS
#transformers #pytorch #tf #jax #bert #question-answering #zh #arxiv-1909.05658 #arxiv-2212.06385 #endpoints_compatible #has_space #region-us 


# Chinese RoBERTa-Base Model for QA

## Model description

The model is used for extractive question answering. It is fine-tuned by UER-py, which is introduced in this paper. Besides, the model could also be fine-tuned by TencentPretrain introduced in this paper, which inherits UER-py to support models with parameters above one billion, and extends it to a multimodal pre-training framework.

You can download the model either from the UER-py Modelzoo page, or via HuggingFace from the link roberta-base-chinese-extractive-qa.

## How to use

You can use the model directly with a pipeline for extractive question answering:



## Training data

Training data comes from three sources: cmrc2018, webqa, and laisi. We only use the train set of three datasets.

## Training procedure

The model is fine-tuned by UER-py on Tencent Cloud. We fine-tune three epochs with a sequence length of 512 on the basis of the pre-trained model chinese_roberta_L-12_H-768. At the end of each epoch, the model is saved when the best performance on development set is achieved.



Finally, we convert the fine-tuned model into Huggingface's format:



### BibTeX entry and citation info


# Chinese RoBERTa-Base Model for QA ## Model description

The model is used for extractive question answering. It is fine-tuned by UER-py, which is introduced in this paper. Besides, the model could also be fine-tuned by TencentPretrain introduced in this paper, which inherits UER-py to support models with parameters above one billion, and extends it to a multimodal pre-training framework.

You can download the model either from the UER-py Modelzoo page, or via HuggingFace from the link roberta-base-chinese-extractive-qa. ## How to use

You can use the model directly with a pipeline for extractive question answering: ## Training data

Training data comes from three sources: cmrc2018, webqa, and laisi. We only use the train set of three datasets. ## Training procedure

The model is fine-tuned by UER-py on Tencent Cloud. We fine-tune three epochs with a sequence length of 512 on the basis of the pre-trained model chinese_roberta_L-12_H-768. At the end of each epoch, the model is saved when the best performance on development set is achieved.



Finally, we convert the fine-tuned model into Huggingface's format: ### BibTeX entry and citation info
TAGS
#transformers #pytorch #tf #jax #bert #question-answering #zh #arxiv-1909.05658 #arxiv-2212.06385 #endpoints_compatible #has_space #region-us 
 # Chinese RoBERTa-Base Model for QA ## Model description

The model is used for extractive question answering. It is fine-tuned by UER-py, which is introduced in this paper. Besides, the model could also be fine-tuned by TencentPretrain introduced in this paper, which inherits UER-py to support models with parameters above one billion, and extends it to a multimodal pre-training framework.

You can download the model either from the UER-py Modelzoo page, or via HuggingFace from the link roberta-base-chinese-extractive-qa. ## How to use

You can use the model directly with a pipeline for extractive question answering: ## Training data

Training data comes from three sources: cmrc2018, webqa, and laisi. We only use the train set of three datasets. ## Training procedure

The model is fine-tuned by UER-py on Tencent Cloud. We fine-tune three epochs with a sequence length of 512 on the basis of the pre-trained model chinese_roberta_L-12_H-768. At the end of each epoch, the model is saved when the best performance on development set is achieved.



Finally, we convert the fine-tuned model into Huggingface's format: ### BibTeX entry and citation info
passage: TAGS
#transformers #pytorch #tf #jax #bert #question-answering #zh #arxiv-1909.05658 #arxiv-2212.06385 #endpoints_compatible #has_space #region-us 
# Chinese RoBERTa-Base Model for QA## Model description

The model is used for extractive question answering. It is fine-tuned by UER-py, which is introduced in this paper. Besides, the model could also be fine-tuned by TencentPretrain introduced in this paper, which inherits UER-py to support models with parameters above one billion, and extends it to a multimodal pre-training framework.

You can download the model either from the UER-py Modelzoo page, or via HuggingFace from the link roberta-base-chinese-extractive-qa.## How to use

You can use the model directly with a pipeline for extractive question answering:## Training data

Training data comes from three sources: cmrc2018, webqa, and laisi. We only use the train set of three datasets.## Training procedure

The model is fine-tuned by UER-py on Tencent Cloud. We fine-tune three epochs with a sequence length of 512 on the basis of the pre-trained model chinese_roberta_L-12_H-768. At the end of each epoch, the model is saved when the best performance on development set is achieved.



Finally, we convert the fine-tuned model into Huggingface's format:### BibTeX entry and citation info