Instructions to use rxdtech/potion-code-16M-v2-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Model2Vec
How to use rxdtech/potion-code-16M-v2-onnx with Model2Vec:
from model2vec import StaticModel model = StaticModel.from_pretrained("rxdtech/potion-code-16M-v2-onnx") - sentence-transformers
How to use rxdtech/potion-code-16M-v2-onnx with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("rxdtech/potion-code-16M-v2-onnx") 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
potion-code-16M-v2-onnx
This is an ONNX export of the minishlab/potion-code-16M-v2 Model2Vec model, produced with the ONNX runtime. Model2Vec models use static embeddings, allowing text embeddings to be computed orders of magnitude faster on both GPU and CPU. This ONNX export lets you run the model with onnxruntime or transformers.js, without depending on the model2vec package.
model_quantized.onnx is int8 quantized for CPU, model.onnx is FP32.
Usage
Using ONNX Runtime
import onnxruntime as ort
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("potion-code-16M-v2-onnx")
session = ort.InferenceSession("onnx/model_quantized.onnx") # or onnx/model.onnx
encodings = tokenizer(["Example sentence"], padding=True, return_tensors="np")
embeddings = session.run(None, dict(encodings))[0]
Overview
potion-code-16M-v2 is a fast static code embedding model optimized for code retrieval tasks. It powers Semble, a code search library for agents. It is distilled from nomic-ai/CodeRankEmbed and trained on the CornStack code corpus using Tokenlearn and contrastive fine-tuning. It is the successor to potion-code-16M. It uses static embeddings, allowing text and code embeddings to be computed orders of magnitude faster than transformer-based models on both GPU and CPU.
Model Details
| Property | Value |
|---|---|
| Parameters | ~16M |
| Embedding dimensions | 256 |
| Vocabulary size | ~63,500 |
| Teacher model | nomic-ai/CodeRankEmbed |
| Training corpus | CornStack (6 languages: Python, Java, JavaScript, Go, PHP, Ruby) |
| Max sequence length | 1,000,000 tokens (static, no limit in practice) |
Further details
See the original model minishlab/potion-code-16M-v2 for complete details.
- Downloads last month
- 13