返回模型
说明文档
这是带有 ONNX 权重的 https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2,以兼容 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-MiniLM-L6-v2
作者 xtlalert
text-classification
transformers.js
↓ 0
♥ 0
创建时间: 2025-04-09 09:04:32+00:00
更新时间: 2025-04-09 09:16:51+00:00
在 Hugging Face 上查看文件 (9)
.gitattributes
README.md
config.json
onnx/model_quantized.onnx
ONNX
quantize_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.txt