gongliym / data2text-transformer

Enhanced Transformer Model for Data-to-Text Generation
29 stars 11 forks source link

RuntimeError: Class values must be smaller than num_classes #4

Open shankyemcee opened 3 years ago

shankyemcee commented 3 years ago

I am getting this error when doing training. Any suggestions on how I can resolve it?

x11: tensor([[ 1, 1, 1, 1, 1, 1], [ 18, 18, 18, 152, 18, 18], [ 210, 2563, 73, 73, 147, 52], [ 18, 18, 18, 152, 18, 46], [ 210, 2563, 73, 73, 147, 53], [ 18, 18, 18, 152, 18, 18], [ 210, 2563, 73, 73, 147, 52], [ 18, 1, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 18, 18], [ 210, 2, 73, 73, 147, 52], [ 18, 2, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 18, 18], [ 210, 2, 73, 73, 147, 52], [ 18, 2, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 18, 18], [ 210, 2, 73, 73, 147, 52], [ 18, 2, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 18, 18], [ 210, 2, 73, 73, 147, 52], [ 18, 2, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 18, 18], [ 210, 2, 73, 73, 147, 52], [ 18, 2, 18, 152, 18, 46], [ 210, 2, 73, 73, 147, 53], [ 18, 2, 18, 152, 1, 18], [ 210, 2, 73, 73, 2, 52], [ 18, 2, 18, 152, 2, 46], [ 210, 2, 73, 73, 2, 53], [ 18, 2, 18, 152, 2, 18], [ 210, 2, 73, 73, 2, 52], [ 18, 2, 18, 152, 2, 46], [ 210, 2, 73, 73, 2, 53], [ 18, 2, 18, 152, 2, 18], [ 210, 2, 73, 73, 2, 52], [ 18, 2, 18, 152, 2, 46], [ 210, 2, 73, 73, 2, 53], [ 18, 2, 1, 152, 2, 18], [ 210, 2, 2, 73, 2, 52], [ 18, 2, 2, 152, 2, 46], [ 210, 2, 2, 73, 2, 53], [ 18, 2, 2, 152, 2, 1], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 18, 2, 2, 152, 2, 2], [ 210, 2, 2, 73, 2, 2], [ 1, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 152, 2, 2], [ 2, 2, 2, 73, 2, 2], [ 2, 2, 2, 1, 2, 2]]) param target words: 364 Traceback (most recent call last): File "model/train.py", line 229, in main(params) File "model/train.py", line 206, in main scores = evaluator.run_all_evals(trainer) File "/project/6027213/shankar5/envs/chart2text/Chart2Text/model/src/evaluation/evaluator.py", line 106, in run_all_evals self.evaluate_mt(scores, data_set, params.eval_bleu) File "/project/6027213/shankar5/envs/chart2text/Chart2Text/model/src/evaluation/evaluator.py", line 282, in evaluate_mt vocab_mask = (torch.sum(torch.nn.functional.one_hot(x11, params.tgt_n_words), dim=0) > 0) RuntimeError: Class values must be smaller than num_classes.