Instructions to use minishlab/potion-retrieval-32M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Model2Vec
How to use minishlab/potion-retrieval-32M with Model2Vec:
from model2vec import StaticModel model = StaticModel.from_pretrained("minishlab/potion-retrieval-32M") embeddings = model.encode(["It's dangerous to go alone!", "It's a secret to everybody."]) print(embeddings.shape) - sentence-transformers
How to use minishlab/potion-retrieval-32M with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("minishlab/potion-retrieval-32M") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
docs: Add FastEmbed usage example
Browse filesHi! This PR adds a short example of running potion-retrieval-32M with [FastEmbed](https://github.com/qdrant/fastembed), a lightweight, fast, Python library built for embedding generation.
FastEmbed has supported the potion models since v0.9.1. It loads `model.safetensors` straight from this repo, so it uses the same weights as model2vec.
I tested the snippet with `fastembed==0.9.1`. The embeddings match `model2vec` (cosine similarity 1.0).
20 unmodified lines21222324252626 unmodified lines53545556575820 unmodified lines- embeddings- static-embeddings- sentence-transformersbase_model_relation: finetune---26 unmodified linesembeddings = model.encode(["Example sentence"])```## How it works20 unmodified lines2122232425262726 unmodified lines54555657585960616263646566676869707172737420 unmodified lines- embeddings- static-embeddings- sentence-transformers- fastembedbase_model_relation: finetune---26 unmodified linesembeddings = model.encode(["Example sentence"])```### Using FastEmbedThis model can also be used with [FastEmbed](https://github.com/qdrant/fastembed), a lightweight, fast, Python library built for embedding generation:```pip install fastembed``````pythonfrom fastembed import TextEmbedding# Load the modelmodel = TextEmbedding("minishlab/potion-retrieval-32M")# Compute text embeddingsembeddings = list(model.embed(["Example sentence"]))```## How it works
README.md+16