Views
No views yet
mtranslate Python module, SQuAD2.0 was machine-translated. In order to find the start tokens, the direct translations of the answers were searched in the corresponding paragraphs. Due to the different translations depending on the context (missing context in the pure answer), the answer could not always be found in the text, and thus a loss of question-answer examples occurred. This is a potential problem where errors can occur in the data set.| Dataset | # Q&A |
|---|---|
| SQuAD2.0 Train | 130 K |
| Polish SQuAD2.0 Train | 83.1 K |
| SQuAD2.0 Dev | 12 K |
| Polish SQuAD2.0 Dev | 8.5 K |
| Model | EM/F1 | HasAns (EM/F1) | NoAns |
|---|---|---|---|
| SlavicBERT | 69.35/71.51 | 47.02/54.09 | 79.20 |
| polBERT | 67.33/69.80 | 45.73/53.80 | 76.87 |
| multiBERT | 70.76/72.92 | 45.00/52.04 | 82.13 |
1export SQUAD_DIR=path/to/pl_squad
2
3python run_squad.py
4 --model_type bert \
5 --model_name_or_path bert-base-multilingual-cased \
6 --do_train \
7 --do_eval \
8 --version_2_with_negative \
9 --train_file $SQUAD_DIR/pl_squadv2_train.json \
10 --predict_file $SQUAD_DIR/pl_squadv2_dev.json \
11 --num_train_epochs 2 \
12 --max_seq_length 384 \
13 --doc_stride 128 \
14 --save_steps=8000 \
15 --output_dir ../../output \
16 --overwrite_cache \
17 --overwrite_output_dir1from transformers import pipeline
2
3qa_pipeline = pipeline(
4 "question-answering",
5 model="henryk/bert-base-multilingual-cased-finetuned-polish-squad2",
6 tokenizer="henryk/bert-base-multilingual-cased-finetuned-polish-squad2"
7)
8
9qa_pipeline({
10 'context': "Warszawa jest największym miastem w Polsce pod względem liczby ludności i powierzchni",
11 'question': "Jakie jest największe miasto w Polsce?"})
121{
2 "score": 0.9986,
3 "start": 0,
4 "end": 8,
5 "answer": "Warszawa"
6}