2502_90647073/jina-embeddings-v5-omni-small
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

jina-embeddings-v5-omni-small

NPU vLLM vLLM-Ascend ModelScope

多模态 Embedding 模型 — 昇腾 NPU 适配版本


📋 模型信息

属性值
模型名称jina-embeddings-v5-omni-small
模型架构Qwen3VL-0.8B (text) + Qwen3_VisionTransformer (vision) + Qwen2.5-Omni AudioEncoder (audio)
任务类型Multi-modal Embedding (text + vision + audio)
权重格式safetensors (single file, ~3.1 GB)
模型大小1124 tensors, ~0.8B parameters
推理框架vLLM 0.18.0 + vLLM-Ascend
NPU 平台Ascend 910B (65 GB HBM)
Python3.11.14
PyTorch2.x + torch_npu
模型来源ModelScope: jinaai/jina-embeddings-v5-omni-small
LicenseMIT

支持任务

任务LoRA Adapter说明
retrievaladapters/retrieval/语义检索
text_matchingadapters/text_matching/文本匹配
clusteringadapters/clustering/文本聚类
classificationadapters/classification/文本分类

🚀 快速开始

1. 环境准备

# 依赖安装
pip install vllm==0.18.0
pip install vllm-ascend
pip install modelscope

2. 下载模型

from modelscope import snapshot_download

model_path = snapshot_download(
    'jinaai/jina-embeddings-v5-omni-small',
    cache_dir='/opt/atomgit/.cache/modelscope',
)
print(f"Model downloaded to: {model_path}")

或使用 CLI:

modelscope download --model jinaai/jina-embeddings-v5-omni-small \
  --local_dir /opt/atomgit/.cache/modelscope/jinaai/jina-embeddings-v5-omni-small

3. 启动 vLLM-Ascend 服务

JINA_V5_TASK=retrieval vllm serve /path/to/jina-embeddings-v5-omni-small \
    --task embedding \
    --trust-remote-code \
    --dtype bfloat16 \
    --max-model-len 32768 \
    --port 8000

4. 调用嵌入

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="EMPTY",
)

# 文本嵌入
resp = client.embeddings.create(
    model="/path/to/jina-embeddings-v5-omni-small",
    input="Your text here",
)
embedding = resp.data[0].embedding
print(f"Dimension: {len(embedding)}")

# 指定任务 (通过 header)
resp = client.embeddings.create(
    model="/path/to/jina-embeddings-v5-omni-small",
    input="Search query",
    extra_headers={"X-Jina-Task": "retrieval"},
)

5. Python 直接调用

from vllm import LLM

llm = LLM(
    model="/path/to/jina-embeddings-v5-omni-small",
    task="embedding",
    trust_remote_code=True,
    dtype="bfloat16",
    max_model_len=32768,
    hf_overrides={"task": "retrieval"},
)
out = llm.embed(["Your text here"])
print(out[0].outputs.embedding[:16])

🏗 模型架构

jina-embeddings-v5-omni-small
  └─ JinaEmbeddingsV5OmniModel (PEFT + LoRA adapter)
       └─ Qwen3VLAudioForEmbedding
            ├─ Qwen3 Language Model  (text backbone)
            ├─ Qwen3VL VisionTransformer (vision encoder)
            └─ Qwen2.5-Omni AudioEncoder (audio encoder)

关键特性:

  • Matryoshka Representation Learning (MRL): 支持多维度嵌入输出
  • PEFT LoRA: 每任务独立 LoRA 适配器,在线合并到基座
  • Trust Remote Code: 模型自带 vllm_jina_v5_omni.py 完整 vLLM 适配,无需额外开发

适配方案

适配维度方案复杂度
vLLM 模型注册trust_remote_code=True 自动触发自注册🟢 零代码
Ascend NPU 后端vLLM-Ascend 原生支持 Qwen3VL🟢 零代码
权重下载ModelScope + 本地路径传入🟢 零代码
LoRA 在线合并模型自带 load_weights 实现🟢 零代码
Matryoshka dims通过 config 自动控制🟢 零代码

📊 精度对比 (NPU vs CPU/GPU)

方法论

指标方法目标
余弦相似度NPU 输出 vs CPU 输出的向量余弦相似度≥ 0.99
最大相对误差NPU 与 CPU 逐元素最大相对误差< 1%
Matryoshka 各维度在每个 MRL 维度分别计算上述指标全部达标

测试数据集

数据类型示例数量
英文文本"The capital of France is Paris"5 对语义近似对 + 5 个独立查询
中文文本"机器学习需要大量数据和计算资源"3 个独立查询
中英混合"AI technology is changing the world 人工智能正改变世界"2 个查询

精度结果

⏳ 精度数据待补充 — 需要 model.safetensors (~3.1 GB) 下载完成后运行 python3 precision_eval.py 生成。

Matryoshka DimCos Sim (NPU vs CPU)Max Rel Error %判定
64⏳ 待测⏳ 待测⏳
128⏳ 待测⏳ 待测⏳
256⏳ 待测⏳ 待测⏳
512⏳ 待测⏳ 待测⏳
1024⏳ 待测⏳ 待测⏳

精度验证脚本:

python3 precision_eval.py
# 输出: precision_results.json

端到端评估框架:

python3 evaluation_framework.py
# 输出: eval_results.json (含精度 + 多任务验证)

⚡ 性能基准

测试环境

组件配置
NPU2 × Ascend 910B (65 GB HBM each)
CPUIntel Xeon Platinum
vLLM0.18.0
vLLM-Ascendlatest
dtypebfloat16
批处理大小1 (动态)
最大序列长度8192

⏳ 性能数据待补充 — 运行 python3 perf_test.py 生成

序列长度QPSAvg Latency (ms)P50 (ms)P95 (ms)
32⏳⏳⏳⏳
64⏳⏳⏳⏳
128⏳⏳⏳⏳
256⏳⏳⏳⏳
512⏳⏳⏳⏳
1024⏳⏳⏳⏳

🔬 适配分析

架构兼容性

检查项状态说明
vLLM 模型注册表✅通过 trust_remote_code 自注册
Ascend FlashAttention✅vLLM-Ascend 通用 backend
Embedding 任务✅vLLM --task embedding 原生支持
多模态 Vision✅Qwen3VL on Ascend 已验证
多模态 Audio⏳需单独验证 audio encoder
PEFT LoRA 合并✅模型自带在线合并逻辑

模型适配结论

适配复杂度: 🟢 零代码改动
模型架构:   Qwen3VLAudioForEmbedding (vLLM)
适配方式:   trust_remote_code 自注册 + 本地 ModelScope 路径
Ascend 运行: vLLM-Ascend 通用后端子图替换 (AscendFlashAttention)
原始来源:   ModelScope (jinaai/jina-embeddings-v5-omni-small)

📁 项目文件

文件说明
README.md本文件
precision_eval.pyNPU vs CPU 精度对比脚本
evaluation_framework.py端到端评估框架
perf_test.py性能基准测试脚本
adaptation-report_jina-embeddings-v5-omni-small.md详细适配分析报告

📚 参考

  • ModelScope: jina-embeddings-v5-omni-small
  • HuggingFace: jinaai/jina-embeddings-v5-omni-small
  • vLLM-Ascend
  • Qwen3VL on Ascend (reference adapter)