https://huggingface.co/jinaai/jina-embeddings-v2-base-de with ONNX weights to be compatible with Transformers.js.

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @xenova/transformers

You can then use the model to compute embeddings, as follows:

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

// Create a feature extraction pipeline
const extractor = await pipeline('feature-extraction', 'Xenova/jina-embeddings-v2-base-de', {
    quantized: false, // Comment out this line to use the quantized version
});

// Compute sentence embeddings
const texts = ['How is the weather today?', 'Wie ist das Wetter heute?'];
const output = await extractor(texts, { pooling: 'mean', normalize: true });
// Tensor {
//   dims: [2, 768],
// 	 type: 'float32',
//   data: Float32Array(1536)[...],
// 	 size: 1536
// }

// Compute cosine similarity between the two embeddings
const score = cos_sim(output[0].data, output[1].data);
console.log(score);
// 0.9602110344414481

Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using ๐Ÿค— Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).

Downloads last month
61
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model authors have turned it off explicitly.

Model tree for Xenova/jina-embeddings-v2-base-de

Quantized
(5)
this model

Spaces using Xenova/jina-embeddings-v2-base-de 2