dqwang122 / HeterSumGraph

Code for ACL2020 paper "Heterogeneous Graph Neural Networks for Extractive Document Summarization"
244 stars 52 forks source link

AssertionError: doc_feature_element #21

Closed muguruzawang closed 3 years ago

muguruzawang commented 3 years ago

When I use the code to train HDSG model on my own multi-document dataset, the following problem occurs

Traceback (most recent call last): File "train.py", line 384, in main() File "train.py", line 380, in main setup_training(model, train_loader, valid_loader, valid_dataset, hps) File "train.py", line 71, in setup_training run_training(model, train_loader, valid_loader, valset, hps, train_dir) File "train.py", line 116, in run_training outputs = model.forward(G) # [n_snodes, 2] File "/dat01/jttang/wpc/survey_generation/HeterSumGraph/HiGraph.py", line 222, in forward doc_feature, snid2dnid = self.set_dnfeature(graph) File "/dat01/jttang/wpc/survey_generation/HeterSumGraph/HiGraph.py", line 299, in set_dnfeature assert not torch.any(torch.isnan(doc_feature)), "doc_feature_element" AssertionError: doc_feature_element

It seems that the problem is because doc_feature is nan and snodes of dnode is null. I check my dataset and didn't find empty document. So I am confused about the reason. Please help. @brxx122 Thanks.

muguruzawang commented 3 years ago

I solved it.

thinkwee commented 3 years ago

I solved it.

how did you solve it? thx!

polplop commented 2 years ago

Managed to bypass this error by cleaning my sentences a bit. Off to fix another bug....

sentences = [x.lower() for x in sentences if len(x)>10]