langtest.modelhandler.transformers_modelhandler.PretrainedModelForTranslation#

class PretrainedModelForTranslation(model)#

Bases: ModelAPI

Transformers pretrained model for translation tasks

Parameters:

model (transformers.pipeline.Pipeline) – Pretrained HuggingFace translation pipeline for predictions.

__init__(model)#

Constructor method

Parameters:

model (transformers.pipeline.Pipeline) – Pretrained HuggingFace NER pipeline for predictions.

Methods

__init__(model)

Constructor method

load_model(path, *args, **kwargs)

Load the Translation model into the model attribute.

predict(text, **kwargs)

Perform predictions on the input text.

Attributes

model_registry

classmethod load_model(path: str, *args, **kwargs) Pipeline#

Load the Translation model into the model attribute.

Parameters:

path (str) – path to model or model name

Return type:

‘Pipeline’

predict(text: str, **kwargs) TranslationOutput#

Perform predictions on the input text.

Parameters:
  • text (str) – Input text to perform translation on.

  • kwargs – Additional keyword arguments.

Returns:

Output model for translation tasks

Return type:

TranslationOutput