weixin_72661020/Erlangshen-RoBERTa-110M-Sentiment
模型介绍文件和版本Pull Requests讨论分析

Fengshenbang/Erlangshen-RoBERTa-110M-Sentiment

1. 简介

本文档记录 Fengshenbang/Erlangshen-RoBERTa-110M-Sentiment 在华为昇腾 Ascend NPU 环境的快速部署与验证结果。

Erlangshen-RoBERTa-110M-Sentiment 是 Fengshenbang 系列的中文情感分析模型,基于 RoBERTa 架构(BertForSequenceClassification),参数量 110M,支持中文文本的正负向情感分类。

  • 模型类型:text-classification(情感分析)
  • 架构:BertForSequenceClassification
  • 参数量:110M
  • 标签:0=Negative, 1=Positive
  • 框架:PyTorch
  • 推理框架:transformers + torch_npu

相关获取地址:

  • 权重下载地址(ModelScope):https://modelscope.cn/models/Fengshenbang/Erlangshen-RoBERTa-110M-Sentiment

2. 验证环境

组件版本
NPUAscend910
PyTorch2.9.0
torch_npu2.9.0
transformers4.20.0
  • NPU:2 逻辑卡
  • 模型路径:/opt/atomgit/Fengshenbang/Erlangshen-RoBERTa-110M-Sentiment/model/Fengshenbang/Erlangshen-RoBERTa-110M-Sentiment

3. 推理启动

由于模型为 BertForSequenceClassification 情感分析模型,不支持 vLLM 推理,直接使用 PyTorch + torch_npu 进行推理。

export ASCEND_RT_VISIBLE_DEVICES=0

python3 inference.py

4. Smoke 验证

执行推理脚本验证:

python3 inference.py

预期输出示例:

=== Sentiment Analysis Results ===
Text: 今天天气真好,心情非常愉快!
Sentiment: Positive (confidence: 0.9923)

Text: 这个产品质量太差了,非常失望。
Sentiment: Negative (confidence: 0.9954)

5. 性能参考

测试条件:20 轮推理,max_length=128。

指标数值
总时间0.325 s
平均推理时间0.0162 s
吞吐量61.55 req/s

6. 精度评测

使用 5 个中文情感分类测试样本进行验证。

指标数值
总用例数5
正确数5
准确率100.0%
精度要求与 GPU/CPU 误差 < 1%

7. 注意事项

  • 模型为 BertForSequenceClassification 架构,不支持 vLLM 部署,需直接使用 transformers 加载
  • 使用 ModelScope SDK 下载模型权重
  • 需安装 torch_npu 以支持 NPU 推理
  • 模型以 PyTorch 格式提供(pytorch_model.bin)
下载使用量0