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

如何看一个batch的具体NER结果呢 #21

Open
zywzyw opened this issue Dec 29, 2020 · 4 comments
Open

如何看一个batch的具体NER结果呢 #21

zywzyw opened this issue Dec 29, 2020 · 4 comments

Comments

@zywzyw
Copy link

zywzyw commented Dec 29, 2020

No description provided.

@zywzyw
Copy link
Author

zywzyw commented Dec 29, 2020

I tried python evaluate.py chips_2020
then I got the following error message:
Traceback (most recent call last):
File "evaluate.py", line 22, in
model.evaluate(session,True)
File "/home/xxx/biaffine-ner/biaffine_ner_model.py", line 287, in evaluate
self.load_eval_data()
File "/home/xxx/biaffine-ner/biaffine_ner_model.py", line 280, in load_eval_data
self.eval_data = [load_line(l) for l in f.readlines()]
File "/home/xxx/biaffine-ner/biaffine_ner_model.py", line 277, in load_line
return self.tensorize_example(example, is_training=False), example
File "/home/xxx/biaffine-ner/biaffine_ner_model.py", line 127, in tensorize_example
lm_emb = self.load_lm_embeddings(doc_key)
File "/home/xxx/biaffine-ner/biaffine_ner_model.py", line 93, in load_lm_embeddings
group = self.lm_file[file_key]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/xxx/.pyenv/versions/biaffine/lib/python2.7/site-packages/h5py/_hl/group.py", line 264, in getitem
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'batch_test_1' doesn't exist)"

@juntaoy
Copy link
Owner

juntaoy commented Dec 29, 2020

You will need to run the extract_bert_features.sh first to get the cached BERT embedding for your test set.

@zywzyw
Copy link
Author

zywzyw commented Dec 29, 2020

You will need to run the extract_bert_features.sh first to get the cached BERT embedding for your test set.

I really appreciate your quick reply!
Actually, I have already done the part you mentioned and I could see the result on the Tensorboard, like Precision and Recall. But I desire to see the NER label type on one exact example, so I run the command python evaluate.py chips_2020 . the test filename is test.jsonlines, and the doc_key is 'batch_test_1'. I would like konw that if I should run python evaluate.py chips_2020 when I want to get result of the label type.

@juntaoy
Copy link
Owner

juntaoy commented Dec 29, 2020

If you got the error it might mean you only cached BERT embeddings for train and dev set but not the test set, you might need to run it for test.jsonlines as well. If you have done so correctly you will be able to get the scores for both overall and per-label.

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

2 participants