Code Monkey home page Code Monkey logo

tp-egg's Introduction

TP-EGG

The repository contains the source code of the ACL 2023 long paper "From the One, Judge of the Whole: Typed Entailment Graph Construction with Predicate Generation". Arxiv

How to run

  1. Download the evaluation repository and the dataset for later usage:
git clone https://github.com/mjhosseini/entgraph_eval.git
cd TP-EGG/
wget https://dl.dropboxusercontent.com/s/j7sgqhp8a27qgcf/gfiles.zip
unzip gfiles.zip
rm gfiles.zip
mv gfiles/ .. 
ls ../gfiles/ent/
ls ../entgraph_eval/
  1. Run the training script to get the predicate generator $G$ based on T5-large, or directly download the checkpoint:
python t5_train.py --t5_size large --lr 1e-3
stat t5_tuned_large_0.001_reannofix.pth
  1. Run the predicate generator to generate novel predicate sets:
python t5_predgen.py --beam 50 --keep 5000 --filter_level 0 --t5_size large --model_path t5_tuned_large_0.001_reannofix.pth
  1. Run the training script to get the edge selictor $M$ based on BERT, or directly download the checkpoint:
mkdir sent_matchers
python -u sent_matcher_ball.py --lr 1e-5 --dnet_lr 5e-4 --n_epoch 300 --pos_repeat 5 --alltest 1 --dist_last exp --d_middim 4 --embmod_dim 16
stat sent_matchers/ball2_alltest_bertbase_0.9_1e-05_0.0005_5_exp_4_em16_best.pth.tar
  1. Download the edge weight calculator $W$ checkpoint re-implemented based on EGT2:
mkdir deberta_tars
mv deberta0.8_12_1e-05_1_reannofix_best.pth.tar deberta_tars/
stat deberta_tars/deberta0.8_12_1e-05_1_reannofix_best.pth.tar
  1. Run the local graph generation script to get the output EG, and you can change the parameters of Line 32-43 in sent_matcher_modifier_ball_for_t5predgen.py:
python sent_matcher_modifier_ball_for_t5predgen.py
ls ../gfiles/typedEntGrDir_sent_matcher_t5gen_b50k5000fil02nei_large_tunedlarge0.001reannofix_ball2m_1e-5_5e-4_5_exp_4_em16_f2e7_mNone_ty2/

And we upload the final graphs for future research. After downloading corresponding files, get the graphs by:

cat TPEGG_LH_split.z* > graph.zip
unzip graph.zip
  1. Copy the relaxed evaluation script to the evaluation repo, and get the evaluation results:
cp eval_with_sent.py ../entgraph_eval/evaluation/
cd ../entgraph_eval/evaluation/
python eval.py --gpath typedEntGrDir_sent_matcher_t5gen_b50k5000fil02nei_large_tunedlarge0.001reannofix_ball2m_1e-5_5e-4_5_exp_4_em16_f2e7_mNone_ty2 --test_reanno --sim_suffix _sim.txt --method TPEGG_LH_reannofix --CCG 1 --typed 1 --supervised 0 --oneFeat 1 --useSims 0 --featIdx 0 --exactType --backupAvg --write
cd ../../TP-EGG
python eval_curvefill.py

tp-egg's People

Contributors

zacharychenpk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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