xujiashuai/nlp_gte_sentence-embedding_chinese-large
模型介绍文件和版本Pull Requests讨论分析

nlp_gte_sentence-embedding_chinese-large on Ascend NPU

1. 简介

本文档记录 iic/nlp_gte_sentence-embedding_chinese-large 在昇腾 NPU 上的适配验证结果。

  • 模型来源: iic/nlp_gte_sentence-embedding_chinese-large
  • 模型类型: 中文句子嵌入模型 (Sentence Embedding)
  • 隐藏维度: 1024
  • 最大长度: 512
  • 适配状态: SUCCESS
  • 适配时间: 2026-05-17

2. 验证环境

组件版本
torch2.9.0
torch-npu2.9.0.post1
transformers4.57.6
CANN8.5.1
  • NPU: Ascend 910B4
  • 系统: Ubuntu 22.04.5 LTS (aarch64)

3. 推理脚本

python inference.py --model-path ./models/iic/nlp_gte_sentence-embedding_chinese-large --device npu:0

或使用 evaluate.py 进行完整验证:

python evaluate.py --model-path ./models/iic/nlp_gte_sentence-embedding_chinese-large --output report.json

4. Smoke 验证

功能验证结果:

指标结果
输出形状[3, 1024]
是否有 NaN否
推理状态正常

5. 性能参考

指标数值
平均延迟13.43 ms
峰值显存1.25 GB
测试轮数10

6. 精度评测

NPU vs CPU 精度对比

指标数值
Cosine Similarity0.999997
精度误差-0.0003%
是否满足要求是(< 1%)

7. 评测材料

材料文件说明
推理脚本inference.py独立可运行的 NPU 推理代码
精度评测代码evaluate.pyCPU vs NPU cosine similarity 对比
环境检查env_check.pyNPU 环境验证脚本
运行日志logs/*.log完整执行日志
精度报告report.json结构化评测数据
部署文档DEPLOY.md环境搭建与验证指南
依赖清单requirements.txtPython 依赖

8. Agent Skill

本模型适配由以下 Agent Skill 完成

项目内容
Skill 名称text-embedding-npu-adapt
触发条件文本嵌入/句子表示模型适配到昇腾 NPU
核心能力自动加载、NPU 迁移、FP16 推理、精度验证、性能基准

使用方法

# Step 1: 环境检查
python3 env_check.py

# Step 2: 验证模型
python3 evaluate.py --model-path ./models/iic/nlp_gte_sentence-embedding_chinese-large --output report.json

# Step 3: 运行推理
python3 inference.py --model-path ./models/iic/nlp_gte_sentence-embedding_chinese-large --device npu:0

9. 注意事项

  • 首次运行可能需要从 ModelScope 下载模型权重
  • 建议在 NPU 设备上运行以获得最佳性能
  • 本模型支持中英文句子嵌入,输入长度建议不超过 512 tokens

贡献者: xujiashuai 参赛赛道: 模型适配赛道 提交时间: 2026-05-17

下载使用量0