Back to all models
question-answering mask_token: [MASK]
Query this model
🔥 This model is currently loaded and running on the Inference API. ⚠️ This model could not be loaded by the inference API. ⚠️ This model can be loaded on the Inference API on-demand.
JSON Output
API endpoint  

⚡️ Upgrade your account to access the Inference API

Share Copied link to clipboard

Monthly model downloads

henryk/bert-base-multilingual-cased-finetuned-polish-squad1 henryk/bert-base-multilingual-cased-finetuned-polish-squad1
last 30 days



Contributed by

henryk Henryk Borzymowski
4 models

How to use this model directly from the 🤗/transformers library:

Copy to clipboard
from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("henryk/bert-base-multilingual-cased-finetuned-polish-squad1") model = AutoModelForQuestionAnswering.from_pretrained("henryk/bert-base-multilingual-cased-finetuned-polish-squad1")

Multilingual + Polish SQuAD1.1

This model is the multilingual model provided by the Google research team with a fine-tuned polish Q&A downstream task.

Details of the language model

Language model (bert-base-multilingual-cased): 12-layer, 768-hidden, 12-heads, 110M parameters. Trained on cased text in the top 104 languages with the largest Wikipedias.

Details of the downstream task

Using the mtranslate Python module, SQuAD1.1 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
SQuAD1.1 Train 87.7 K
Polish SQuAD1.1 Train 39.5 K
SQuAD1.1 Dev 10.6 K
Polish SQuAD1.1 Dev 2.6 K

Model benchmark

Model EM F1
SlavicBERT 60.89 71.68
polBERT 57.46 68.87
multiBERT 60.67 71.89
xlm 47.98 59.42

Model training

The model was trained on a Tesla V100 GPU with the following command:

export SQUAD_DIR=path/to/pl_squad

  --model_type bert \
  --model_name_or_path bert-base-multilingual-cased \
  --do_train \
  --do_eval \
  --train_file $SQUAD_DIR/pl_squadv1_train_clean.json \
  --predict_file $SQUAD_DIR/pl_squadv1_dev_clean.json \
  --num_train_epochs 2 \
  --max_seq_length 384 \
  --doc_stride 128 \
  --save_steps=8000 \
  --output_dir ../../output \
  --overwrite_cache \


{'exact': 60.670731707317074, 'f1': 71.8952193697293, 'total': 2624, 'HasAns_exact': 60.670731707317074, 'HasAns_f1': 71.8952193697293, 'HasAns_total': 2624, 'best_exact': 60.670731707317074, 'best_exact_thresh': 0.0, 'best_f1': 71.8952193697293, 'best_f1_thresh': 0.0}

Model in action

Fast usage with pipelines:

from transformers import pipeline

qa_pipeline = pipeline(

    'context': "Warszawa jest największym miastem w Polsce pod względem liczby ludności i powierzchni",
    'question': "Jakie jest największe miasto w Polsce?"})


  "score": 0.9988,
  "start": 0, 
  "end": 8,
  "answer": "Warszawa"


Please do not hesitate to contact me via LinkedIn if you want to discuss or get access to the Polish version of SQuAD.