Skip to content

A functional prototype of an open-domain QA system using a fine-tuned DistilBERT model.

License

Notifications You must be signed in to change notification settings

juanroesel/open-domain-qa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic QA system using BERT

This repo contains code to build a simple inference API using Django REST Framework to demonstrate question-answering through a DistilBERT QA model fine-tuned on the SQuAD dataset.

Requirements

Instructions

  1. Clone the repository into a local folder
$ git clone <repo url>
  1. Create a local postgres database with the following credentials:
NAME=odqa_db
USER=dev
PASSWORD=dev
  1. Download train, dev and test files containing subset of SQUAD data into a /data directory at the root level - Link to data

  2. Download the latest model checkpoint from this folder and put it into a ckpt directory at the root level.

  3. Create a virtual environment and install dependencies

$ virtualenv venv
$ source venv/bin/activate
$ (venv) pip install -r requirements.txt
  1. Navigate to the Django project directory odqabert and launch the Django development server
$ cd odqabert
$ (venv) opdqabert % python manage.py runserver

You should see the following output in your terminal:

INFO:bert_model.apps:2022-05-24 01:51:53.627196+00:00 - Loading QA BERT model from path /Users/juanavalanche/Desktop/open_domain_QA/ckpt
INFO:bert_model.apps:2022-05-24 01:51:59.352528+00:00 - QA BERT model loaded into memory
INFO:bert_model.apps:2022-05-24 01:52:01.230258+00:00 - Loading QA BERT model from path /Users/juanavalanche/Desktop/open_domain_QA/ckpt
INFO:bert_model.apps:2022-05-24 01:52:05.643590+00:00 - QA BERT model loaded into memory
Watching for file changes with StatReloader
INFO:django.utils.autoreload:Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
May 24, 2022 - 01:52:06
Django version 4.0.4, using settings 'odqabert.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
  1. Click on http://127.0.0.1:8000/ to start interacting with the system

About

A functional prototype of an open-domain QA system using a fine-tuned DistilBERT model.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published