Skip to main content

Question-Answering system using state-of-the-art pre-trained language models.

Project description


Build question-answering systems using state-of-the-art pre-trained contextualized language models, e.g. BERT. We are working to accelerate the development of question-answering systems based on BERT and TF 2.0!


This project is based on our study: Question Generation by Transformers.


To cite this work, use the following BibTeX citation.

  title={Question Generation by Transformers},
  author={Kriangchaivech, Kettip and Wangperawong, Artit},
  journal={arXiv preprint arXiv:1909.05017},


TensorFlow 2.0 will be installed if not already on your system


pip install bert_qa

Example usage

Run Colab demo notebook here.

download pre-trained models and SQuAD data

wget -q
tar -xvzf uncased_L-12_H-768_A-12.tar.gz
mv -f home/hongkuny/public/pretrained_models/keras_bert/uncased_L-12_H-768_A-12 .

download SQuAD data

wget -q
wget -q

import, initialize, pre-process data, finetune, and predict!

from bert_qa import squad
qa = squad.SQuAD()
predictions = qa.predict()


import json
json_data = open('dev-v1.1.json')
data = json.load(json_data)
qa.evaluate(data, predictions)

Advanced usage

Model type

The default model is an uncased Bidirectional Encoder Representations from Transformers (BERT) consisting of 12 transformer layers, 12 self-attention heads per layer, and a hidden size of 768. Below are all models currently supported that you can specify with hub_module_handle. We expect that more will be added in the future. For more information, see TensorFlow's BERT GitHub.


BERT-QA is an open-source project founded and maintained to better serve the machine learning and data science community. Please feel free to submit pull requests to contribute to the project. By participating, you are expected to adhere to BERT-QA's code of conduct.


For questions or help using BERT-QA, please submit a GitHub issue.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bert_qa-0.0.5.tar.gz (91.0 kB view hashes)

Uploaded source

Built Distribution

bert_qa-0.0.5-py3-none-any.whl (116.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page