The repo contains the code to train and evaluate a system which extracts relations and explanations from dialogue.

Related tags

Deep Learning D-REX
Overview

The repo contains the code to train and evaluate a system which extracts relations and explanations from dialogue.

How do I cite D-REX?

For now, cite the Arxiv paper

@article{albalak2021drex,
      title={D-REX: Dialogue Relation Extraction with Explanations}, 
      author={Alon Albalak and Varun Embar and Yi-Lin Tuan and Lise Getoor and William Yang Wang},
      journal={arXiv preprint arXiv:2109.05126},
      year={2021},
}

To train the full system:

GPU=0
bash train_drex_system.sh $GPU

Notes:

  • The training script is set up to work with an NVIDIA Titan RTX (24Gb memory, mixed-precision)
  • To train on a GPU with less memory, adjust the GPU_BATCH_SIZE parameter in train_drex_system.sh to match your memory limit.
  • Training the full system takes ~24 hours on a single NVIDIA Titan RTX

To test the trained system:

GPU=0
bash test_drex_system.sh $GPU

To train/test individual modules:

  • Relation Extraction Model -
    • Training:
      GPU=0
      MODEL_PATH=relation_extraction_model
      mkdir $MODEL_PATH
      CUDA_VISIBLE_DEVICES=$GPU python3 train_relation_extraction_model.py \
          --model_class=relation_extraction_roberta \
          --model_name_or_path=roberta-base \
          --base_model=roberta-base \
          --effective_batch_size=30 \
          --gpu_batch_size=30 \
          --fp16 \
          --output_dir=$MODEL_PATH \
          --relation_extraction_pretraining \
          > $MODEL_PATH/train_outputs.log
    • Testing:
      GPU=0
      MODEL_PATH=relation_extraction_model
      BEST_MODEL=$(ls $MODEL_PATH/F1* -d | sort -r | head -n 1)
      THRESHOLD1=$(echo $BEST_MODEL | grep -o "T1.....")
      THRESHOLD1=${THRESHOLD1: -2}
      THRESHOLD2=$(echo $BEST_MODEL | grep -o "T2.....")
      THRESHOLD2=${THRESHOLD2: -2}
      CUDA_VISIBLE_DEVICES=0 python3 test_relation_extraction_model.py \
          --model_class=relation_extraction_roberta \
          --model_name_or_path=$BEST_MODEL \
          --base_model=roberta-base \
          --relation_extraction_pretraining \
          --threshold1=$THRESHOLD1 \
          --threshold2=$THRESHOLD2 \
          --data_split=test
  • Explanation Extraction Model -
    • Training:
      GPU=0
      MODEL_PATH=explanation_extraction_model
      mkdir $MODEL_PATH
      CUDA_VISIBLE_DEVICES=$GPU python3 train_explanation_policy.py \
          --model_class=explanation_policy_roberta \
          --model_name_or_path=roberta-base \
          --base_model=roberta-base \
          --effective_batch_size=30 \
          --gpu_batch_size=30 \
          --fp16 \
          --output_dir=$MODEL_PATH \
          --explanation_policy_pretraining \
          > $MODEL_PATH/train_outputs.log    
    • Testing:
      GPU=0
      MODEL_PATH=explanation_extraction_model
      BEST_MODEL=$(ls $MODEL_PATH/F1* -d | sort -r | head -n 1)
      CUDA_VISIBLE_DEVICES=$GPU python3 test_explanation_policy.py \
          --model_class=explanation_policy_roberta \
          --model_name_or_path=$BEST_MODEL \
          --base_model=roberta-base \
          --explanation_policy_pretraining \
          --data_split=test
You might also like...
Ever felt tired after preprocessing the dataset, and not wanting to write any code further to train your model? Ever encountered a situation where you wanted to record the hyperparameters of the trained model and able to retrieve it afterward? Models Playground is here to help you do that. Models playground allows you to train your models right from the browser. This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Pytorch Implementation of Interaction Networks for Learning about Objects, Relations and Physics

Interaction-Network-Pytorch Pytorch Implementraion of Interaction Networks for Learning about Objects, Relations and Physics. Interaction Network is a

git《Learning Pairwise Inter-Plane Relations for Piecewise Planar Reconstruction》(ECCV 2020) GitHub:

Learning Pairwise Inter-Plane Relations for Piecewise Planar Reconstruction Code for the ECCV 2020 paper by Yiming Qian and Yasutaka Furukawa Getting

PyTorch implementation of
PyTorch implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"

DiscoGAN in PyTorch PyTorch implementation of Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. * All samples in READM

Official implementation of
Official implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"

DiscoGAN Official PyTorch implementation of Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. Prerequisites Python 2.7

Code for paper: Group-CAM: Group Score-Weighted Visual Explanations for Deep Convolutional Networks
Code for paper: Group-CAM: Group Score-Weighted Visual Explanations for Deep Convolutional Networks

Group-CAM By Zhang, Qinglong and Rao, Lu and Yang, Yubin [State Key Laboratory for Novel Software Technology at Nanjing University] This repo is the o

Extracts essential Mediapipe face landmarks and arranges them in a sequenced order.
Extracts essential Mediapipe face landmarks and arranges them in a sequenced order.

simplified_mediapipe_face_landmarks Extracts essential Mediapipe face landmarks and arranges them in a sequenced order. The default 478 Mediapipe face

Comments
  • A problem about training

    A problem about training

    Hi,Alon After having trained the full system, I noticed that the best f1 score of the intitial ranking model when pretraining is higher than that of the full system and much higher than BERTs which it follows, that makes me confused , could you tell me the reason?

    opened by sunsun-rgb 3
  • Problem about explanation(EX) model training.

    Problem about explanation(EX) model training.

    Thank you for open-sourcing the code of your paper, nice work for dialogue relation extraction. When I read your paper, I'm noticing you mentioned you train EX used policy gradient for unlabeled samples. It seems that the part (Policy gradient ) is not in the code you shared. Can you share this part of the code if possible? I would be very grateful if it was possible.

    opened by zhuweipg99 1
Owner
Alon Albalak
Alon Albalak
Ludwig is a toolbox that allows to train and evaluate deep learning models without the need to write code.

Translated in ???? Korean/ Ludwig is a toolbox that allows users to train and test deep learning models without the need to write code. It is built on

Ludwig 8.7k Jan 5, 2023
Ludwig is a toolbox that allows to train and evaluate deep learning models without the need to write code.

Translated in ???? Korean/ Ludwig is a toolbox that allows users to train and test deep learning models without the need to write code. It is built on

Ludwig 8.7k Dec 31, 2022
This repo contains the code required to train the multivariate time-series Transformer.

Multi-Variate Time-Series Transformer This repo contains the code required to train the multivariate time-series Transformer. Download the data The No

Gregory Duthé 4 Nov 24, 2022
HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events globally on daily to subseasonal timescales.

HeatNet HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events glob

Google Research 6 Jul 7, 2022
Train/evaluate a Keras model, get metrics streamed to a dashboard in your browser.

Hera Train/evaluate a Keras model, get metrics streamed to a dashboard in your browser. Setting up Step 1. Plant the spy Install the package pip

Keplr 495 Dec 10, 2022
PyTorch code for EMNLP 2021 paper: Don't be Contradicted with Anything! CI-ToD: Towards Benchmarking Consistency for Task-oriented Dialogue System

Don’t be Contradicted with Anything!CI-ToD: Towards Benchmarking Consistency for Task-oriented Dialogue System This repository contains the PyTorch im

Libo Qin 25 Sep 6, 2022
PyTorch code for EMNLP 2021 paper: Don't be Contradicted with Anything! CI-ToD: Towards Benchmarking Consistency for Task-oriented Dialogue System

PyTorch code for EMNLP 2021 paper: Don't be Contradicted with Anything! CI-ToD: Towards Benchmarking Consistency for Task-oriented Dialogue System

Libo Qin 12 Sep 26, 2021
Code For TDEER: An Efficient Translating Decoding Schema for Joint Extraction of Entities and Relations (EMNLP2021)

TDEER (WIP) Code For TDEER: An Efficient Translating Decoding Schema for Joint Extraction of Entities and Relations (EMNLP2021) Overview TDEER is an e

Alipay 6 Dec 17, 2022
Code for the paper "Relation of the Relations: A New Formalization of the Relation Extraction Problem"

This repo contains the code for the EMNLP 2020 paper "Relation of the Relations: A New Paradigm of the Relation Extraction Problem" (Jin et al., 2020)

YYY 27 Oct 26, 2022
[NeurIPS 2021 Spotlight] Code for Learning to Compose Visual Relations

Learning to Compose Visual Relations This is the pytorch codebase for the NeurIPS 2021 Spotlight paper Learning to Compose Visual Relations. Demo Imag

Nan Liu 88 Jan 4, 2023