Coder Social home page Coder Social logo

cooelf / dcsr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chengzhipanpan/dcsr

1.0 0.0 0.0 13.29 MB

Sentence-aware Contrastive Learning for Open-Domain Passage Retrieval (ACL2022)

Home Page: https://arxiv.org/abs/2110.07524

License: Other

Python 98.42% Shell 1.58%

dcsr's Introduction

DCSR

Code for Paper Sentence-aware Contrastive Learning for Open-Domain Passage Retrieval. ACL2022 Main Conference, Long Paper. DCSR aims to elliminate the occurence of Contrastive Conflicts, in order to provide a more general dense retriever model for pratical use.

This code is mainly based on DPR. We thank the their authors for open sourcing their code.

Features

Contrastive Conflicts

The problem of Contrastive Conflicts (left) and our Solution (right). Given that relationship between queries and documents is not one-to-one, some semantically different queries might be pulled together by the same document. We propose to alter the modelling granularity from document to contextual sentence to decrease the occurence of such conflicts.

Environment and Installation

DCSR uses the same environment as DPR. Experimentally we use python==3.7.11, pytorch==1.7.1

git clone https://github.com/chengzhipanpan/DCSR
cd DCSR
pip install -r requirements.txt
pip install en_core_web_sm-3.0.0-py3-none-any.whl

Data Preprocessing

# Prepare Data for Training
bash train_scripts/prepare_dataset.sh

# Prepare Data for Evaluation
bash train_scripts/prepare_wiki.sh

Training and Evaluation

Sample scripts for training

# training multiset
bash train_scripts/train_multiset.sh
# training NQ
bash train_scripts/train_nq.sh
# training SQuAD
bash train_scripts/train_squad1.sh
# training Trivia
bash train_scripts/train_trivia.sh

Sample script for evaluation

bash train_scripts/eval_multiset.sh

Pretrained Models

Our pretrained models can be accessed via the following links.

  1. NQ-single Google Drive
  2. Trivia-single Google Drive
  3. SQuAD-single Google Drive
  4. Multiset Google Drive

Citation

If you find this work useful, please cite the following paper:

@inproceedings{wu2022sentence,
  title={Sentence-aware Contrastive Learning for Open-Domain Passage Retrieval},
  author={Wu, Bohong and Zhang, Zhuosheng and Wang, Jinyuan and Zhao, Hai},
  booktitle={The 60th Annual Meeting of the Association for Computational Linguistics (ACL 2022)},
  year={2022}
}

dcsr's People

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.