alt.freeweights.embed / jina-embeddings-v2-base-code
From: jinaai <huggingface.co/jinaai>Newsgroups: alt.freeweights.embedSubject:

jina-embeddings-v2-base-code

Date: 2026-11-14Commit: 516f4baSigned: 2DC28CC7B26A283B ✓

Feature extraction model with 161M parameters. Onnx and safetensors weights, 1.77 GB in all. Published by jinaai under Apache-2.0.

161M params1.77GBjina-embeddings-v2-base-codeonnx safetensorspermissive
FactsParams161MSize1.77 GBFormatsonnx, safetensorsTaskfeature extractionLicenseApache-2.0From sourcepermissive
$ fw get jinaai/jina-embeddings-v2-base-code
# manifest sha256 b37a1163ccc7… · 1.77 GB · 18 files
$ fw verify ./jina-embeddings-v2-base-code jinaai/jina-embeddings-v2-base-code
From sourceHosted (signed)jinaai/jina-embeddings-v2-base-codeLast check: 2026-11-14 21:09 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Evaluate with

Overview

Size
1.77 GB
Weights
322 MB (safetensors)
Parameters
161M
Formats
onnx, safetensors
Task
feature extraction
License
Apache-2.0 (permissive)
Files
18, each with a sha256
Publisher
jinaai
Added
2026-11-14
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:09 UTCpassed

Model card

From the publisher at commit 516f4ba. Shown as plain text with links; images open at the publisher.

Image: Jina AI: Your Search Foundation, Supercharged!

The text embedding set trained by Jina AI.

Quick Start#

The easiest way to starting using jina-embeddings-v2-base-code is to use Jina AI's Embedding API.

Intended Usage & Model Info#

jina-embeddings-v2-base-code is an multilingual embedding model speaks English and 30 widely used programming languages. Same as other jina-embeddings-v2 series, it supports 8192 sequence length.

jina-embeddings-v2-base-code is based on a Bert architecture (JinaBert) that supports the symmetric bidirectional variant of ALiBi to allow longer sequence length. The backbone jina-bert-v2-base-code is pretrained on the github-code dataset. The model is further trained on Jina AI's collection of more than 150 millions of coding question answer and docstring source code pairs. These pairs were obtained from various domains and were carefully selected through a thorough cleaning process.

The embedding model was trained using 512 sequence length, but extrapolates to 8k sequence length (or even longer) thanks to ALiBi. This makes our model useful for a range of use cases, especially when processing long documents is needed, including technical question answering and code search.

This model has 161 million parameters, which enables fast and memory efficient inference, while delivering impressive performance. Additionally, we provide the following embedding models:

**Supported (Programming) Languages

**

  • English
  • Assembly
  • Batchfile
  • C
  • C#
  • C++
  • CMake
  • CSS
  • Dockerfile
  • FORTRAN
  • GO
  • Haskell
  • HTML
  • Java
  • JavaScript
  • Julia
  • Lua
  • Makefile
  • Markdown
  • PHP
  • Perl
  • PowerShell
  • Python
  • Ruby
  • Rust
  • SQL
  • Scala
  • Shell
  • TypeScript
  • TeX
  • Visual Basic

Data & Parameters#

Jina Embeddings V2 technical report

Usage#

**Please apply mean pooling when integrating the model.

**

Why mean pooling?#

mean poooling takes all token embeddings from model output and averaging them at sentence/paragraph level. It has been proved to be the most effective way to produce high-quality sentence embeddings. We offer an encode function to deal with this.

However, if you would like to do it without using the default encode function:

import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel

def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0]
    input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)

sentences = [
    'How do I access the index while iterating over a sequence with a for loop?',
    '# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n    print(idx, x)',
]

tokenizer = AutoTokenizer.from_pretrained('jinaai/jina-embeddings-v2-base-code')
model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-code', trust_remote_code=True)

encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')

with torch.no_grad():
    model_output = model(**encoded_input)

embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
embeddings = F.normalize(embeddings, p=2, dim=1)

You can use Jina Embedding models directly from transformers package:

!pip install transformers
from transformers import AutoModel
from numpy.linalg import norm

cos_sim = lambda a,b: (a @ b.T) / (norm(a)*norm(b))
model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-code', trust_remote_code=True)
embeddings = model.encode(
    [
        'How do I access the index while iterating over a sequence with a for loop?',
        '# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n    print(idx, x)',
    ]
)
print(cos_sim(embeddings[0], embeddings[1]))
>>> tensor([[0.7282]])

If you only want to handle shorter sequence, such as 2k, pass the max_length parameter to the encode function:

embeddings = model.encode(
    ['Very long ... code'],
    max_length=2048
)

Using the its latest release (v2.3.0) sentence-transformers also supports Jina embeddings (Please make sure that you are logged into huggingface as well):

!pip install -U sentence-transformers
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim

model = SentenceTransformer(
    "jinaai/jina-embeddings-v2-base-code",
    trust_remote_code=True
)

# control your input sequence length up to 8192
model.max_seq_length = 1024

embeddings = model.encode([
    'How do I access the index while iterating over a sequence with a for loop?',
    '# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n    print(idx, x)',
])
print(cos_sim(embeddings[0], embeddings[1]))

You can also use the Transformers.js library to compute embeddings in JavaScript.

// npm i @xenova/transformers
import { pipeline, cos_sim } from '@xenova/transformers';

const extractor = await pipeline('feature-extraction', 'jinaai/jina-embeddings-v2-base-code', {
    quantized: false, // Comment out this line to use the 8-bit quantized version
});

const texts = [
    'How do I access the index while iterating over a sequence with a for loop?',
    '# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n    print(idx, x)',
]
const embeddings = await extractor(texts, { pooling: 'mean' });

const score = cos_sim(embeddings[0].data, embeddings[1].data);
console.log(score);
// 0.7281748759529421

Plans#

  1. Bilingual embedding models supporting more European & Asian languages, including Spanish, French, Italian and Japanese.
  2. Multimodal embedding models enable Multimodal RAG applications.
  3. High-performt rerankers.

Contact#

Join our Discord community and chat with other community members about ideas.

Files

18 files · 1.77 GBWeights 322 MB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 18 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
1_Pooling/config.json191 B6401a8eeaeca1f1fe2b1b46be987dcf2ee6085ec73f7d2263318ffc191dd91d3
README.md7.44 KBd3fcc84f4fa0b18b54e54a62171b7bb363109e776226edd02c96e105c097f494
config.json1.22 KBe426aa684c7f9a95c5f020aa855faf93a24f065f5fad0c9e17b124670cabdea6
generation_config.json90 B5d26062fe622c96e8abb50c3ebc4f852afb23058f50fe553df096b0372634962
model.safetensors322 MB8b53bfd4ae2cd586004a6ca4a16551b630a2a1b1d655ff1ee9be1286a1781c5b
modules.json229 B8f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460
onnx/model.onnx642 MB63363fc178428b74620c6f3780cbc7191883fa5c7f84c0945c45eb5c4256733b
onnx/model_fp16.onnx321 MB1aafc4fcd63d2e6899e88402ff731e7c646c2e435048294a3cbc908a40d45d7c
onnx/model_quantized.onnx162 MBed45870251c9f0cf656e78aab0d37a23489066df8a222bb1c8caf8a45f2cb16d
pytorch_model.bin322 MB1c28fb0a8bc930d79b2b29091674a8a0ce0e983489e88b0e863efb1ad4444b01
sentence_bert_config.json99 B7a17ba8cf5532d66e5e102613b7ff22905c2722f6c8c853e6bc02d5ad280cf51
special_tokens_map.json280 B06e405a36dfe4b9604f484f6a1e619af1a7f7d09e34a8555eb0b77b66318067f
tokenizer.json2.56 MBb01c78a902aa4facb2f47f95449f48e2f7bbfea5d2472ee2f6ce92323c6f86e5
tokenizer_config.json493 Bf477aeb15ff9f78d3c1ddf2361d2b0b8b20cf55220f839f29a37f3a18efddd89
train_results.json198 Bf905a0543e46a6f673d2a16364dc783c06357b1444f10431fd4a40e9fd5133c2
trainer_state.json1.22 MBf9df5e2d9945d4e677ce946a897c74149943add6f148017e71ae6ce5265daf79
vocab.json971 KB799ccbde8e1dfeda7cad79a81e5d6dfd4037f118e169185183885ec28119849c
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
516f4baf13 pinned now manifest updated, same commit2026-11-14 21:09 UTC18 files · 1.77 GB
516f4baf132026-11-14 21:09 UTC18 files · 1.77 GB

Use it

$ fw get jinaai/jina-embeddings-v2-base-code
# manifest sha256 b37a1163ccc7… · 1.77 GB · 18 files
$ fw verify ./jina-embeddings-v2-base-code jinaai/jina-embeddings-v2-base-code
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/jinaai/jina-embeddings-v2-base-code.json --dir ./jina-embeddings-v2-base-code $ python3 fw.py verify ./jina-embeddings-v2-base-code ./jinaai__jina-embeddings-v2-base-code.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download jinaai/jina-embeddings-v2-base-code --revision 516f4baf13dec4ddddda8631e019b5737c8bc250 --local-dir ./jina-embeddings-v2-base-code
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("jinaai/jina-embeddings-v2-base-code", revision="516f4baf13dec4ddddda8631e019b5737c8bc250") model = AutoModel.from_pretrained("jinaai/jina-embeddings-v2-base-code", revision="516f4baf13dec4ddddda8631e019b5737c8bc250", device_map="auto")
sentence-transformersEmbed text with sentence-transformers.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from sentence_transformers import SentenceTransformer model = SentenceTransformer("jinaai/jina-embeddings-v2-base-code", revision="516f4baf13dec4ddddda8631e019b5737c8bc250") vectors = model.encode(["Hello"])

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
d3fcc84f4fa0b18b54e54a62171b7bb363109e776226edd02c96e105c097f494
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: jinaai <huggingface.co/jinaai>Newsgroups: alt.freeweights.embedSubject: jina-embeddings-v2-base-codeDate: 2026-11-14Commit: 516f4baSigned: 2DC28CC7B26A283B ✓
Upstream
jinaai/jina-embeddings-v2-base-code
Pinned commit
516f4baf13dec4ddddda8631e019b5737c8bc250
Manifest
jina-embeddings-v2-base-code.json · .minisig
Manifest sha256
b37a1163ccc7368c187967c4e4f03f0950cd1506d24b539b4647aee7ff5defe7
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:09 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/jinaai/jina-embeddings-v2-base-code.json $ curl -O https://freeweights.allternit.com/manifests/jinaai/jina-embeddings-v2-base-code.json.minisig $ minisign -Vm jina-embeddings-v2-base-code.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

1 model in the catalog name this one as their parent.

Quantizations
1
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download jinaai/jina-embeddings-v2-base-code
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. jina-embeddings-v2-base-code.json. Provenance. Takedown history: none.

Variants

1 quantized or adapter build of jina-embeddings-v2-base-code. Each has its own license check and page.

From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens