Shortcuts

TextEmbedder

class flash.text.embedding.model.TextEmbedder(backbone='sentence-transformers/all-MiniLM-L6-v2', max_length=128, tokenizer_backbone=None, tokenizer_kwargs=None, enable_ort=False)[source]

The TextEmbedder is a Task for generating sentence embeddings, training and validation. For more details, see embeddings.

You can change the backbone to any question answering model from UKPLab/sentence-transformers using the backbone argument.

Parameters
classmethod available_finetuning_strategies(cls)

Returns a list containing the keys of the available Finetuning Strategies.

Return type

List[str]

classmethod available_lr_schedulers(cls)

Returns a list containing the keys of the available LR schedulers.

Return type

List[str]

classmethod available_optimizers(cls)

Returns a list containing the keys of the available Optimizers.

Return type

List[str]

classmethod available_outputs(cls)

Returns the list of available outputs (that can be used during prediction or serving) for this Task.

Examples

..testsetup:

>>> from flash import Task
>>> print(Task.available_outputs())
['preds', 'raw']
Return type

List[str]

forward(batch)[source]

Adapted from sentence-transformers:

https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/models/Transformer.py#L45

Return type

Tensor