facebookresearch / DrQA

Reading Wikipedia to Answer Open-Domain Questions
Other
4.48k stars 898 forks source link

`/tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torch.bool instead.` #249

Open hughperkins opened 4 years ago

hughperkins commented 4 years ago

After launching interactive using:

python scripts/pipeline/interactive.py --tokenizer regexp

Enter a question using:

process('what is the capital of france?')

Pages and pages of:

/tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.                                                                                        /tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.                                                                                        /tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.
/tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ re
ceived a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.
/tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ re
ceived a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.
/tmp/pip-req-build-o37zi_pa/aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ re
ceived a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torc
h.bool instead.
hughperkins commented 4 years ago

(this is using pytorch 1.4 and python 3.6)

libertatis commented 3 years ago

To solve your issue, just modify the code lines in /drqa/reader/vector.py as follows: https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/vector.py#L93 x1_mask = torch.ByteTensor(len(docs), max_length).fill_(1) -> x1_mask = torch.BoolTensor(len(docs), max_length).fill_(True) https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/vector.py#L100 x1_mask[i, :d.size(0)].fill_(0) -> x1_mask[i, :d.size(0)].fill_(False) https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/vector.py#L107 x2_mask = torch.ByteTensor(len(questions), max_length).fill_(1) -> x2_mask = torch.BoolTensor(len(questions), max_length).fill_(True) https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/vector.py#L110 x2_mask[i, :q.size(0)].fill_(0) -> x2_mask[i, :d.size(0)].fill_(False)