How do you load a simpletransformers model from a checkpoint?

Viewed 2638

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?

2 Answers
from simpletransformers.classification import ClassificationModel

model = ClassificationModel("bert", "outputs/best_model")
model.predict(['Enter text to classify'])
model = ClassificationModel(model_name, model_path, num_labels=no_labels)
Related