Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Petkomat opened this issue Aug 28, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@Petkomat
Copy link

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.

@drr3d
Copy link

drr3d commented Sep 25, 2019

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

@graykode graykode added the bug Something isn't working label Sep 29, 2019
@HuimengZhang
Copy link

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.

@Cdivyam
Copy link

Cdivyam commented Jan 7, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants