MAMS-for-ABSA icon indicating copy to clipboard operation
MAMS-for-ABSA copied to clipboard

Problem encountered in train.py

Open MUrielleMU opened this issue 4 years ago • 6 comments

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

MUrielleMU avatar May 14 '20 15:05 MUrielleMU

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

jiangqn avatar May 19 '20 11:05 jiangqn

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 avatar May 29 '20 03:05 bujiahao

oh version donot match

bujiahao avatar May 29 '20 04:05 bujiahao

oh version donot match

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

C1oudysTarT avatar Feb 18 '21 06:02 C1oudysTarT

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

scofield7419 avatar Apr 12 '21 13:04 scofield7419

If you use torch=1.1.0 then it should work.

mhaber avatar Jun 07 '21 22:06 mhaber