Metadata-Version: 2.1
Name: primeqa
Version: 0.7.0
Summary: State-of-the-art Question Answering
Home-page: https://github.com/primeqa/primeqa
Author: Bhavani Iyer <bsiyer@us.ibm.com>, Avirup Sil <avi@us.ibm.com>, Martin Franz <franzm@us.ibm.com>, Mihaela Bornea <mabornea@us.ibm.com>, Sara Rosenthal <sjrosenthal@us.ibm.com>, Avirup Sil <avi@us.ibm.com>, Scott McCarley <jsmc@us.ibm.com>, Rong Zhang <zhangr@us.ibm.com>, Jaydeep Sen <jaydesen@in.ibm.com>, Yulong Li <yulongli@us.ibm.com>, Md. Arafat Sultan <Arafat.Sultan@ibm.com>, Vishwajeet Kumar024 <vishk024@in.ibm.com>, Saneem A Chemmengath <saneem.cg@in.ibm.com>, Anthony Ferritto
Author-email: primeqa@us.ibm.com
License: Apache
Keywords: NLP transformers QA question answering mrc rc machine reading comprehension IR information retrieval deep learning pytorch BERT RoBERTa
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: GPU :: NVIDIA CUDA :: 11.3
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bitarray (~=2.3.7)
Requires-Dist: click (~=8.0.4)
Requires-Dist: cupy-cuda113 (~=10.4.0)
Requires-Dist: datasets (~=2.0.0)
Requires-Dist: faiss-cpu (~=1.7.2)
Requires-Dist: faiss-gpu (~=1.7.2)
Requires-Dist: gitpython (~=3.1.27)
Requires-Dist: jsonlines (~=3.0.0)
Requires-Dist: nltk (~=3.7)
Requires-Dist: numpy (~=1.21.5)
Requires-Dist: packaging (~=21.3)
Requires-Dist: pandas (~=1.3.5)
Requires-Dist: psutil (~=5.9.0)
Requires-Dist: pyserini (~=0.16.0)
Requires-Dist: scikit-learn (~=1.0.2)
Requires-Dist: signals (~=0.0.2)
Requires-Dist: spacy (~=3.2.2)
Requires-Dist: torch (~=1.11.0)
Requires-Dist: tqdm (~=4.64.0)
Requires-Dist: transformers (~=4.17.0)
Requires-Dist: ujson (~=5.1.0)
Provides-Extra: all
Requires-Dist: docutils (<0.18,>=0.14) ; extra == 'all'
Requires-Dist: bitarray (~=2.3.7) ; extra == 'all'
Requires-Dist: bump2version (~=1.0.1) ; extra == 'all'
Requires-Dist: click (~=8.0.4) ; extra == 'all'
Requires-Dist: cupy-cuda113 (~=10.4.0) ; extra == 'all'
Requires-Dist: datasets (~=2.0.0) ; extra == 'all'
Requires-Dist: myst-parser (~=0.17.2) ; extra == 'all'
Requires-Dist: faiss-cpu (~=1.7.2) ; extra == 'all'
Requires-Dist: faiss-gpu (~=1.7.2) ; extra == 'all'
Requires-Dist: gitpython (~=3.1.27) ; extra == 'all'
Requires-Dist: ipykernel (~=6.13.0) ; extra == 'all'
Requires-Dist: ipywidgets (~=7.7.0) ; extra == 'all'
Requires-Dist: jsonlines (~=3.0.0) ; extra == 'all'
Requires-Dist: nltk (~=3.7) ; extra == 'all'
Requires-Dist: numpy (~=1.21.5) ; extra == 'all'
Requires-Dist: packaging (~=21.3) ; extra == 'all'
Requires-Dist: pandas (~=1.3.5) ; extra == 'all'
Requires-Dist: psutil (~=5.9.0) ; extra == 'all'
Requires-Dist: pydata-sphinx-theme (~=0.8.0) ; extra == 'all'
Requires-Dist: pyserini (~=0.16.0) ; extra == 'all'
Requires-Dist: pytest (~=7.1.1) ; extra == 'all'
Requires-Dist: pytest-cov (~=3.0.0) ; extra == 'all'
Requires-Dist: pytest-mock (~=3.7.0) ; extra == 'all'
Requires-Dist: pytest-rerunfailures (~=10.2) ; extra == 'all'
Requires-Dist: scikit-learn (~=1.0.2) ; extra == 'all'
Requires-Dist: signals (~=0.0.2) ; extra == 'all'
Requires-Dist: spacy (~=3.2.2) ; extra == 'all'
Requires-Dist: sphinx (~=4.4.0) ; extra == 'all'
Requires-Dist: torch (~=1.11.0) ; extra == 'all'
Requires-Dist: tox (~=3.24.5) ; extra == 'all'
Requires-Dist: tqdm (~=4.64.0) ; extra == 'all'
Requires-Dist: transformers (~=4.17.0) ; extra == 'all'
Requires-Dist: ujson (~=5.1.0) ; extra == 'all'
Provides-Extra: dev
Requires-Dist: bump2version (~=1.0.1) ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser (~=0.17.2) ; extra == 'docs'
Requires-Dist: pydata-sphinx-theme (~=0.8.0) ; extra == 'docs'
Requires-Dist: sphinx (~=4.4.0) ; extra == 'docs'
Provides-Extra: install
Requires-Dist: bitarray (~=2.3.7) ; extra == 'install'
Requires-Dist: click (~=8.0.4) ; extra == 'install'
Requires-Dist: cupy-cuda113 (~=10.4.0) ; extra == 'install'
Requires-Dist: datasets (~=2.0.0) ; extra == 'install'
Requires-Dist: faiss-cpu (~=1.7.2) ; extra == 'install'
Requires-Dist: faiss-gpu (~=1.7.2) ; extra == 'install'
Requires-Dist: gitpython (~=3.1.27) ; extra == 'install'
Requires-Dist: jsonlines (~=3.0.0) ; extra == 'install'
Requires-Dist: nltk (~=3.7) ; extra == 'install'
Requires-Dist: numpy (~=1.21.5) ; extra == 'install'
Requires-Dist: packaging (~=21.3) ; extra == 'install'
Requires-Dist: pandas (~=1.3.5) ; extra == 'install'
Requires-Dist: psutil (~=5.9.0) ; extra == 'install'
Requires-Dist: pyserini (~=0.16.0) ; extra == 'install'
Requires-Dist: scikit-learn (~=1.0.2) ; extra == 'install'
Requires-Dist: signals (~=0.0.2) ; extra == 'install'
Requires-Dist: spacy (~=3.2.2) ; extra == 'install'
Requires-Dist: torch (~=1.11.0) ; extra == 'install'
Requires-Dist: tqdm (~=4.64.0) ; extra == 'install'
Requires-Dist: transformers (~=4.17.0) ; extra == 'install'
Requires-Dist: ujson (~=5.1.0) ; extra == 'install'
Provides-Extra: notebooks
Requires-Dist: ipykernel (~=6.13.0) ; extra == 'notebooks'
Requires-Dist: ipywidgets (~=7.7.0) ; extra == 'notebooks'
Provides-Extra: tests
Requires-Dist: docutils (<0.18,>=0.14) ; extra == 'tests'
Requires-Dist: pytest (~=7.1.1) ; extra == 'tests'
Requires-Dist: pytest-cov (~=3.0.0) ; extra == 'tests'
Requires-Dist: pytest-mock (~=3.7.0) ; extra == 'tests'
Requires-Dist: pytest-rerunfailures (~=10.2) ; extra == 'tests'
Requires-Dist: tox (~=3.24.5) ; extra == 'tests'

<!---
Copyright 2022 IBM Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# PrimeQA
<h3 align="center">
    <p>The prime repository for state-of-the-art Multilingual and Multimedia Question Answering research and development.</p>
</h3>

[![Build Status](https://app.travis-ci.com/primeqa/primeqa.svg?branch=main)](https://app.travis-ci.com/primeqa/primeqa)
[![LICENSE|Apache2.0](https://img.shields.io/github/license/saltstack/salt?color=blue)](https://www.apache.org/licenses/LICENSE-2.0.txt)

PrimeQA is a public open source repository that enables researchers and developers to train state-of-the-art models for question answering (QA). By using PrimeQA, a researcher can replicate the experiments outlined in a paper published in the latest NLP conference while also enjoying the capability to download pre-trained models (from an online repository) and run them on their own custom data.


The models within PrimeQA supports End-to-end Question Answering. PrimeQA answers questions via 
- Information Retrieval: Retrieving documents and passages using both traditional (e.g. BM25) and neural (e.g. ColBERT) models
- Machine Reading Comprehension: Extract and/ or generate answers given the source document or passage.
- Question Generation: Supports generation of questions for effective domain adaptation.

Some examples of models (applicable on benchmark datasets) supported are :
- [Traditional IR with BM25] Pyserini
- [Neural IR with ColBERT, DPR (coming soon)]: to replicate the experiments that Dr. Decr (Li et. al, 2022) performed to reach the top of the XOR TyDI leaderboard. Collaboration with [Stanford NLP](https://nlp.stanford.edu/) IR led by [Chris Potts](https://web.stanford.edu/~cgpotts/) & [Matei Zaharia](https://cs.stanford.edu/~matei/).
- [Machine Reading Comprehension with XLM-R]: to replicate the experiments to get to the top of the TyDI leaderboard similar to the performance of the IBM GAAMA system. Coming soon: code to replicate GAAMA's performance on Natural Questions. 
- [Multimedia QA over news & movies]: coming soon! to replicate the experiments run over multi-hop QA over images, text over variety of domains. Collaboration with [UIUC Blender lab](https://blender.cs.illinois.edu/).



## Getting Started

## Installation

```shell
# cd to project root

# If you want to run on GPU make sure to install torch appropriately

# E.g. for torch 1.11 + CUDA 11.3:
pip install 'torch~=1.11.0' --extra-index-url https://download.pytorch.org/whl/cu113

# Install as editable (-e) or non-editable using pip, with extras (e.g. tests) as desired
# Example installation commands:

# Minimal install (non-editable)
pip install .

# Full install (editable)
pip install -e .[all]
```

Please note that dependencies (specified in [setup.py](./setup.py)) are pinned to provide a stable experience.
When installing from source these can be modified, however this is not officially supported.

## JAVA requirements
Java 11 is required for BM25 retrieval. 

Download Java 11 package from https://jdk.java.net/archive/ and uncompress

Set JAVA_HOME:
```shell
export JAVA_HOME=<jdk-dir>
export PATH=$JAVA_HOME/bin:$PATH
```

## Unit Tests

To run the unit tests you first need to [install PrimeQA](#Installation).
Make sure to install with the `[tests]` or `[all]` extras from pip.

From there you can run the tests via pytest, for example:
```shell
pytest --cov PrimeQA --cov-config .coveragerc tests/
```

For more information, see:
- Our [tox.ini](./tox.ini)
- The [pytest](https://docs.pytest.org) and [tox](https://tox.wiki/en/latest/) documentation


