smartschat / cort

A toolkit for coreference resolution and error analysis.
MIT License
129 stars 34 forks source link

Unable to use out of the box #10

Closed chaitjo closed 8 years ago

chaitjo commented 8 years ago

I was trying to use cort straight out of the box to predict coreference chains on raw text, but was unable to get it running. Here's what I did-

  1. Created a virtualenv called cort and installed cort using pip. The github repo was in another folder called cort_tool, Stanford CoreNLP tools were in another folder called stanford-corenlp.
  2. Downloaded model-train-pair.obj and placed it in cort_tool folder.
  3. Created an input.txt file with a single sentence.
  4. Ran the following commands after activating the venv-
$ cd cort_tool
$ cort-predict-raw -in ~/input.txt -model model-pair-train.obj -extractor cort.coreference.approaches.mention_ranking.extract_substructures -perceptron cort.coreference.approaches.mention_ranking.RankingPerceptron -clusterer cort.coreference.clusterer.all_ante -corenlp ~/stanford-corenlp -suffix out 2>&1 | tee ~/output.txt

I got the following output-

2016-10-03 17:17:55,338 INFO Loading model.
In file included from /home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1777:0,
                 from /home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /home/cil/.pyxbld/temp.linux-x86_64-3.4/pyrex/cort/coreference/perceptrons.c:274:
/home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
In file included from /home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:27:0,
                 from /home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /home/cil/.pyxbld/temp.linux-x86_64-3.4/pyrex/cort/coreference/perceptrons.c:274:
/home/cil/cort/lib/python3.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:1448:1: warning: ‘_import_array’ defined but not used [-Wunused-function]
 _import_array(void)
 ^
2016-10-03 17:18:02,512 INFO Reading in and preprocessing data.
2016-10-03 17:18:02,513 INFO Starting java subprocess, and waiting for signal it's ready, with command: exec java -Xmx4g -XX:ParallelGCThreads=1 -cp '/home/cil/cort/lib/python3.4/site-packages/stanford_corenlp_pywrapper/lib/*:/home/cil/stanford-corenlp/*'      corenlp.SocketServer --outpipe /tmp/corenlp_pywrap_pipe_pypid=20030_time=1475486282.512968  --configfile /home/cil/cort/lib/python3.4/site-packages/cort/config_files/corenlp.ini
INFO:CoreNLP_JavaServer: Using CoreNLP configuration file: /home/cil/cort/lib/python3.4/site-packages/cort/config_files/corenlp.ini
Exception in thread "main" java.lang.UnsupportedClassVersionError: edu/stanford/nlp/pipeline/StanfordCoreNLP : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at corenlp.JsonPipeline.initializeCorenlpPipeline(JsonPipeline.java:206)
    at corenlp.SocketServer.main(SocketServer.java:102)

At this moment, the memory usage of the task cort-predict-raw became Zero so I did a keyboard interrupt and tried again, but got the same result.

I'm on Ubuntu 16.04.

Can you please help me out?

smartschat commented 8 years ago

This looks like an issue of CoreNLP. Which CoreNLP version did you download and which Java version do you have installed? I encountered the same issue when I was trying to run the recent CoreNLP with Java 7. However, Java 7 is not supported anymore. Upgrading to Java 8 solved the issue.

If you cannot install Java 8, you can install an older version of CoreNLP. 3.4.1 is the last version to support Java 6/7.

chaitjo commented 8 years ago

Solved by updating Java to version 8.