返回模型
说明文档
AleksanderObuchowski/medembed-small-onnx
这是 abhinand/MedEmbed-small-v0.1 的 ONNX 导出版本,针对 transformers.js 的使用进行了优化。
模型描述
这是一个医学文本嵌入模型,已转换为 ONNX 格式,以便在 Web 浏览器和边缘设备中进行高效推理。它包含常规版本和量化版本,以满足不同的性能需求。
文件
model.onnx- 全精度 ONNX 模型model_quantized.onnx- 量化 ONNX 模型(推荐用于 Web 部署)tokenizer.json- 分词器配置config.json- 模型配置- 其他分词器文件以确保完整兼容性
使用方法
使用 transformers.js
import { pipeline } from '@xenova/transformers';
// 加载模型(量化版本以获得更好的性能)
const extractor = await pipeline('feature-extraction', 'AleksanderObuchowski/medembed-small-onnx', {
quantized: true
});
// 生成嵌入向量
const text = "This patient shows symptoms of diabetes.";
const embeddings = await extractor(text, { pooling: 'mean', normalize: true });
console.log(embeddings);
使用 Python(ONNX Runtime)
import onnxruntime as ort
from transformers import AutoTokenizer
import numpy as np
# 加载分词器和模型
tokenizer = AutoTokenizer.from_pretrained('AleksanderObuchowski/medembed-small-onnx')
session = ort.InferenceSession('model_quantized.onnx')
# 对输入进行分词
text = "This patient shows symptoms of diabetes."
inputs = tokenizer(text, return_tensors="np")
# 运行推理
outputs = session.run(None, dict(inputs))
embeddings = outputs[0]
性能
量化模型提供:
- 减小的文件大小(通常减少 50-75%)
- CPU 上更快的推理速度
- 更低的内存使用
- 在大多数用例中保持准确性
原始模型
该模型基于 abhinand/MedEmbed-small-v0.1,该模型专为医学文本嵌入而设计。
许可证
该模型遵循与原始模型相同的许可证。有关详细信息,请查看原始模型的许可证。
AleksanderObuchowski/medembed-small-onnx
作者 AleksanderObuchowski
feature-extraction
transformers.js
↓ 0
♥ 0
创建时间: 2025-07-30 14:06:17+00:00
更新时间: 2025-07-30 14:12:37+00:00
在 Hugging Face 上查看文件 (13)
.gitattributes
README.md
config.json
model.onnx
ONNX
model_quantized.onnx
ONNX
onnx/model.onnx
ONNX
onnx/model_quantized.onnx
ONNX
onnx/ort_config.json
ort_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.txt