Skip to content

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

Merged
merged 6 commits into from
Aug 17, 2021
Merged

Support prediction for NER new task. #331

merged 6 commits into from
Aug 17, 2021

Conversation

Jiaqiang-Ruan
Copy link
Contributor

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.

@Jiaqiang-Ruan Jiaqiang-Ruan changed the title RJQ: [ner_new_task] predict process for ner task Support prediction for NER new task. Dec 9, 2020
Copy link
Member

@hunterhector hunterhector left a 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.

print('---- example -----')
print("sentence: ", sent)
print("ner_tags: ", ner_tags)
print(evaluator.get_result())
Copy link
Member

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
Copy link

codecov bot commented Dec 9, 2020

Codecov Report

Merging #331 (84513f4) into master (1e3ba68) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e3ba68...84513f4. Read the comment docs.


def predict_forward_fn(model, batch):
'''Use model and batch data to predict ner tag.'''
word = batch["text_tag"]["tensor"]
Copy link
Collaborator

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.

Copy link
Member

@hunterhector hunterhector left a 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'])
Copy link
Member

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?

@hunterhector hunterhector marked this pull request as ready for review August 17, 2021 15:59
@hunterhector hunterhector merged commit 4e891a8 into asyml:master Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants