ttpro1995 / Tree_CNN_LSTM

[Thesis] Add Convolution layer to TreeLSTM
MIT License
7 stars 5 forks source link

RuntimeError when loading Glove Amazon #2

Closed lihy-1224 closed 5 years ago

lihy-1224 commented 5 years ago

I got a runtime error when loading Glove Amazon word vector in multi_channel mode. The traceback is listed below.

Traceback (most recent call last):
  File "sentiment.py", line 466, in <module>
    main()
  File "sentiment.py", line 238, in main
    glove_vocab, glove_emb = load_word_vectors(emb_vector_path2, emb_split_token)
  File "/Users/lihongyi/Tree_CNN_LSTM-master/utils.py", line 34, in load_word_vectors
    vectors[idx] = torch.Tensor(map(float, contents[1:]))
RuntimeError: The expanded size of the tensor (1) must match the existing size (300) at non-singleton dimension 0

When I replace Glove Amazon with Glove Common Crawl on second channel, it works and no error. But Glove Amazon is too large to open so I can't find out the problem.