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
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support