GanjinZero / ICD-MSMN

Code Synonyms Do Matter: Multiple Synonyms Matching Network for Automatic ICD Coding [ACL 2022]
https://arxiv.org/abs/2203.01515
47 stars 8 forks source link

How to reproduce baseline in which label_feat is None? #14

Open mingyangligithub opened 3 months ago

mingyangligithub commented 3 months ago

Hi Authors,

I'm trying to reproduce the baseline which is without embedding of descriptions of codes. In icd_mode.py, I set the label_feat equals to None. But it shows error when I run the code. How can I reproduce it?

ignore mc_logits

    #c_logits0 = self.decoder(hidden0, word_mask, label_feats)
    #c_logits1 = self.decoder(hidden1, word_mask, label_feats)
    c_logits0 = self.decoder(hidden0, word_mask, label_feat = None)
    c_logits1 = self.decoder(hidden1, word_mask, label_feat = None)

Many thanks! Best wishes, Mingyang

mingyangligithub commented 3 months ago

This is the error: Traceback (most recent call last): File "main.py", line 254, in main() File "main.py", line 251, in main run(args) File "main.py", line 87, in run epoch_dev_metric, epoch_test_metric, steps = train_one_epoch(model, steps, train_dataloader, dev_dataloader, test_dataloader, optimizer, scheduler_step, args, accelerator) File "main.py", line 155, in train_one_epoch ori_loss = model(batch_gpu, rdrop=args.rdrop_alpha > 0.0) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/anaconda3/envs/MSMN/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, *kwargs) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/ICD-MSMN/model/icd_model.py", line 56, in forward return self.forward_rdrop(batch) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/ICD-MSMN/model/icd_model.py", line 93, in forward_rdrop c_logits0 = self.decoder(hidden0, word_mask, label_feat = None) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/anaconda3/envs/MSMN/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/ICD-MSMN/model/decoder.py", line 205, in forward m = self.get_label_queried_features(h, word_mask, label_feat) File "/mnt/iusers01/fatpou01/compsci01/f06585ml/ICD-MSMN/model/decoder.py", line 240, in get_label_queried_features u_reshape = self.u_reduce(label_feat.reshape(label_count, self.attention_head, att_dim)) RuntimeError: shape '[4, 8, 512]' is invalid for input of size 19968

GanjinZero commented 3 months ago

I am not maintaining this repo anymore. Where does the input size 19968 come from? I have no idea.