microsoft / rat-sql

A relation-aware semantic parsing model from English to SQL
https://arxiv.org/abs/1911.04942
MIT License
406 stars 117 forks source link

AttributeError: 'CoreNLP' object has no attribute 'client' #43

Closed haiahaiah closed 3 years ago

haiahaiah commented 3 years ago

Hi, I build the environment without docker and I wanna ask which version "corenlp" should be ??? InUsing CoreNLP within other programming languages and packagesI can't find the proper "corenlp". I will appreciate it if somebody could help me out of this problem.

WARNING <class 'ratsql.models.enc_dec.EncDecModel.Preproc'>: superfluous {'name': 'EncDec'} DB connections: 100%|████████████████████████| 166/166 [00:00<00:00, 205.93it/s] train section: 0%| | 0/8659 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/yuhai/workspace/nl2sql/rat-sql/run.py", line 109, in main() File "/home/yuhai/workspace/nl2sql/rat-sql/run.py", line 73, in main preprocess.main(preprocess_config) File "/data/yuhai/nl2sql/rat-sql/ratsql/commands/preprocess.py", line 53, in main preprocessor.preprocess() File "/data/yuhai/nl2sql/rat-sql/ratsql/commands/preprocess.py", line 34, in preprocess self.model_preproc.add_item(item, section, validation_info) File "/data/yuhai/nl2sql/rat-sql/ratsql/models/enc_dec.py", line 43, in add_item self.enc_preproc.add_item(item, section, enc_info) File "/data/yuhai/nl2sql/rat-sql/ratsql/models/spider/spider_enc.py", line 168, in add_item preprocessed = self.preprocess_item(item, validation_info) File "/data/yuhai/nl2sql/rat-sql/ratsql/models/spider/spider_enc.py", line 193, in preprocess_item question, question_for_copying = self._tokenize_for_copying(item.text, item.orig['question']) File "/data/yuhai/nl2sql/rat-sql/ratsql/models/spider/spider_enc.py", line 239, in _tokenize_for_copying return self.word_emb.tokenize_for_copying(unsplit) File "/data/yuhai/nl2sql/rat-sql/ratsql/resources/pretrained_embeddings.py", line 67, in tokenize_for_copying ann = corenlp.annotate(text, self.corenlp_annotators) File "/data/yuhai/nl2sql/rat-sql/ratsql/resources/corenlp.py", line 44, in annotate _singleton = CoreNLP() File "/data/yuhai/nl2sql/rat-sql/ratsql/resources/corenlp.py", line 20, in init self.client = corenlp.CoreNLPClient() AttributeError: module 'corenlp' has no attribute 'CoreNLPClient' Exception ignored in: <function CoreNLP.del at 0x7fa50c979680> Traceback (most recent call last): File "/data/yuhai/nl2sql/rat-sql/ratsql/resources/corenlp.py", line 23, in del self.client.stop() AttributeError: 'CoreNLP' object has no attribute 'client'

Process finished with exit code 1

nikhilcss97 commented 3 years ago

I am facing the same issue during preprocessing. Can someone please help me?

DB connections: 100%|████████████████████████| 166/166 [00:00<00:00, 326.78it/s] train section: 0%| | 0/8659 [00:00<?, ?it/s] Traceback (most recent call last): File "run.py", line 109, in main() File "run.py", line 73, in main preprocess.main(preprocess_config) File "/app/ratsql/commands/preprocess.py", line 53, in main preprocessor.preprocess() File "/app/ratsql/commands/preprocess.py", line 34, in preprocess self.model_preproc.add_item(item, section, validation_info) File "/app/ratsql/models/enc_dec.py", line 43, in add_item self.enc_preproc.add_item(item, section, enc_info) File "/app/ratsql/models/spider/spider_enc.py", line 168, in add_item preprocessed = self.preprocess_item(item, validation_info) File "/app/ratsql/models/spider/spider_enc.py", line 193, in preprocess_item question, question_for_copying = self._tokenize_for_copying(item.text, item.orig['question']) File "/app/ratsql/models/spider/spider_enc.py", line 239, in _tokenize_for_copying return self.word_emb.tokenize_for_copying(unsplit) File "/app/ratsql/resources/pretrained_embeddings.py", line 67, in tokenize_for_copying ann = corenlp.annotate(text, self.corenlp_annotators) File "/app/ratsql/resources/corenlp.py", line 45, in annotate _singleton = CoreNLP() File "/app/ratsql/resources/corenlp.py", line 20, in init Landing page: https://stanfordnlp.github.io/CoreNLP/''') Exception: Please install Stanford CoreNLP and put it at /app/third_party/stanford-corenlp-full-2018-10-05.

            Direct URL: http://nlp.stanford.edu/software/stanford-corenlp-full-2018-10-05.zip
            Landing page: https://stanfordnlp.github.io/CoreNLP/

Exception ignored in: <function CoreNLP.del at 0x7f87b0e83cb0> Traceback (most recent call last): File "/app/ratsql/resources/corenlp.py", line 24, in del self.client.stop() AttributeError: 'CoreNLP' object has no attribute 'client'

senthurRam33 commented 2 years ago

One source of the problem is that coreNLP client cannot be used in colab. Try to run the preprocess in the local machine and upload in the drive and then run the training in the colab

muruan01 commented 1 year ago

I encountered the same issue and resolved it. Record it just hope to help the newcomers. That issue is caused by the wrong "corenlp" package. You can unisntall it by "pip uninstall corenlp" and install the right one "pip install stanford-corenlp". Official package page is here : https://pypi.org/project/stanford-corenlp/. Hope it can help.