GithubHelp home page GithubHelp logo

rungjoo / compm Goto Github PK

View Code? Open in Web Editor NEW
60.0 2.0 14.0 3.64 MB

Context Modeling with Speaker's Pre-trained Memory Tracking for Emotion Recognition in Conversation (NAACL 2022)

Python 95.91% Jupyter Notebook 4.09%

compm's Introduction

CoMPM: Context Modeling with Speaker's Pre-trained Memory Tracking for Emotion Recognition in Conversation (NAACL 2022)

model The overall flow of our model

Requirements

  1. Pytorch 1.8
  2. Python 3.6
  3. Transformer 4.4.0
  4. sklearn

Datasets

Each data is split into train/dev/test in the dataset folder.

  1. IEMOCAP
  2. DailyDialog
  3. MELD
  4. EmoryNLP

Train

For CoMPM, CoMPM(s), CoMPM(f)

In this code, the batch size = 1. We do not add padding when the batch is greater than 1.

Argument

  • pretrained: type of model (CoM and PM) (default: roberta-large)
  • initial: initial weights of the model (pretrained or scratch) (default: pretrained)
  • cls: label class (emotion or sentiment) (default: emotion)
  • dataset: one of 4 dataset (dailydialog, EMORY, iemocap, MELD)
  • sample: ratio of the number of the train dataset (default: 1.0)
  • freeze: Whether to learn the PM or not
python3 train.py --initial {pretrained or scratch} --cls {emotion or sentiment} --dataset {dataset} {--freeze}

For a combination of CoM and PM (based on different model)

Argument

  • context_type: type of CoM
  • speaker_type: type of PM
cd CoMPM_diff
python3 train.py {--argument}

For CoM or PM

cd CoM or PM
python3 train.py {--argument}

Testing with pretrained CoMPM

  • Naver drive
  • Unpack model.tar.gz and replace it in {dataset}_models/roberta-large/pretrained/no_freeze/{class}/{sampling}/model.bin
    • dataset: dailydialog, EMORY, iemocap, MELD
    • class: "emotion" or "sentiment"
    • sampling: 0.0 ~ 1.0, default: 1.0
python3 test.py

Test result for one seed. In the paper, the performance of CoMPM was reported as an average of three seeds.

Model Dataset (emotion) Performace: one seed (paper)
CoMPM IEMOCAP 66.33 (66.33)
CoMPM DailyDialog 52.46/60.41 (53.15/60.34)
CoMPM MELD 65.53 (66.52)
CoMPM EmoryNLP 38.56 (37.37)

Citation

@inproceedings{lee-lee-2022-compm,
    title = "{C}o{MPM}: Context Modeling with Speaker{'}s Pre-trained Memory Tracking for Emotion Recognition in Conversation",
    author = "Lee, Joosung  and
      Lee, Wooin",
    booktitle = "Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
    month = jul,
    year = "2022",
    address = "Seattle, United States",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.naacl-main.416",
    doi = "10.18653/v1/2022.naacl-main.416",
    pages = "5669--5679",
}

compm's People

Contributors

rungjoo avatar

Stargazers

 avatar Doyeon Kim avatar Jeff Carpenter avatar  avatar Tiansheng Deng avatar Daniel Sungho Jung avatar  avatar sdyz avatar  avatar  avatar AN Jinmyeong avatar Xiao Liang avatar Fangxu Yu avatar zzzzd avatar Dwayne Glenn avatar Seonah Han avatar  avatar Zequn Li avatar Rena Gao avatar MeilingYu avatar Hiiragi Utena avatar aidenfaustine avatar  avatar  avatar  avatar  avatar Dang-Khanh Nguyen avatar Hayul Park avatar ii_ruatnec avatar hayato-6 avatar Kenn avatar Jiyeol Park avatar Jinlong Xue avatar 推荐的文献 avatar W JT avatar  avatar jiaqiangwjq avatar  avatar Xiaoyuan Wang avatar 曾星伟 avatar Tony avatar CooperLeong avatar Zhuang Chen avatar Cyril Korotkov avatar Lukas Grosse Westermann avatar Hyunjoo Lee avatar TheDetective avatar Minchul Lee avatar Jeongbeom Jeong avatar Minh-Son Cao avatar cloudWL avatar 小桐桐 avatar Prasansha Satpathy  avatar Zilin Xiao avatar Xu Chen avatar  avatar Proto avatar baeseongsu avatar cin-hubert avatar Minsik avatar

Watchers

Kenn avatar  avatar

compm's Issues

pytorch-cuda version for the source code?

Hi,

Do you know which version of cuda the code was built using? Prerequisites listed pytorch 1.8 but didn't say with which version of cuda. I am finding it very difficult to run because I couldn't find torch 1.8 anywhere. Appreciate your help!

Can I ignore this warning? UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.

I met the warning below:
/root/miniconda3/lib/python3.8/site-packages/sklearn/metrics/_classification.py:1471:
UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use zero_division parameter to control this behavior.
_warn_prf(average, modifier, msg_start, len(result))

But the accuracy still printed. And seems like the train can be continue. I am wondering will this affect the training?

reproduce your work on MELD dataset, the weight F1 score is 66.52

your work is interesting and perfect. don't introduce external knowledge, just dependent on CoM and PM.

when i try to reproduce same result in MELD dataset. I want to achieve same result F1 score is 66.52.

use the command :python test.py? it is right? do need to setup other experiments.

could you please give me a hand? many thanks

image

image

Can I use this work for sentiment analysis of dyadic conversations?

Hi,

I am working on sentiment analysis of dyadic conversations. Can I use your work for this purpose?

I understand that this work can help with utterance-level sentiment/emotion recognition in conversations? Now from there, if I want to recognize sentiment/emotion of the whole conversation, are you aware of any techniques that might help?

Thank you so much for your help!

Possible typo in the paper

The paper explains the CoMPM figure in Page 4 and states:
Figure 2: Our model consists of two modules: a context embedding module and a pre-trained memory module.
The figure shows an example of predicting emotion of u 6 , from a 6-turn dialogue context. A, B, and C refer to the
participants in the conversation, where s A = p u 1 = p u 3 = p u 6 , s B = p u 2 = p u 5 , s C = p u 3 . W o and W p are
linear matrices.

I believe s C = p u 3 should be s C = p u 4

"MELD_models/roberta-large/pretrained/no_freeze/emotion/1.0/model.bin" . It doesn't have mobel.bin file.

sorry to disturb you. I have trouble about "CoMPM: Context Modeling with Speaker’s Pre-trained Memory Tracking for Emotion Recognition in Conversation".

when I run the command "python train.py".

it is reported the issue as follows: "MELD_models/roberta-large/pretrained/no_freeze/emotion/1.0/model.bin" . It doesn't have mobel.bin file.

could you please help me to solve it? I want to reproduce your work based on your code.
many thanks
best wishes

435f842d4ae6069c562c230eaad8d38

RoBERTa large max input token size issue

Question

What if all previous utterances is over than 512 number of tokens?

I know the max input token size of RoBERTa large is 512. [link]

And in your paper, I could find this

context embedding module(CoM) reflects all previous utterances as context.
...
We use an Transformer encoder as a context model (such as RoBERTa).

If you met that kind of problem, then did you use sliding window or something

Thank you

Google Drive link not found

I clicked the link, but the message is like below.

"404. 오류가 발생했습니다. 요청하신 URL을 서버에서 찾을 수 없습니다. 다른 원인은 확인할 수 없습니다."

Could you fix this problem?

Why don't put batch_speaker_token on cuda?

I am reading your code. And I found that, batch_speaker_tokens are not put on cuda. (The code is as below: )

    batch_input_tokens, batch_labels, batch_speaker_tokens = data
    batch_input_tokens, batch_labels = batch_input_tokens.cuda(), batch_labels.cuda()

However, I found the speaker_token is a list with only one Tensor. I am quite confused that, shall we remove the list, just use Tensor as batch_speaker_tokens? In this way, the speaker_tokens can be speed up by GPU.

By the way, I am wondering why you put a list outside the Tensor in batch_speaker_tokens. I think there might be a reason for doing so.

Many thanks.

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.