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

How to make predications #41

Open
ns-hxue opened this issue Jan 12, 2020 · 7 comments
Open

How to make predications #41

ns-hxue opened this issue Jan 12, 2020 · 7 comments

Comments

@ns-hxue
Copy link

ns-hxue commented Jan 12, 2020

Can you teach me how to make predications after model is trained? Does it come with build in method like .predict()?

@ThilinaRajapakse
Copy link
Owner

Please use Simple Transformers as this repo is now outdated.

To answer your question, this repo does not have such a built-in function whereas Simple Transformers does. If you have already trained a model, you can use it with Simple Transformers as well.

With this repo, you would have to make predictions manually following the same procedure as for evaluation.

@ns-hxue
Copy link
Author

ns-hxue commented Jan 12, 2020

Thanks for the advice. If so, how can I save a model from simple transformers and export the model for real-world usage

@ThilinaRajapakse
Copy link
Owner

from simpletransformers.classification import ClassificationModel


model = ClassificationModel('roberta', '<path_to_directory_containing_trained_model>')
model.predict([<list_of_text>])

@ns-hxue
Copy link
Author

ns-hxue commented Jan 13, 2020

Thank you very much! Just want to confirm, if showes you can save the model using train_model method?

After the model being save, how am I supposed to to load the model? Is there a build in method for that, as I didn't see it on the tutorial

@Mahhos
Copy link

Mahhos commented Jan 28, 2020

by '<path_to_directory_containing_trained_model> in model = ClassificationModel('roberta', '<path_to_directory_containing_trained_model>') you mean we shoud just put "output" folder that is generated during training as the directory? I trained the bert model using run_model.py and now need to make preditions for unlabeled dataset I have.
2. We should put these lines of code at the end after the evaluation. right?
I would highly appreciate if you advise me on this.

@ThilinaRajapakse
Copy link
Owner

This answer was regarding the Simple Transformers library.

I am not sure whether you are referring to Simple Transformers or this repo. Please open an issue on Simple Transformers if it is related to that.

@Mahhos
Copy link

Mahhos commented Jan 28, 2020

I trained the bert model using "run_model.py" in this repository and now need to make predictions for an unlabeled dataset I have. I somehow got confused about how I can make predictions. Would you please advise me on that? Thank you.

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

3 participants