autointent.Embedder#
- class autointent.Embedder(model_name, device='cpu', batch_size=32, max_length=None, use_cache=False)#
A wrapper for managing embedding models using Sentence Transformers.
This class handles initialization, saving, loading, and clearing of embedding models, as well as calculating embeddings for input texts.
- Parameters:
- model_name#
- device = 'cpu'#
- batch_size = 32#
- max_length = None#
- use_cache = False#
- logger#
- __hash__()#
Compute a hash value for the Embedder.
- Returns:
The hash value of the Embedder.
- Return type:
- clear_ram()#
Move the embedding model to CPU and delete it from memory.
- Return type:
None
- delete()#
Delete the embedding model and its associated directory.
- Return type:
None
- dump(path)#
Save the embedding model and metadata to disk.
- Parameters:
path (pathlib.Path) – Path to the directory where the model will be saved.
- Return type:
None
- load(path)#
Load the embedding model and metadata from disk.
- Parameters:
path (pathlib.Path | str) – Path to the directory where the model is stored.
- Return type:
None