KhalilMrini / LAL-Parser

Neural Adobe-UCSD Parser, the current State of the Art in Constituency and Dependency Parsing.
138 stars 24 forks source link

[sh parse.sh] RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'mask' #3

Closed Franck-Dernoncourt closed 4 years ago

Franck-Dernoncourt commented 4 years ago

I am trying to run the inference code:

virtualenv -p python3.6 /mnt/ilcompn0d1/user/dernonco/pyenv/neural-parser2
source /mnt/ilcompn0d1/user/dernonco/pyenv//neural-parser2/bin/activate
git clone https://github.com/KhalilMrini/LAL-Parser
cd LAL-Parser/
alias pip=pip3; source requirements.sh
sh parse.sh

but get the error message:

[...]
Parsing sentences...
Traceback (most recent call last):
  File "src_joint/main.py", line 765, in <module>
    main()
  File "src_joint/main.py", line 761, in main
    args.callback(args)
  File "src_joint/main.py", line 689, in run_parse
    syntree, _ = parser.parse_batch(subbatch_sentences)
  File "/mnt/ilcompn0d1/user/dernonco/sensei/neural-parser/cleanv2/LAL-Parser/src_joint/KM_parser.py", line 1739, in parse_batch
    features_packed = features.masked_select(all_word_end_mask.to(torch.bool).unsqueeze(-1)).reshape(-1,
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'mask'
(neural-parser2)

What could be the issue?

KhalilMrini commented 4 years ago

Hi Franck,

A contributor had changed the torch.uint8 to torch.bool for compatibility with newer versions of PyTorch in #2 . Given that our requirements state we use version 1.1.0, I reversed the changes in the latest commit. I hope that solves it.

Thanks!

Franck-Dernoncourt commented 4 years ago

That worked, thanks!