Create embeddings with Model2Vec
Model2Vec.from_pretrained
method. This method allows you to load models from the Hugging Face Hub or from a local path.
Parameters
True
, embeddings will be normalized; if False
, they won’t. If None
, the model’s default behavior applies.None
to load from the root."float16"
or a torch.dtype
). If a string is passed, it’s converted to the corresponding DType
. Set to None
for no quantization.None
, uses the model’s inherent dimensionality. Useful when loading a model with reduced dimensions (e.g., trained via PCA or MRL).encode
method of the Model2Vec
class. This method allows you to encode a list of sentences into mean embeddings.
Parameters
encode_as_sequence
method of the Model2Vec
class. This method allows you to encode a list of sentences into sequence embeddings, which are useful for tasks where you need a single embedding per token.
Parameters