Embedding¶
This section contains the API reference for the distilabel
embeddings.
For more information on how the Embeddings
works and see some examples.
base
¶
Embeddings
¶
Bases: RuntimeParametersMixin
, BaseModel
, _Serializable
, ABC
Base class for Embeddings
models.
To implement an Embeddings
subclass, you need to subclass this class and implement:
- load
method to load the Embeddings
model. Don't forget to call super().load()
,
so the _logger
attribute is initialized.
- model_name
property to return the model name used for the Embeddings
.
- encode
method to generate the sentence embeddings.
Attributes:
Name | Type | Description |
---|---|---|
_logger |
Logger
|
the logger to be used for the |
Source code in src/distilabel/embeddings/base.py
model_name: str
abstractmethod
property
¶
Returns the model name used for the Embeddings
.
load()
¶
unload()
¶
encode(inputs)
abstractmethod
¶
Generates embeddings for the provided inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs
|
List[str]
|
a list of texts for which an embedding has to be generated. |
required |
Returns:
Type | Description |
---|---|
List[List[Union[int, float]]]
|
The generated embeddings. |