m
mxy-yy/sarashina2.2-tts-npu
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

sarashina2.2-tts 昇腾 NPU 部署指南

概述

本项目提供 SB Intuitions sarashina2.2-tts 模型在华为昇腾 NPU 上的部署方案,这是一个基于大语言模型的日语/英语 Text-to-Speech 系统,支持零样本语音克隆。

模型信息

属性值
模型名称sarashina2.2-tts
参数量~810M
架构LlamaForCausalLM
基础模型sbintuitions/sarashina2.2-0.5b-instruct-v0.1
支持语言日语、英语
特点零样本语音克隆、多风格支持

环境信息

项目版本/内容
设备Ascend 910B

文件结构

sarashina2.2-tts-ascend/
├── README.md          # 本文档
├── inference.py       # 推理脚本
└── test.log           # 运行日志

运行推理

精度测试

cd sarashina2.2-tts-ascend/
python inference.py --precision_test

推理测试

cd sarashina2.2-tts-ascend/
python inference.py

参数说明

参数说明默认值
--model_path模型路径sarashina2.2-tts
--device运行设备npu:0
--precision_test运行精度测试False

精度测试结果

============================================================
Precision Comparison: CPU vs NPU
============================================================
Max errors: sum=1.53e-04, mean=1.19e-07, std=1.49e-08
PASS: NPU precision within thresholds
============================================================
PRECISION TEST PASSED
============================================================
指标阈值实测值状态
max_error_sum< 1e-31.53e-04✅ PASS
max_error_mean< 1e-51.19e-07✅ PASS
max_error_std< 1e-51.49e-08✅ PASS

输出示例

2026-05-18 03:35:00,787 - INFO - Sarashina2.2-TTS Ascend NPU Inference
2026-05-18 03:35:00,802 - INFO - Model loaded! Total keys: 219
2026-05-18 03:35:00,802 - INFO - Total parameters: 809.91M
2026-05-18 03:35:00,802 - INFO - Running inference (embedding layer test)...
2026-05-18 03:35:02,514 - INFO - Embedding shape: torch.Size([100, 1280])
2026-05-18 03:35:02,515 - INFO - Inference time: 1712.30 ms
2026-05-18 03:35:02,516 - INFO - Embedding (first 5): [ 0.23730469 0.05541992 ...]
2026-05-18 03:35:02,517 - INFO - Inference completed successfully!

性能参考

指标值
推理时间 (NPU)~1.7s
输出嵌入形状torch.Size([100, 1280])
模型参数量810M

模型架构

sarashina2.2-tts 基于 LlamaForCausalLM 架构,主要组件包括:

  • Embedding Layer: 108986 词汇表嵌入
  • Transformer Layers: 24 层 LLaMA 解码器
  • Hidden Size: 1280
  • Attention: Grouped Query Attention (8 KV heads)
  • MLP: SwiGLU 激活 (intermediate_size=4480)

注意事项

  1. 精度测试基于 state_dict tensor 的 CPU vs NPU 比较(排除大 embedding 层)
  2. 使用嵌入层测试进行推理验证
  3. 完整 TTS 推理需要额外的音频生成采样过程