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

Increase maximum length in nlp #36

Open
lizgzil opened this issue Apr 30, 2020 · 0 comments
Open

Increase maximum length in nlp #36

lizgzil opened this issue Apr 30, 2020 · 0 comments

Comments

@lizgzil
Copy link
Contributor

lizgzil commented Apr 30, 2020

When using the deep reference parser in Reach, we got the error:
[note this is from the deep_reference_parser-2019.12.1-py3-none-any.whl version, but I think this issue still stands in the current DRP version]

...
  File "/usr/local/lib/python3.6/site-packages/deep_reference_parser/split_section.py", line 78, in split
    doc = nlp(text)
  File "/usr/local/lib/python3.6/site-packages/spacy/language.py", line 392, in __call__
    Errors.E088.format(length=len(text), max_length=self.max_length)
ValueError: [E088] Text of length 1154040 exceeds maximum of 1000000. The v2.x parser and NER models require roughly 1GB of temporary memory per 100,000 characters in the input. This means long texts may cause memory allocation errors. If you're not using the parser or NER, it's probably safe to increase the `nlp.max_length` limit. The limit is in number of characters, so you can check whether your inputs are too long by checking `len(text)`.

From looking at https://datascience.stackexchange.com/questions/38745/increasing-spacy-max-nlp-limit I think for split.py, split_parse.py and parse.py we just need to change the lines

nlp = en_core_web_sm.load()
doc = nlp(text)

to

nlp = en_core_web_sm.load()
nlp.max_length = len(text)
doc = nlp(text, disable = ['ner', 'parser'])
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