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 pipelineconst extractor = awaitpipeline('feature-extraction', 'Xenova/jina-embeddings-v2-base-zh', {
quantized: false, // Comment out this line to use the quantized version
});
// Compute sentence embeddingsconst texts = ['How is the weather today?', '今天天气怎么样?'];
const output = awaitextractor(texts, { pooling: 'mean', normalize: true });
// Tensor {// dims: [2, 768],// type: 'float32',// data: Float32Array(1536)[...],// size: 1536// }// Compute cosine similarity between the two embeddingsconst score = cos_sim(output[0].data, output[1].data);
console.log(score);
// 0.7860610759096025
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
).
Runs of Xenova jina-embeddings-v2-base-zh on huggingface.co
2.6K
Total runs
0
24-hour runs
403
3-day runs
986
7-day runs
1.4K
30-day runs
More Information About jina-embeddings-v2-base-zh huggingface.co Model
More jina-embeddings-v2-base-zh license Visit here:
jina-embeddings-v2-base-zh huggingface.co is an AI model on huggingface.co that provides jina-embeddings-v2-base-zh's model effect (), which can be used instantly with this Xenova jina-embeddings-v2-base-zh model. huggingface.co supports a free trial of the jina-embeddings-v2-base-zh model, and also provides paid use of the jina-embeddings-v2-base-zh. Support call jina-embeddings-v2-base-zh model through api, including Node.js, Python, http.
jina-embeddings-v2-base-zh huggingface.co is an online trial and call api platform, which integrates jina-embeddings-v2-base-zh's modeling effects, including api services, and provides a free online trial of jina-embeddings-v2-base-zh, you can try jina-embeddings-v2-base-zh online for free by clicking the link below.
Xenova jina-embeddings-v2-base-zh online free url in huggingface.co:
jina-embeddings-v2-base-zh is an open source model from GitHub that offers a free installation service, and any user can find jina-embeddings-v2-base-zh on GitHub to install. At the same time, huggingface.co provides the effect of jina-embeddings-v2-base-zh install, users can directly use jina-embeddings-v2-base-zh installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
jina-embeddings-v2-base-zh install url in huggingface.co: