Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you load a simpletransformers model from a checkpoint?

I'm using simpletransformers (https://github.com/ThilinaRajapakse/simpletransformers) for a work project. After training a model, I get a bunch of files dumped to the output folder. I was wondering, if you wanted to load in a previously trained model (which I assume is saved to the output folder) so that you can immediately run it against new data, how would one go about doing this?Picture of files in output folder

With scikit-learn, you can export models to json easily, and load them back in, I figured there might be a similar process for this?

like image 356
Hart Avatar asked Nov 15 '25 23:11

Hart


1 Answers

from simpletransformers.classification import ClassificationModel

model = ClassificationModel("bert", "outputs/best_model")
model.predict(['Enter text to classify'])
like image 66
Shilpa Shinde Avatar answered Nov 17 '25 22:11

Shilpa Shinde



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!