"java.lang.OutOfMemoryError: Java heap space" when running "ga.nlp.annotate" using GraphAware NLP

Viewed 297

Windows 10
32Gb RAM
8 core Xeon processor at 3.4GHz

Neo4j 3.4.7
Neo4j Browser 3.2.13
apoc-3.4.0.3.jar
graphaware-nlp-3.4.7.52.13.jar
graphaware-server-community-all-3.4.7.52.jar
nlp-stanfordnlp-3.4.7.52.13.jar
stanford-english-corenlp-2018-10-05-models.jar

Hi. I am trying to annotate all the text fields in my database. There are 25532 nodes with text values.

I'm using the following query to do this:

CALL apoc.periodic.iterate(
"MATCH (n:FreeTextResponse) WHERE NOT (n)-[:HAS_ANNOTATED_TEXT]->() RETURN n",
"CALL ga.nlp.annotate({text: n.fullSentenceString, id: id(n), checkLanguage: false})
YIELD result MERGE (n)-[:HAS_ANNOTATED_TEXT]->(result)", {batchSize:1, iterateList:false})

...and am getting the following error:

java.lang.OutOfMemoryError: Java heap space

I'm sure this is just a settings change somewhere, but I'm not sure what or where. Sorry if this is a bit of a newbie question!

1 Answers

The default configuration is 512MB and it is not enough for the models used by Stanford NLP. As suggested here:

https://github.com/graphaware/neo4j-nlp

Change your neo4j.conf file in the following way:

dbms.memory.heap.initial_size=3000m
dbms.memory.heap.max_size=5000m

Although considering your RAM availability I would suggest 5GB for both values.

Related