langtest.modelhandler.custom_modelhandler.PretrainedModelForTextClassification#

class PretrainedModelForTextClassification(model: Any)#

Bases: PretrainedCustomModel, ModelAPI

A custom model handler for text classification using a pre-trained model.

Parameters:
  • PretrainedCustomModel – A class for loading a pre-trained custom model.

  • ModelAPI – A class for handling the model.

predict()#

Predicts the class label for a given text input.

Returns:

A class containing the predicted class label and score.

Return type:

SequenceClassificationOutput

__init__(model: Any) None#

Methods

__init__(model)

load_model(path)

Load the model.

predict(text, *args, **kwargs)

Perform predictions on input text.

predict_raw(text, *args, **kwargs)

Attributes

model_registry

classmethod load_model(path: Any) Any#

Load the model.

predict(text: str, *args, **kwargs) SequenceClassificationOutput#

Perform predictions on input text.