Coder Social home page Coder Social logo

generative-multihop-retrieval's Introduction

Generative-Multihop-Retrieval

alt text

This is the official github repository for Generative Multihop Retrieval, accepted at EMNLP 2022.

Use the following to cite our paper:

@inproceedings{Lee2022GenerativeMR,
  title={Generative Multi-hop Retrieval},
  author={Hyunji Lee and Sohee Yang and Hanseok Oh and Minjoon Seo},
  booktitle={Conference on Empirical Methods in Natural Language Processing},
  year={2022}
}

In order to reproduce our results, take the following steps:

1. Create conda environment and install requirements

conda create -n gmr python=3.7 && conda activate gmr
pip install -r requirements.txt

2. Download the data used for the experiments.

  1. EntailmentBank
  2. StrategyQA
  3. Explagraphs-Open
  4. RuleTaker-Open
  5. HotpotQA

Detailed preprocessing code is in process

3. Set Config

Components in each configurations file

{
    "output_dir" (str): output directory to save all ckpt
    "dataset" (str): path to the dataset
    "model" (str): ['t5-base', 't5-large']
    "max_input_length" (int): max input length
    "max_output_length" (int): max output length
    "learning_rate" (float): learning rate (default: 1e-4)
    "lr_scheduler" (str): scheduler ['constant', 'exponential']
    "num_train_epochs" (int): training epoch (default: 150 with early stopping)
    "train_batch_size" (int): batch size for eval (default: 120)
    "eval_batch_size" (int): batch size for eval
    "gradient_accumulation_steps" (int): gradient accumulation size
    "n_gpu" (int): # of gpus
    "num_workers" (int): # of cpus
    "resume_from_checkpoint" (str): when resume training from ckpt
    "seed" (int): seed (default: 101)
    "check_val_every_n_epoch" (int): freq of validation (default: 3)
    "train_file" (str): path to train dataset
    "dev_file" (str): path to dev dataset
    "test_file" (str): path to test dataset
    "prefix_tree" (str): path to prefix tree
    "constrained_decoding" (bool): [true (default) | false]
    "do_train" (bool): [true | false], true if in train step else false
    "do_test" (bool): [true | false], true if in test step else false
    "setting" (str): ["ret_fixed", "ret_dynamic", "LM_mem", "multihop_mem"]
    "test_model_path" (str): path to test ckpt
    "beam_size" (int): beam size
    "ret_num" (int): # of sequences to return
    "wandb_log" (bool): log in wandb
    "wandb_project" (str): project name in wandb
    "wandb_run_name" (str): run name in wandb
    "accelerator" (str): [ddp (default) | deepspeed] 
}

4. Train Model

  • config setting:
    do_train: true
    do_test: false
    

Memorization Step

python train.py --config config/*

We are in the process of releasing code for memorization step!

  • Language Model Memorization
    • setting in config should be LM_mem
  • Multihop Memorization
    • setting in config should be multihop_mem

Retrieval Step

python train.py --config config/*
  • Fixed Setting
    • setting in config should be ret_fixed
  • Dynamic Setting
    • setting in config should be ret_dynamic

5. Test Model

  • config setting:
    do_train: true
    do_test: false
    
  • run
    python train.py --config config/*
    

generative-multihop-retrieval's People

Contributors

amy-hyunji avatar

Stargazers

Xiangsen avatar Williams Ziyu Jiang avatar Yoon, Seungje avatar Sue Hyun Park avatar Jeff Carpenter avatar  Fu Dayuan avatar  avatar  avatar  avatar Wonseok Hwang avatar Martin Salo avatar  avatar Seonhye Gu avatar Junki Ohmura avatar Kavin R V avatar Darwin Bautista avatar Nico Daheim avatar William FH avatar  avatar jaeyoung avatar  avatar Seungone Kim avatar Eunhwan Park avatar Seonghyeon Ye avatar Joel Jang  avatar

Watchers

Craig Macdonald avatar James Cloos avatar  avatar

Forkers

kavinrv

generative-multihop-retrieval's Issues

dataset

Hello, what form is the dataset structured in, your readme doesn't make it clear

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.