Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Latest commit

 

History

History
37 lines (27 loc) · 1.33 KB

text_embedder.rst

File metadata and controls

37 lines (27 loc) · 1.33 KB

Text Embedder

The Task

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.


Example

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.