tae898 / erc

The official implementation of "EmoBERTa: Speaker-Aware Emotion Recognition in Conversation with RoBERTa"
MIT License
88 stars 23 forks source link

How to resume a model from checkpoint #26

Closed WayerLiu closed 2 years ago

WayerLiu commented 2 years ago

Hi there, I was trying to resume my model from the local checkpoint, but I couldn't find any proper place to assign the path of my checkpoint in train-erc-text.yaml. Can you help me out here?

tae898 commented 2 years ago

Hey there,

The training is done very fast, so I actually didn't bother to implement the checkpoint resuming feature. Does the training take too much time for you?

WayerLiu commented 2 years ago

Oh I see. I am trying to use the model on attacked MELD and IEMOCAP val and test set, so resuming from checkpoint would help.

tae898 commented 2 years ago

What do you mean by "attacked"?

WayerLiu commented 2 years ago

I used methods in textual adversarial attack to create adversarial samples from MELD and IEMOCAP datastes, so that I test how ERC models perform when facing attacks. Since many attack methods are used, I would like to resume models from checkpoint instead of training a same model every time.

tae898 commented 2 years ago

Can you pull the main branch? it should work now.

WayerLiu commented 2 years ago

Thank you a lot for your work! It works perfect for me.

WayerLiu commented 2 years ago

Oh, I noticed that it is still necessary to manually change the OUTPUT_DIR in train-erc-text.py into the path of model checkpoint for the checkpoint function now, maybe a little modify here can make this function easier to use.

tae898 commented 2 years ago

You don't have to change the OUTPUT_DIR. This directory is for your newly trained model. For example, if you specify model_checkpoint: results/MELD_IEMOCAP/roberta-base/SEEDS/2022-04-05-16-20-06-speaker_mode-None-num_past_utterances-0-num_future_utterances-0-batch_size-16-seed-42/checkpoint-8267 in train-erc-text.yaml, it'll load the checkpoint from it and then start training, but the newly trained model will be saved in OUTPUT_DIR.

WayerLiu commented 2 years ago

You don't have to change the OUTPUT_DIR. This directory is for your newly trained model. For example, if you specify model_checkpoint: results/MELD_IEMOCAP/roberta-base/SEEDS/2022-04-05-16-20-06-speaker_mode-None-num_past_utterances-0-num_future_utterances-0-batch_size-16-seed-42/checkpoint-8267 in train-erc-text.yaml, it'll load the checkpoint from it and then start training, but the newly trained model will be saved in OUTPUT_DIR.

Oh I see! Thank your for your explanation :)