Git Product home page Git Product logo

rbdef's Introduction

A Dual-Expert Framework for Event Argument Extraction

Requirements

To run this repo, you need to install pytorch>=1.4, transformers, learn2learn.

Run code

First, set the corresponding files inconfig and scripts.

For scripts, select the mode, see Table 1 for more details. For config, it's enough to adjust model most times.

Train base model

set model of `ace.json` in `config` to "Main model"
set mode of `train.sh` in `scripts` to "train"
run the command "bash scripts/train.sh"

Run RBDEF

Train base model first, then train routing, head expert and tail expert.

Train routing:

set model of `ace.json` in `config` to "Selector"
set mode of `train.sh` in `scripts` to "train"
run the command "bash scripts/train.sh"

Train head expert:

set model of `ace.json` in `config` to "Head"
set mode of `train.sh` in `scripts` to "train"
run the command "bash scripts/train.sh"

Train tail expert:

# meta-train first
set model of `ace.json` in `config` to "Meta"
set mode of `train.sh` in `scripts` to "meta"
run the command "bash scripts/train.sh"

# fine-tune
set model of `ace.json` in `config` to "FewRole"
set mode of `train.sh` in `scripts` to "train"
run the command "bash scripts/train.sh"

Evaluate RBDEF:

# no training, only evaluation
set model of `ace.json` in `config` to "Fuse"
set mode of `train.sh` in `scripts` to "threshold"
run the command "bash scripts/train.sh"

The result can be seen in logs.

For more details, see code.

Table 1

mode sub_mode argument explanation
preprocess - - preprocess the data from sentence-level to entity-level
train - load the saved model or not training, set the configuration in config
evaluate - load the saved model or not evaluation, set the configuration in config
statistic - - compute and save role2entity.json and role2event.json
indicator filename of saved model - test on devset, run this before rank mode
rank filename of the indicator's result - rank roles by F1, run this after indicator mode
important - - set the flag whether or not the sample belong to $Q^{tar}_{b}$
meta - - meta-training, set the configuration in config
threshold - - evaluate the RBDEF
save filename of saved model - save the classifier from the saved model
fewshot - - fine-tuning the initializations search by different meta learning algorithms, see sec 4.4 in paper
group - - divide dataset into different groups for training Base+Fairness
parameter - - compute the number of parameters of models

rbdef's People

Contributors

buted 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.