Skip to content
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

expected mask dtype to be Bool but got Long #130

Open
haidequanbu opened this issue Aug 15, 2022 · 0 comments
Open

expected mask dtype to be Bool but got Long #130

haidequanbu opened this issue Aug 15, 2022 · 0 comments

Comments

@haidequanbu
Copy link

Hi.when i am tring to reproduce the results using transformers,i got a problem.
Traceback (most recent call last):
File "train.py", line 341, in
train(args, device_id)
File "train.py", line 273, in train
trainer.train(train_iter_fct, args.train_steps)
File "/root/code/BertSum/src/models/trainer.py", line 155, in train
self._gradient_accumulation(
File "/root/code/BertSum/src/models/trainer.py", line 321, in _gradient_accumulation
sent_scores, mask = self.model(src, segs, clss, mask, mask_cls)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/code/BertSum/src/models/model_builder.py", line 96, in forward
sent_scores = self.encoder(sents_vec, mask_cls).squeeze(-1)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/code/BertSum/src/models/encoder.py", line 97, in forward
x = self.transformer_inter[i](i, x, x, 1 - mask) # all_sents * max_tokens * dim
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/code/BertSum/src/models/encoder.py", line 68, in forward
context = self.self_attn(input_norm, input_norm, input_norm,
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/root/code/BertSum/src/models/neural.py", line 210, in forward
scores = scores.masked_fill(mask, -1e18)
RuntimeError: expected mask dtype to be Bool but got Long
cuda:11 torch:1.10.1
Does it has any problem with my envirenment?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant