songyouwei / ABSA-PyTorch

Aspect Based Sentiment Analysis, PyTorch Implementations. 基于方面的情感分析,使用PyTorch实现。
MIT License
2.02k stars 526 forks source link

All zero #104

Closed Hongze-Wang closed 4 years ago

Hongze-Wang commented 4 years ago

Hi, I encounter the following when running your code:

v, , = self.lstm1(feature, feature_len) RuntimeError: Length of all samples has to be greater than 0, but found an element in 'lengths' that is <= 0

The reason is that the “text_raw_indices” contains all zero list, so that Dynamic_LSTM receive a sequence that all zero.

I use glove.840B.300d embedding, looks like that the trainning data contain sentence that all the words have no corresponding embedding.

However, I didn't encounter this error when just use your code. But when I want to make some changes, this issue sometimes may raise, and other times it works just fine. Can you offer me some help ?

Sincerely, Steve Wang