textfier.tasks

Pre-defined tasks provide an easier framework when loading pre-trained models. Hence, this package serves as a wrapper around pre-trained models loading from Huggingface’s Transformers.

Task-related classes and helpers with pre-defined tasks.

class textfier.tasks.CausalLanguageModelingTask(model: str, **kwargs)

Bases: textfier.core.Task

CausalLanguageModelingTask implements a pre-trained task used to handle causal language modeling.

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.

class textfier.tasks.MaskedLanguageModelingTask(model: str, **kwargs)

Bases: textfier.core.Task

MaskedLanguageModelingTask implements a pre-trained task used to handle masked language modeling.

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.

class textfier.tasks.NamedEntityRecognitionTask(model: str, **kwargs)

Bases: textfier.core.Task

NamedEntityRecognitionTask implements a pre-trained task used to handle named entity recognition.

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.

class textfier.tasks.QuestionAnsweringTask(model: str, **kwargs)

Bases: textfier.core.Task

QuestionAnsweringTask implements a pre-trained task used to handle question answering.

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.

class textfier.tasks.Seq2SeqTask(model: str, **kwargs)

Bases: textfier.core.Task

Seq2SeqTask implements a pre-trained task used to handle sequence-to-sequence tasks (summarization and translation).

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.

class textfier.tasks.SequenceClassificationTask(model: str, **kwargs)

Bases: textfier.core.Task

SequenceClassificationTask implements a pre-trained task used to handle text classification.

__init__(self, model: str, **kwargs)

Initialization method.

Parameters

model – Identifier of the pre-trained model to be loaded.

_build(self, model: str)

Builds up the pre-trained model according to the desired task.

Parameters

model – Identifier of the pre-trained model to be built.