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

Issue during preprocessing: 'CoreNLP' object has no attribute 'client' #54

Open
nikhilcss97 opened this issue Jun 16, 2021 · 6 comments

Comments

@nikhilcss97
Copy link

Facing this during preprocess.
Command: python run.py preprocess experiments/spider-glove-run.jsonnet.
Someone, please help.

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 <module>
    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'
@nikhilcss97
Copy link
Author

Also facing this when I commented out Ln 24 from corenlp.py

Exception: Please install Stanford CoreNLP and put it at /app/third_party/stanford-corenlp-full-2018-10-05.

SoyOscarRH-Microsoft added a commit to SoyOscarRH-Microsoft/rat-sql that referenced this issue Jun 18, 2021
The url for the ``stanford-corenlp-full-2018-10-05`` has changed.

@see microsoft#54
@nikhilcss97
Copy link
Author

Thanks!! This worked.

@eyuansu62
Copy link

hello, I install the new version of CoreNLP, but I still face this problem. could you please tell me why?

@m1nhtu99-hoan9
Copy link

Because Stanford has already moved CoreNLPClient to other package called stanfordnlp.

After installing stanfordnlp package, change this line:

import corenlp

...into:

from stanfordnlp.server import CoreNLPClient

And then, change the assignment of client from:

self.client = corenlp.CoreNLPClient()

into:

self.client = CoreNLPClient()

@alexpolozov
Copy link
Contributor

@m1nhtu99-hoan9 Thanks! Happy to merge a PR fix for this.

@m1nhtu99-hoan9
Copy link

@alexpolozov Thanks for the suggestion! I've already submitted the PR #60.

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

4 participants