1
Install Model2Vec
Run `pip install model2vec` to install the library. Add `[training]` to enable fine-tuning features.
2
Load a Pretrained Model
Use `StaticModel.from_pretrained('minishlab/potion-base-8M')` to load a model from Hugging Face Hub.
3
Generate Embeddings
Encode text by calling `model.encode(["sentence1", "sentence2"])` to obtain sentence embeddings.
4
Integrate with Vector Databases
For Milvus integration, install with `pip install "pymilvus[model]"` and create embedding function with `model.dense.Model2VecEmbeddingFunction(model_source='minishlab/potion-base-8M')`.
5
Use Local Models
Specify the local file path as `model_source` when loading models from disk.