Open qiunlp opened 4 years ago
stanfordcorenlp interface in this DrQA implementation seems broken.
You can use --tokenizer regexp
as a workaround, which does not rely on pexect.
Hi, I run python3 scripts/reader/predict.py ./data/datasets/SQuAD-v1.1-dev.json --tokenizer regexp
and changed the model config as
DEFAULTS = { 'tokenizer': CoreNLPTokenizer, 'model': os.path.join(DATA_DIR, 'reader/multitask.mdl'), }
in drqa/reader/init.py, and it works
WHEN I RUN THE COMMAND python scripts/reader/interactive.py I GET THE FOLLOWING ERROR
['hello', 'world'] ---------CoreNLP IS GOOD!
03/02/2020 09:50:06 AM: [ Running on CPU only. ] 03/02/2020 09:50:06 AM: [ Initializing model... ] 03/02/2020 09:50:06 AM: [ Loading model /home/qwh/桌面/DrQA/data/reader/single.mdl ] 03/02/2020 09:50:06 AM: [ Initializing tokenizer... ] Traceback (most recent call last): File "/home/qwh/.local/lib/python3.6/site-packages/pexpect/expect.py", line 99, in expect_loop incoming = spawn.read_nonblocking(spawn.maxread, timeout) File "/home/qwh/.local/lib/python3.6/site-packages/pexpect/pty_spawn.py", line 462, in read_nonblocking raise TIMEOUT('Timeout exceeded.') pexpect.exceptions.TIMEOUT: Timeout exceeded.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "scripts/reader/interactive.py", line 59, in
predictor = Predictor(args.model, args.tokenizer, num_workers=0,normalize=not args.no_normalize)
File "/home/qwh/桌面/DrQA/drqa/reader/predictor.py", line 83, in init
self.tokenizer = tokenizer_class(annotators=annotators)
File "/home/qwh/桌面/DrQA/drqa/tokenizers/corenlp_tokenizer.py", line 32, in init
self._launch()
File "/home/qwh/桌面/DrQA/drqa/tokenizers/corenlp_tokenizer.py", line 60, in _launch
self.corenlp.expect_exact('NLP>', searchwindowsize=100)
File "/home/qwh/.local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 390, in expect_exact
return exp.expect_loop(timeout)
File "/home/qwh/.local/lib/python3.6/site-packages/pexpect/expect.py", line 107, in expect_loop
return self.timeout(e)
File "/home/qwh/.local/lib/python3.6/site-packages/pexpect/expect.py", line 70, in timeout
raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7fc766cab6a0>
command: /bin/bash
args: ['/bin/bash']
buffer (last 100 chars): b'7000-2019-PG0: ~/\xe6\xa1\x8c\xe9\x9d\xa2/DrQA\x07\x1b[01;32mqwh@qwh-Legion-Y7000-2019-PG0\x1b[00m:\x1b[01;34m~/\xe6\xa1\x8c\xe9\x9d\xa2/DrQA\x1b[00m$ '
before (last 100 chars): b'7000-2019-PG0: ~/\xe6\xa1\x8c\xe9\x9d\xa2/DrQA\x07\x1b[01;32mqwh@qwh-Legion-Y7000-2019-PG0\x1b[00m:\x1b[01;34m~/\xe6\xa1\x8c\xe9\x9d\xa2/DrQA\x1b[00m$ '
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 31916
child_fd: 6
closed: False
timeout: 60
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 100000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
0: "b'NLP>'"