AI SeedbankHelp preserve open and free AI for humanity's future

← All models

jinaai_jina-embeddings-v2-base-code

jinaai · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


tags:

  • sentence-transformers
  • feature-extraction
  • sentence-similarity
  • mteb
  • transformers
  • transformers.js datasets:
  • allenai/c4 language: en inference: false license: apache-2.0



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.

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:afdae94047abe09bf3c2f6d5dad3ef871f99c916&dn=jinaai_jina-embeddings-v2-base-code

Open magnet in torrent client · infohash afdae94047abe09bf3c2f6d5dad3ef871f99c916

Files & hashes

PathSizesha1sha256
1_Pooling/config.json191 B (191 B)840dd8cf8ae52b1fc266734fa7d25506d2e5159c6401a8eeaeca1f1fe2b1b46be987dcf2ee6085ec73f7d2263318ffc191dd91d3
README.md7.3 KB (7,439 B)add8360ea110377803141c5ee79087e42140ba15d3fcc84f4fa0b18b54e54a62171b7bb363109e776226edd02c96e105c097f494
config.json1.2 KB (1,216 B)645b6ca0ae35f56528641b9c3f4fdde5b3801fbde426aa684c7f9a95c5f020aa855faf93a24f065f5fad0c9e17b124670cabdea6
generation_config.json90 B (90 B)fc9e1bc0fe83f986f985a5e30bd3c5533cb8a0405d26062fe622c96e8abb50c3ebc4f852afb23058f50fe553df096b0372634962
model.safetensors306.9 MB (321,767,312 B)d8ab9a4ec938ba05a2fccc51dc5dfc3fa8741f538b53bfd4ae2cd586004a6ca4a16551b630a2a1b1d655ff1ee9be1286a1781c5b
modules.json229 B (229 B)f7640f94e81bb7f4f04daf1668850b38763a13d98f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460
pytorch_model.bin306.9 MB (321,787,514 B)8cbec406d8a993db2acb50a627572e32a97b31511c28fb0a8bc930d79b2b29091674a8a0ce0e983489e88b0e863efb1ad4444b01
sentence_bert_config.json99 B (99 B)1698ffd71428cea597b9881b038bb159c8a146e57a17ba8cf5532d66e5e102613b7ff22905c2722f6c8c853e6bc02d5ad280cf51
special_tokens_map.json280 B (280 B)d5698132694f4f1bcff08fa7d937b1701812598e06e405a36dfe4b9604f484f6a1e619af1a7f7d09e34a8555eb0b77b66318067f
tokenizer.json2.4 MB (2,561,316 B)64a31466e9fdd5ef043ff0f07b97ee2e256a205eb01c78a902aa4facb2f47f95449f48e2f7bbfea5d2472ee2f6ce92323c6f86e5
tokenizer_config.json493 B (493 B)e42970549d43ea34c4c0f5e459acaa05a1f5cabdf477aeb15ff9f78d3c1ddf2361d2b0b8b20cf55220f839f29a37f3a18efddd89
train_results.json198 B (198 B)f2c1e8a79c122d53baf858143888aeb680ca9410f905a0543e46a6f673d2a16364dc783c06357b1444f10431fd4a40e9fd5133c2
trainer_state.json1.2 MB (1,216,501 B)13c2e0d0a3195f44cb821bff8770a69a57e1d62ff9df5e2d9945d4e677ce946a897c74149943add6f148017e71ae6ce5265daf79
vocab.json947.9 KB (970,639 B)16d9338dbe14f709780b8a2467d5b519b2fad272799ccbde8e1dfeda7cad79a81e5d6dfd4037f118e169185183885ec28119849c

Cite this release

Canonical URL
https://aiseedbank.org/models/jinaai_jina-embeddings-v2-base-code/
Slug
jinaai_jina-embeddings-v2-base-code
Infohash
afdae94047abe09bf3c2f6d5dad3ef871f99c916
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: jinaai_jina-embeddings-v2-base-code.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositoryjinaai/jina-embeddings-v2-base-code
Revision (pinned)516f4baf13dec4ddddda8631e019b5737c8bc250
Fetched at2026-09-04T01:05:57Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T01:06:08Z

apache-2.0618.3 MB (648,313,517 bytes)sentence-transformerspytorchonnxsafetensorsbertfill-maskfeature-extractionsentence-similaritymtebtransformerstransformers.jscustom_codetext-embeddings-inference1 language (en)paper: 2108.12409paper: 2310.19923