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

Long sequences breaking _greedy_decode #9

Open
ZhaofengWu opened this issue Jun 7, 2020 · 0 comments
Open

Long sequences breaking _greedy_decode #9

ZhaofengWu opened this issue Jun 7, 2020 · 0 comments

Comments

@ZhaofengWu
Copy link

ZhaofengWu commented Jun 7, 2020

When I'm parsing a sentence that is too long, I get the following error (this stack trace is for SDP parsing, but it also breaks EDS and UCCA):

Traceback (most recent call last):
  File "~/miniconda3/envs/parsing/bin/allennlp", line 8, in <module>
    sys.exit(run())
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/run.py", line 18, in run
    main(prog="allennlp")
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/commands/__init__.py", line 102, in main
    args.func(args)
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/commands/predict.py", line 227, in _predict
    manager.run()
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/commands/predict.py", line 206, in run
    for model_input_json, result in zip(batch_json, self._predict_json(batch_json)):
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/commands/predict.py", line 151, in _predict_json
    results = [self._predictor.predict_json(batch_data[0])]
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/predictors/predictor.py", line 65, in predict_json
    return self.predict_instance(instance)
  File "./utils/transition_sdp_predictor.py", line 43, in predict_instance
    outputs = self._model.forward_on_instance(instance)
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/models/model.py", line 124, in forward_on_instance
    return self.forward_on_instances([instance])[0]
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/allennlp/models/model.py", line 153, in forward_on_instances
    outputs = self.decode(self(**model_input))
  File "~/miniconda3/envs/parsing/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "./modules/transition_parser_sdp2015.py", line 331, in forward
    embedded_text_input=embedded_text_input)
  File "./modules/transition_parser_sdp2015.py", line 150, in _greedy_decode
    input=embedded_text_input[sent_idx][sent_len[sent_idx] - 1 - token_idx],
IndexError: index 428 is out of bounds for dimension 0 with size 390

This is from https://github.com/DreamerDeo/HIT-SCIR-CoNLL2019/blob/9bc3c0727c13aac72e71ae7bf48cc195f481bffa/modules/transition_parser_sdp2015.py#L146-L151

Does this package support generating a "partial" graph for long sequences, or are long sequences not supported at all? If I change the if statement to the following, would the resulting graph be a valid partial graph?

if sent_len[sent_idx] > token_idx and sent_len[sent_idx] - 1 - token_idx < embedded_text_input.shape[1]:
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