天天看點

RuntimeError: expected device cuda:0 and dtype Byte but got device cuda:0 and dtype Bool

loading 9423 train samples...
loading 1048 dev samples...
Traceback (most recent call last):
  File "train.py", line 170, in <module>
    main()
  File "train.py", line 166, in main
    train_net(args)
  File "train.py", line 73, in train_net
    logger=logger)
  File "train.py", line 115, in train
    pred, gold = model(padded_input, input_lengths, padded_target)
  File "/home/eric/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/data/sinovation_ventures/speechTransformer/transformer/transformer.py", line 35, in forward
    input_lengths)
  File "/home/eric/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/data/sinovation_ventures/speechTransformer/transformer/decoder.py", line 98, in forward
    slf_attn_mask = (slf_attn_mask_keypad + slf_attn_mask_subseq).gt(0)
RuntimeError: expected device cuda:0 and dtype Byte but got device cuda:0 and dtype Bool      

解決方法

pip install torch==1.4      

參考文獻