siat-nlp / MAMS-for-ABSA

A Multi-Aspect Multi-Sentiment Dataset for aspect-based sentiment analysis.
Apache License 2.0
255 stars 63 forks source link

Problem encountered in train.py #4

Open MUrielleMU opened 4 years ago

MUrielleMU commented 4 years ago

Excuse me, I met this problem running train.py. Could you plz tell me if I did anything wrong? I really appreciate your reply :)

File "../aspect_category_model/bert_capsnet.py", line 65, in forward sentence_mask = segment_mask & (1 - bert_segment).byte() RuntimeError: result type Byte can't be cast to the desired output type Bool

jiangqn commented 4 years ago

bert_segment should be a LongTensor. Maybe the type of input got wrong.

bujiahao commented 4 years ago

Excuse me, I met this problem running train.py. Could you plz tell me if I did anything wrong? I really appreciate your reply :)

File "../aspect_category_model/bert_capsnet.py", line 65, in forward sentence_mask = segment_mask & (1 - bert_segment).byte() RuntimeError: result type Byte can't be cast to the desired output type Bool

I also met the same problem when run train.py sentence_mask = segment_mask & (1 - bert_segment).byte() RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other'

do u solve this problem?

bujiahao commented 4 years ago

oh version donot match

C1oudysTarT commented 3 years ago

oh version donot match

Could you tell me how to solve this problem? Thanks a lot.

scofield7419 commented 3 years ago

sentence_mask = segment_mask & (1 - bert_segment).byte() -> sentence_mask = segment_mask & (1 - bert_segment).bool()

mhaber commented 3 years ago

If you use torch=1.1.0 then it should work.