char-cnn-text-classification-pytorch icon indicating copy to clipboard operation
char-cnn-text-classification-pytorch copied to clipboard

IndexError: index 1014 is out of bounds for dimension 0 with size 1014

Open feiyangdezhu opened this issue 6 years ago • 5 comments

I changed a data set, and the rest is consistent with your code, but the result above appears. I don't know the reason, please kindly answer for me in your busy schedule, thank you

feiyangdezhu avatar Nov 16 '18 10:11 feiyangdezhu

can you provide more information about the dataset you are using?

srviest avatar Nov 19 '18 22:11 srviest

I use the data set is more than 1014 characters in a row, but when change the lo to 4056, and an error is as follows: a RuntimeError: size mismatch, m1:32 x [37376], the m2: [8704 x 8704] at/pytorch aten/SRC/TH/generic/THTensorMath CPP: 2070

feiyangdezhu avatar Nov 20 '18 03:11 feiyangdezhu

I want to know what parameter values the CNN model needs to adjust when changing lo value, namely max length of a sample

feiyangdezhu avatar Nov 20 '18 03:11 feiyangdezhu

Hi, it seems that the argument "--l0" in train.py sets the max length of samples. Feel free to adjust it to a larger value

You should also change line 222, 231 in train.py from train_dataset = AGNEWs(label_data_path=args.train_path, alphabet_path=args.alphabet_path) to train_dataset = AGNEWs(label_data_path=args.train_path, alphabet_path=args.alphabet_path, l0=args.l0),

and from dev_dataset = AGNEWs(label_data_path=args.val_path, alphabet_path=args.alphabet_path) to dev_dataset = AGNEWs(label_data_path=args.val_path, alphabet_path=args.alphabet_path, l0=args.l0)

zhijing-jin avatar Feb 16 '19 07:02 zhijing-jin

@zhijing-jin thx! @feiyangdezhu issue fixed, try again.

srviest avatar Mar 23 '19 21:03 srviest