-
Notifications
You must be signed in to change notification settings - Fork 60
Support prediction for NER new task. #331
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit curious on how do we know the model class here? I have the same question as the SRL example.
examples/ner_new/main_predict.py
Outdated
print('---- example -----') | ||
print("sentence: ", sent) | ||
print("ner_tags: ", ner_tags) | ||
print(evaluator.get_result()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the whole dataset result at the end?
Codecov Report
@@ Coverage Diff @@
## master #331 +/- ##
=======================================
Coverage 81.13% 81.13%
=======================================
Files 209 209
Lines 14615 14615
=======================================
Hits 11858 11858
Misses 2757 2757 Continue to review full report at Codecov.
|
examples/ner_new/main_predict.py
Outdated
|
||
def predict_forward_fn(model, batch): | ||
'''Use model and batch data to predict ner tag.''' | ||
word = batch["text_tag"]["tensor"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if you can add typing hint for all variables here.
…to folder tagging;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR should be good. Do we have the models downloadable somewhere? And do we have a README file associated?
predictor = Predictor(batch_size=config_predict['batch_size'], | ||
model=saved_model, | ||
predict_forward_fn=predict_forward_fn, | ||
feature_resource=train_state['feature_resource']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think the better way to put predict_forward_fn
is make it an abstract function of Predictor
?
Description of changesAdd the user file for running the prediction for NER task on Conll03 task.
Possible influences of this PR.
The code will use the extractor framework and will need the output from train process to do the prediction.
Test Conducted
Small dataset validation is done.