xlnet-Pytorch icon indicating copy to clipboard operation
xlnet-Pytorch copied to clipboard

RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other'

Open Petkomat opened this issue 5 years ago • 3 comments

If I run the code with default arguments (and use data.txt from the repository) I get the following message:

Traceback (most recent call last):
  File "C:/Users/matej/git/xlnet-Pytorch/main.py", line 89, in <module>
    num_predict=args.num_predict)
  File "C:\Users\matej\git\xlnet-Pytorch\data_utils.py", line 345, in make_permute
    reuse_len)
  File "C:\Users\matej\git\xlnet-Pytorch\data_utils.py", line 292, in _local_perm
    non_mask_tokens = (~is_masked) & non_func_tokens
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other'

I use Python 3.6.9 and PyTorch 1.2.0.

Petkomat avatar Aug 28 '19 09:08 Petkomat

please cmiiw Capture as u can see in the picture, both two vars have different data type.. and the available code is: non_mask_tokens = (~is_masked) & non_func_tokens

me use PyTorch 1.2.0 and how i solve this is just convert is_masked to bool data.

so it will look like this non_mask_tokens = (~is_masked.bool()) & non_func_tokens

drr3d avatar Sep 25 '19 11:09 drr3d

I think this may be caused by the pytorch version, I did not encounter this bug when using 1.1.0, but got the same bug when using 1.2.0.

HuimengZhang avatar Sep 29 '19 08:09 HuimengZhang

Tried running the repo on torch versions: 1.3.1, 1.1.0, 1.0.1. The repo works on version 1.1.0. On 1.3.1 it gave me the same error as @Petkomat. On 1.0.1 it gave me TypeError: can't convert np.ndarray of type numpy.bool_. The only supported types are: double, float, float16, int64, int32, and uint8. No error on 1.1.0.

Cdivyam avatar Jan 07 '20 06:01 Cdivyam