embedding
¤
This module defines protocols and concrete implementations for embedding models used for text representation.
EmbeddingModelLike
¤
Bases: Protocol
A protocol that defines the methods and attributes that an embedding model should implement.
tokenizer
property
¤
tokenizer: TokenizerLike
Returns:
-
TokenizerLike
–The tokenizer used by the model.
SentenceTransformerEmbeddingModel
¤
An embedding model that uses the SentenceTransformer library.
It implements the EmbeddingModelLike protocol.
Attributes:
-
model_name
(str
) –The name of the model to use.
-
use_gpu
(bool
) –Whether to use the GPU for inference.
-
model
(SentenceTransformer
) –The SentenceTransformer model.
Parameters:
-
model_name
(str
) –The name of the model to use.
-
use_gpu
(bool
, default:False
) –Whether to use the GPU for inference.
tokenizer
property
¤
tokenizer: PreTrainedTokenizerBase
Returns:
-
PreTrainedTokenizerBase
–The tokenizer used by the underlying model.