← 开源
cdqa-suite

cdQA

⛔ [NOT MAINTAINED] An End-To-End Closed Domain Question Answering System.

ApplicationsResearch & knowledgePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
616
Star
189
Fork
+0
本周
11
贡献者
创建于 2019-01-14 · 更新于 2026-09-09 · 今日第 16033 名
主要开发者

cdqa-suite/cdQA 排名第 16,033,有 616 个星标。

同类别比较

cdqa-suite/cdQA 排名第 16,033,此处有 8 个同类条目;ErickWendel/localstudio 排名第 16,028。

同类别比较
名称排名指标
josStorer/chatGPT-search-engine-extension16,021
语言:
JavaScript
星标数:
617
分叉数:
72
简介:
A browser extension to display ChatGPT response alongside Search Engine results
miantiao-me/bm.md16,022
语言:
TypeScript
星标数:
617
分叉数:
77
简介:
更好用的 Markdown 排版助手|专为微信公众号与多平台排版设计,支持富文本复制、图片生成与矢量 PDF 导出。
purefinance/mmb16,024
语言:
Rust
星标数:
617
分叉数:
102
简介:
Trading bot implemented in Rust, with market making and strategy automation for any exchange or blockchain.
ErickWendel/localstudio16,028
语言:
TypeScript
星标数:
616
分叉数:
35
简介:
Browser-only Canva-style presentation studio, powered by local Web AI.
liuzhao1225/YouDub16,045
语言:
Python
星标数:
615
分叉数:
66
简介:
Legacy YouDub AI video translation and voice-cloning pipeline. Active development continues in YouDub WebUI.
hofstadter-io/hof16,056
语言:
Go
星标数:
614
分叉数:
47
简介:
A developer experience centered on CUE. Unifies schemas, data models, deterministic and agentic code generation, workflow and task engine, dagger powered environments, coding assistant, and vscode extension; woven together on the CUE lattice. Squint harder if you can't see the cube :]
timmyy123/LLM-Hub16,060
语言:
C
星标数:
614
分叉数:
137
简介:
Local LLM, image&video&music generator, run codex with local models on your phone
abielzulio/chatgpt-raycast16,066
语言:
TypeScript
星标数:
613
分叉数:
50
简介:
ChatGPT raycast extension
关键参数与规格
关键参数与规格
参数值
语言Python
类别Applications
子类别Research & knowledge
星标数616
分叉数189
贡献者11
创建日期2019-01-14
更新日期2026-09-09
1 天星标数0
7 天星标数0
排名16,033
上次排名15,831
排名变化-202
7 天星标排名15,306
上次 7 天星标排名15,320
7 天星标排名变化14
总星标排名16,449
上次总星标排名16,419
总星标排名变化-30
国家France
README 摘录

cdQA: Closed Domain Question Answering An End-To-End Closed Domain Question Answering System. Built on top of the HuggingFace transformers library. **⛔ [NOT MAINTAINED] This repository is no longer maintained, but is being kept around for educational purposes. If you want a maintained alternative to cdQA check out: cdQA in details If you are interested in understanding how the system works and its implementation, we wrote an article on Medium with a high-level explanation. We also made a presentation

during the \#9 NLP Breakfast organised by Feedly. Table of Contents Installation With pip From source Hardware Requirements Getting started Preparing your data Downloading pre-trained models Training models Making predictions Evaluating models Notebook Examples Deployment Manual Contributing References LICENSE Installation With pip From source Hardware Requirements Experiments have been done with: **CPU** 👉 AWS EC2 Deep Learning AMI (Ubuntu) Version 22. 0 **GPU** 👉 AWS EC2 Deep Learning AMI (Ubuntu) Version 22. , Paragraph N of Article] | With converters The objective of

converters is to make it easy to create this dataframe from your raw documents database. For instance the can create a dataframe from a directory containing files: You will need to install Java OpenJDK to use this converter. We currently have converters for: pdf markdown We plan to improve and add more converters in the future. Downloading pre-trained models and data You can download the models and data manually from the GitHub releases or use our download functions: Training

models Fit the pipeline on your corpus using the pre-trained reader: If you want to fine-tune the reader on your custom SQuAD-like annotated dataset: Save the reader model after fine-tuning: Making predictions To get the best prediction given an input query: To get the N best predictions: There is also the possibility to change the weight of the retriever score versus the reader score in the computation of final ranking score (the default is 0. 35

, which is shown to be the best weight on the development set of SQuAD 1. 1-open) Evaluating models In order to evaluate models on your custom dataset you will need to annotate it. The annotation process can be done in 3 steps: 1. Convert your pandas DataFrame into a json file with SQuAD format: 2. Use an annotator to add ground truth question-answer pairs: 3. Evaluate the reader: Notebook Examples We prepared some notebook examples under the examples

directory. Deployment Manual You can deploy a REST API by executing: You can now make requests to test your API (here using HTTPie): If you wish to serve a user interface on top of your system, follow the instructions of cdQA-ui, a web interface developed for . Contributing Read our Contributing Guidelines. Smith | 2019 | | :newspaper: Paper | End-to-End Open-Domain Question Answering with BERTserini | Wei Yang, Yuqing Xie, Aileen Lin, Xingyu Li, Luchen Tan, Kun Xiong, Ming Li, Jimmy

Lin | 2019 | | :newspaper: Paper | Data Augmentation for BERT Fine-Tuning in Open-Domain Question Answering | Wei Yang, Yuqing Xie, Luchen

常见问题

记录了多少星标和分叉?

cdqa-suite/cdQA 有 616 个星标和 189 个分叉。

仓库排名是多少?

cdqa-suite/cdQA 排名第 16,033。

记录的语言和类别是什么?

cdqa-suite/cdQA 有 616 个星标,语言为 Python,类别为 Applications。

哪个仓库排名最接近?

cdqa-suite/cdQA 与 ErickWendel/localstudio 比较,后者排名第 16,028,有 616 个星标。

README

cdQA: Closed Domain Question Answering

An End-To-End Closed Domain Question Answering System. Built on top of the HuggingFace transformers library.

⛔ [NOT MAINTAINED] This repository is no longer maintained, but is being kept around for educational purposes. If you want a maintained alternative to cdQA check out: https://github.com/deepset-ai/haystack

cdQA in details

If you are interested in understanding how the system works and its implementation, we wrote an article on Medium with a high-level explanation.

We also made a presentation during the #9 NLP Breakfast organised by Feedly. You can check it out here.

Table of Contents

Installation

With pip

pip install cdqa

From source

git clone https://github.com/cdqa-suite/cdQA.git
cd cdQA
pip install -e .

Hardware Requirements

Experiments have been done with:

  • CPU 👉 AWS EC2 t2.medium Deep Learning AMI (Ubuntu) Version 22.0
  • GPU 👉 AWS EC2 p3.2xlarge Deep Learning AMI (Ubuntu) Version 22.0 + a single Tesla V100 16GB.

Getting started

Preparing your data

Manual

To use cdQA you need to create a pandas dataframe with the following columns:

title paragraphs
The Article Title [Paragraph 1 of Article, ... , Paragraph N of Article]

With converters

The objective of cdqa converters is to make it easy to create this dataframe from your raw documents database. For instance the pdf_converter can create a cdqa dataframe from a directory containing .pdf files:

from cdqa.utils.converters import pdf_converter

df = pdf_converter(directory_path='path_to_pdf_folder')

You will need to install Java OpenJDK to use this converter. We currently have converters for:

  • pdf
  • markdown

We plan to improve and add more converters in the future. Stay tuned!

Downloading pre-trained models and data

You can download the models and data manually from the GitHub releases or use our download functions:

from cdqa.utils.download import download_squad, download_model, download_bnpp_data

directory = 'path-to-directory'

# Downloading data
download_squad(dir=directory)
download_bnpp_data(dir=directory)

# Downloading pre-trained BERT fine-tuned on SQuAD 1.1
download_model('bert-squad_1.1', dir=directory)

# Downloading pre-trained DistilBERT fine-tuned on SQuAD 1.1
download_model('distilbert-squad_1.1', dir=directory)

Training models

Fit the pipeline on your corpus using the pre-trained reader:

import pandas as pd
from ast import literal_eval
from cdqa.pipeline import QAPipeline

df = pd.read_csv('your-custom-corpus-here.csv', converters={'paragraphs': literal_eval})

cdqa_pipeline = QAPipeline(reader='bert_qa.joblib') # use 'distilbert_qa.joblib' for DistilBERT instead of BERT
cdqa_pipeline.fit_retriever(df=df)

If you want to fine-tune the reader on your custom SQuAD-like annotated dataset:

cdqa_pipeline = QAPipeline(reader='bert_qa.joblib') # use 'distilbert_qa.joblib' for DistilBERT instead of BERT
cdqa_pipeline.fit_reader('path-to-custom-squad-like-dataset.json')

Save the reader model after fine-tuning:

cdqa_pipeline.dump_reader('path-to-save-bert-reader.joblib')

Making predictions

To get the best prediction given an input query:

cdqa_pipeline.predict(query='your question')

To get the N best predictions:

cdqa_pipeline.predict(query='your question', n_predictions=N)

There is also the possibility to change the weight of the retriever score versus the reader score in the computation of final ranking score (the default is 0.35, which is shown to be the best weight on the development set of SQuAD 1.1-open)

cdqa_pipeline.predict(query='your question', retriever_score_weight=0.35)

Evaluating models

In order to evaluate models on your custom dataset you will need to annotate it. The annotation process can be done in 3 steps:

  1. Convert your pandas DataFrame into a json file with SQuAD format:

    from cdqa.utils.converters import df2squad
    
    json_data = df2squad(df=df, squad_version='v1.1', output_dir='.', filename='dataset-name')
    
  2. Use an annotator to add ground truth question-answer pairs:

    Please refer to our cdQA-annotator, a web-based annotator for closed-domain question answering datasets with SQuAD format.

  3. Evaluate the pipeline object:

    from cdqa.utils.evaluation import evaluate_pipeline
    
    evaluate_pipeline(cdqa_pipeline, 'path-to-annotated-dataset.json')
    
    
  4. Evaluate the reader:

    from cdqa.utils.evaluation import evaluate_reader
    
    evaluate_reader(cdqa_pipeline, 'path-to-annotated-dataset.json')
    

Notebook Examples

We prepared some notebook examples under the examples directory.

You can also play directly with these notebook examples using Binder or Google Colaboratory:

Notebook Hardware Platform
[1] First steps with cdQA CPU or GPU
[2] Using the PDF converter CPU or GPU
[3] Training the reader on SQuAD GPU

Binder and Google Colaboratory provide temporary environments and may be slow to start but we recommend them if you want to get started with cdQA easily.

Deployment

Manual

You can deploy a cdQA REST API by executing:

export dataset_path=path-to-dataset.csv
export reader_path=path-to-reader-model

FLASK_APP=api.py flask run -h 0.0.0.0

You can now make requests to test your API (here using HTTPie):

http localhost:5000/api query=='your question here'

If you wish to serve a user interface on top of your cdQA system, follow the instructions of cdQA-ui, a web interface developed for cdQA.

Contributing

Read our Contributing Guidelines.

References

Type Title Author Year
:video_camera: Video Stanford CS224N: NLP with Deep Learning Lecture 10 – Question Answering Christopher Manning 2019
:newspaper: Paper Reading Wikipedia to Answer Open-Domain Questions Danqi Chen, Adam Fisch, Jason Weston, Antoine Bordes 2017
:newspaper: Paper Neural Reading Comprehension and Beyond Danqi Chen 2018
:newspaper: Paper BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding Jacob Devlin, Ming-Wei Chang, Kenton Lee, Kristina Toutanova 2018
:newspaper: Paper Contextual Word Representations: A Contextual Introduction Noah A. Smith 2019
:newspaper: Paper End-to-End Open-Domain Question Answering with BERTserini Wei Yang, Yuqing Xie, Aileen Lin, Xingyu Li, Luchen Tan, Kun Xiong, Ming Li, Jimmy Lin 2019
:newspaper: Paper Data Augmentation for BERT Fine-Tuning in Open-Domain Question Answering Wei Yang, Yuqing Xie, Luchen Tan, Kun Xiong, Ming Li, Jimmy Lin 2019
:newspaper: Paper Passage Re-ranking with BERT Rodrigo Nogueira, Kyunghyun Cho 2019
:newspaper: Paper MRQA: Machine Reading for Question Answering Jonathan Berant, Percy Liang, Luke Zettlemoyer 2019
:newspaper: Paper Unsupervised Question Answering by Cloze Translation Patrick Lewis, Ludovic Denoyer, Sebastian Riedel 2019
:computer: Framework Scikit-learn: Machine Learning in Python Pedregosa et al. 2011
:computer: Framework PyTorch Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan 2016
:computer: Framework Transformers: State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch. Hugging Face 2018

LICENSE

Apache-2.0

排名相邻
同类项目