Feature Extraction
sentence-transformers
ONNX
Safetensors
GGUF
English
code
roberta
python
javascript
go
java
ruby
php
code-search
code-embeddings
multilingual
matryoshka
unixcoder
mteb
Eval Results (legacy)
text-embeddings-inference
Instructions to use divakantpandey/code-embed-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use divakantpandey/code-embed-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("divakantpandey/code-embed-v2") 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
- Local Apps Settings
- llama.cpp
How to use divakantpandey/code-embed-v2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible embeddings server: llama serve -hf divakantpandey/code-embed-v2:Q8_0 --embeddings
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible embeddings server: llama serve -hf divakantpandey/code-embed-v2:Q8_0 --embeddings
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible embeddings server: ./llama-server -hf divakantpandey/code-embed-v2:Q8_0 --embeddings
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible embeddings server: ./build/bin/llama-server -hf divakantpandey/code-embed-v2:Q8_0 --embeddings
- LM Studio
- Jan
- Ollama
How to use divakantpandey/code-embed-v2 with Ollama:
ollama run hf.co/divakantpandey/code-embed-v2:Q8_0
- Unsloth Desktop
- Docker Model Runner
How to use divakantpandey/code-embed-v2 with Docker Model Runner:
docker model run hf.co/divakantpandey/code-embed-v2:Q8_0
- Lemonade
How to use divakantpandey/code-embed-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull divakantpandey/code-embed-v2:Q8_0
Run and chat with the model
lemonade run user.code-embed-v2-Q8_0
List all available models
lemonade list
- Atomic Chat
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -281,7 +281,7 @@ When filtering by parameter scale for lightweight, production-ready edge models
|
|
| 281 |
| 🏅 **#8** | **`CoIR`** | $\le$ 141M (`2M – 141.3M`) | **`0.5343`** | 👉 [CoIR Leaderboard (Rank #8)](https://mteb-leaderboard.hf.space/benchmark/CoIR?minSize=2&maxSize=141.2537544622754) |
|
| 282 |
| 🏅 **#9** | **`MTEB(Code, v1)`** | $\le$ 141M (`2M – 141.3M`) | **`0.5475`** | 👉 [MTEB Code Leaderboard (Rank #9)](https://mteb-leaderboard.hf.space/benchmark/MTEB(Code%2C%20v1)?minSize=2&maxSize=141.2537544622754) |
|
| 283 |
|
| 284 |
-
|
| 285 |
|
| 286 |
### 🌟 Key Benchmark Highlights *(Sorted by Rank Ascending)*
|
| 287 |
|
|
@@ -652,6 +652,75 @@ for doc in matched_docs:
|
|
| 652 |
|
| 653 |
---
|
| 654 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 655 |
## 📜 License & Citation
|
| 656 |
|
| 657 |
This project and its model weights are licensed under the **Creative Commons Attribution-NonCommercial 4.0 International License (CC-BY-NC 4.0)**.
|
|
|
|
| 281 |
| 🏅 **#8** | **`CoIR`** | $\le$ 141M (`2M – 141.3M`) | **`0.5343`** | 👉 [CoIR Leaderboard (Rank #8)](https://mteb-leaderboard.hf.space/benchmark/CoIR?minSize=2&maxSize=141.2537544622754) |
|
| 282 |
| 🏅 **#9** | **`MTEB(Code, v1)`** | $\le$ 141M (`2M – 141.3M`) | **`0.5475`** | 👉 [MTEB Code Leaderboard (Rank #9)](https://mteb-leaderboard.hf.space/benchmark/MTEB(Code%2C%20v1)?minSize=2&maxSize=141.2537544622754) |
|
| 283 |
|
| 284 |
+
### 🌟 Key Benchmark Highlights
|
| 285 |
|
| 286 |
### 🌟 Key Benchmark Highlights *(Sorted by Rank Ascending)*
|
| 287 |
|
|
|
|
| 652 |
|
| 653 |
---
|
| 654 |
|
| 655 |
+
### Example 7: Local Serving with Ollama
|
| 656 |
+
|
| 657 |
+
Run `code-embed-v2` locally with Ollama (native embed API or OpenAI-compatible endpoint):
|
| 658 |
+
|
| 659 |
+
```bash
|
| 660 |
+
# 1. Pull & run directly from Hugging Face
|
| 661 |
+
ollama pull hf.co/divakantpandey/code-embed-v2:code-embed-v2-q8_0.gguf
|
| 662 |
+
|
| 663 |
+
# Or if pulled from the Ollama registry:
|
| 664 |
+
# ollama pull divakantpandey/code-embed-v2
|
| 665 |
+
|
| 666 |
+
# 2. Generate embeddings via cURL:
|
| 667 |
+
curl http://localhost:11434/api/embed -d '{
|
| 668 |
+
"model": "divakantpandey/code-embed-v2",
|
| 669 |
+
"input": "def binary_search(arr, target):"
|
| 670 |
+
}'
|
| 671 |
+
|
| 672 |
+
# 3. Query via OpenAI-compatible endpoint (/v1/embeddings):
|
| 673 |
+
curl http://localhost:11434/v1/embeddings \
|
| 674 |
+
-H "Content-Type: application/json" \
|
| 675 |
+
-d '{
|
| 676 |
+
"model": "divakantpandey/code-embed-v2",
|
| 677 |
+
"input": "def binary_search(arr, target):"
|
| 678 |
+
}'
|
| 679 |
+
```
|
| 680 |
+
|
| 681 |
+
---
|
| 682 |
+
|
| 683 |
+
### Example 8: High-Performance C++ Inference with `llama.cpp`
|
| 684 |
+
|
| 685 |
+
Use the Q8_0 GGUF quantized weights for standalone C++ embedding generation or an OpenAI-compatible microservice:
|
| 686 |
+
|
| 687 |
+
```bash
|
| 688 |
+
# Download GGUF weights (135MB)
|
| 689 |
+
wget https://huggingface.co/divakantpandey/code-embed-v2/resolve/main/code-embed-v2-q8_0.gguf
|
| 690 |
+
|
| 691 |
+
# Start an OpenAI-compatible embedding server:
|
| 692 |
+
llama-server \
|
| 693 |
+
-m code-embed-v2-q8_0.gguf \
|
| 694 |
+
--embedding \
|
| 695 |
+
-c 8192 \
|
| 696 |
+
--port 8080
|
| 697 |
+
|
| 698 |
+
# Query with standard OpenAI Python SDK:
|
| 699 |
+
from openai import OpenAI
|
| 700 |
+
|
| 701 |
+
client = OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")
|
| 702 |
+
response = client.embeddings.create(
|
| 703 |
+
model="code-embed-v2",
|
| 704 |
+
input="def find_max(nums):"
|
| 705 |
+
)
|
| 706 |
+
print("Vector length:", len(response.data[0].embedding))
|
| 707 |
+
```
|
| 708 |
+
|
| 709 |
+
---
|
| 710 |
+
|
| 711 |
+
### Example 9: Production Serving with Text Embeddings Inference (TEI)
|
| 712 |
+
|
| 713 |
+
For enterprise throughput with dynamic batching and token truncation:
|
| 714 |
+
|
| 715 |
+
```bash
|
| 716 |
+
# Deploy with Hugging Face TEI (Docker)
|
| 717 |
+
docker run --gpus all -p 8080:80 \
|
| 718 |
+
ghcr.io/huggingface/text-embeddings-inference:1.5 \
|
| 719 |
+
--model-id divakantpandey/code-embed-v2
|
| 720 |
+
```
|
| 721 |
+
|
| 722 |
+
---
|
| 723 |
+
|
| 724 |
## 📜 License & Citation
|
| 725 |
|
| 726 |
This project and its model weights are licensed under the **Creative Commons Attribution-NonCommercial 4.0 International License (CC-BY-NC 4.0)**.
|