RaleLee / DialogueGCN

A preprocessing and training code for DialogueGCN on Dailydialogue and Mastodon dataset. Use Bert base to preprocess the sentences. Based on https://github.com/declare-lab/conv-emotion/tree/master/DialogueGCN
27 stars 3 forks source link

RuntimeError #5

Closed Gae-Zhang closed 2 years ago

Gae-Zhang commented 2 years ago

Hello. When I train dailydialog, the following error comes: Traceback (most recent call last): File "train_DailyDialog.py", line 359, in <module> train_loss, train_acc, _, _, _, train_fscore, _ = train_or_eval_model(model, loss_function, train_loader, e, File "train_DailyDialog.py", line 80, in train_or_eval_model log_prob, alpha, alpha_f, alpha_b, _ = model(textf, qmask, umask) # seq_len, batch, n_classes File "D:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "D:\Documents\大四\毕设\话语特征提取\DialogueGCN\model.py", line 407, in forward emotions, hidden = self.lstm(U) File "D:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "D:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\rnn.py", line 759, in forward self.check_forward_args(input, hx, batch_sizes) File "D:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\rnn.py", line 684, in check_forward_args self.check_input(input, batch_sizes) File "D:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\rnn.py", line 205, in check_input raise RuntimeError( RuntimeError: input.size(-1) must be equal to input_size. Expected 100, got 250 Can you help me? Thank you a lot!

RaleLee commented 2 years ago

It seems that you pass a wrong tensor into the model. And I cannot find this bug in my code. Try debugging : )