This task consists of creating a Sentence Embedding. That is, a vector of sentence representations which can be used for a downstream task. The ~flash.text.embedding.model.TextEmbedder
implementation relies on components from sentence-transformers.
Let's look at an example of generating sentence embeddings.
We start by loading some sentences for prediction with the ~flash.text.classification.data.TextClassificationData
class. Next, we create our ~flash.text.embedding.model.TextEmbedder
with a pretrained backbone from the HuggingFace hub. Finally, we create a ~flash.core.trainer.Trainer
and generate sentence embeddings. Here's the full example:
../../../flash_examples/text_embedder.py
To learn how to view the available backbones / heads for this task, see backbones_heads
.