ONNX 模型库
返回模型

说明文档

https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2 的 ONNX 权重,用于兼容 Transformers.js。

使用方法 (Transformers.js)

如果您还没有安装,可以通过 NPM 安装 Transformers.js JavaScript 库:

npm i @xenova/transformers

示例: 使用 Xenova/ms-marco-MiniLM-L-6-v2 进行信息检索。

import { AutoTokenizer, AutoModelForSequenceClassification } from '@xenova/transformers';

const model = await AutoModelForSequenceClassification.from_pretrained('Xenova/ms-marco-MiniLM-L-6-v2');
const tokenizer = await AutoTokenizer.from_pretrained('Xenova/ms-marco-MiniLM-L-6-v2');

const features = tokenizer(
    ['How many people live in Berlin?', 'How many people live in Berlin?'],
    {
        text_pair: [
            'Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.',
            'New York City is famous for the Metropolitan Museum of Art.',
        ],
        padding: true,
        truncation: true,
    }
)

const scores = await model(features)
console.log(scores);
// quantized:   [ 8.663132667541504, -11.245542526245117 ]
// unquantized: [ 8.845855712890625, -11.245561599731445 ]

注意:为 ONNX 权重单独创建仓库是一个临时解决方案,直到 WebML 获得更多关注。如果您想让自己的模型支持 Web 端,我们建议使用 🤗 Optimum 将模型转换为 ONNX 格式,并按照本仓库的结构组织(将 ONNX 权重放在名为 onnx 的子文件夹中)。

xtlalert/ms-marco-onnx-3

作者 xtlalert

text-classification transformers.js
↓ 0 ♥ 0

创建时间: 2025-04-09 10:46:25+00:00

更新时间: 2025-04-09 11:06:18+00:00

在 Hugging Face 上查看

文件 (9)

.gitattributes
README.md
config.json
onnx/model_qint8_avx512_vnni.onnx ONNX
quantize_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.txt