CogComp / cogcomp-nlpy

CogComp's light-weight Python NLP annotators
http://nlp.cogcomp.org/
Other
116 stars 26 forks source link

Serialization call fails to write the temporary proto #87

Closed sarlinpe closed 6 years ago

sarlinpe commented 6 years ago

Thanks a lot for this awesome toolbox! After solving the issue https://github.com/CogComp/cogcomp-nlpy/issues/86 with the provided fix, another problem arises when running the same test example:

$ python test.py
INFO:ccg_nlpy.pipeline_config:Using local pipeline
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [0.6 sec].
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... done [0.6 sec].
INFO:ccg_nlpy.local_pipeline:pipeline has been set up
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    doc = pipeline.doc(d)
  File "/cluster/home/psarlin/test_cogcomp/env/lib/python3.6/site-packages/ccg_nlpy/pipeline_base.py", line 36, in doc
    response = self.call_server(text, "TOKENS")
  File "/cluster/home/psarlin/test_cogcomp/env/lib/python3.6/site-packages/ccg_nlpy/local_pipeline.py", line 75, in call_server
    with open(path, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/cluster/home/psarlin/.ccg_nlpy/temp.temp'

It seems that the serialization call https://github.com/CogComp/cogcomp-nlpy/blob/5c3008d68f466388d5c70066edbf95f2afe1de4f/ccg_nlpy/local_pipeline.py#L70 does not produce any file. Any suggestion ?

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core)
Release:        7.4.1708
Codename:       Core
$ java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
$ python --version
Python 3.6.1
danyaljj commented 6 years ago

hmm .... can you try a different path? Say self.ProtobufSerializer.writeToFile(text_annotation,'/cluster/home/psarlin/file.test')

or alternatively make you sure you this folder: . ccg_nlpy

sarlinpe commented 6 years ago

Same problem with a different path. I do own $HOME and its subfolder .ccg_nlpy.

danyaljj commented 6 years ago

@Skydes I'm sorry for the inconvenience.

What version of pyjnius are you using? This command should contain the version:

pip show pyjnius 
pip show ccg_nlpy 
GHLgh commented 6 years ago

Could you try to covert the "path" into Java String as suggested in #86, like self.ProtobufSerializer.writeToFile(text_annotation,self.JString(path)). This line is also passing parameters to Java API, so it is likely to be the same string conversion issue.

sarlinpe commented 6 years ago

@GHLgh @danyaljj PR https://github.com/CogComp/cogcomp-nlpy/pull/88 solved the issue, thanks a lot!