Closed hitvoice closed 5 years ago
When I run the code with the command "--model_name constituency --epoch 10", there's another error:
File "sentiment.py", line 228, in <module>
main()
File "sentiment.py", line 76, in main
train_dataset = SSTDataset(train_dir, vocab, args.num_classes, args.fine_grain, args.model_name)
File "/Users/runqi/Desktop/TreeLSTMSentiment/dataset.py", line 102, in __init__
temp_trees = self.read_trees(os.path.join(path, 'parents.txt'), os.path.join(path, 'labels.txt'))
File "/Users/runqi/Desktop/TreeLSTMSentiment/dataset.py", line 155, in read_trees
trees = [self.read_tree(p_line, l_line) for p_line, l_line in tqdm(pl)]
File "/Users/runqi/Desktop/TreeLSTMSentiment/dataset.py", line 155, in <listcomp>
trees = [self.read_tree(p_line, l_line) for p_line, l_line in tqdm(pl)]
File "/Users/runqi/Desktop/TreeLSTMSentiment/dataset.py", line 183, in read_tree
labels = list(map(self.parse_dlabel_token, label_line.split()))
File "/Users/runqi/Desktop/TreeLSTMSentiment/dataset.py", line 166, in parse_dlabel_token
tmp = int(x)
ValueError: invalid literal for int() with base 10: 'None'
The problems above occurred when I tried to translate the preprocessing code to python3 (by replacing "xrange" with "range" and adding "list" before "map"). I rerun the preprocessing code in python2.7 and the problems disappeared. I'll close this issue.
When I run the code with the command "--model_name dependency --epochs 10", there're errors like this:
Environment: python 3.6, Mac OS, pytorch 0.4.1
It seems like some root labels are None. Does anyone else have the same issue?