vectorisers.huggingface.HuggingFaceVectoriser
vectorisers.huggingface.HuggingFaceVectoriser(
model_name,
device=None,
model_revision='main',
tokenizer_kwargs=None,
model_kwargs=None,
)
A general wrapper class for Huggingface Transformers models to generate text embeddings.
Attributes
| model_name |
str |
The name of the Huggingface model to use. |
| tokenizer |
transformers.PreTrainedTokenizer |
The tokenizer for the specified model. |
| model |
transformers.PreTrainedModel |
The Huggingface model instance. |
| device |
torch.device |
The device (CPU or GPU) on which the model is loaded. |
| tokenizer_kwargs |
dict |
Additional keyword arguments passed to the tokenizer. |
| model_kwargs |
dict |
Additional keyword arguments passed to the model. |
Methods
| transform |
Transforms input text(s) into embeddings using the Huggingface model. |