---
title: SoulX-Singer-onnx-directml-fp16
canonical_url: "https://www.modelscope.cn/models/syxppp/SoulX-Singer-onnx-directml-fp16"
md_url: "https://www.modelscope.cn/models/syxppp/SoulX-Singer-onnx-directml-fp16.md"
repository: syxppp/SoulX-Singer-onnx-directml-fp16
chinese_name: "SoulX-Singer ONNX+Directml Olive-FP16"
last_updated: 2026-10-24
license: "Apache License 2.0"
base_model:
  - syxppp/SoulX-Singer-onnx-directml
base_model_relation: quantized
library_name:
  - onnx
downloads: 3
stars: 0
---

# SoulX-Singer-onnx-directml-fp16

> SoulX-Singer-onnx-directml-fp16 - syxppp 在 ModelScope 开源的模型。The quantized SoulX-Singer onnx version, using Olive for optimization. Ready for client production.

syxppp/SoulX-Singer-onnx-directml-fp16 是 ModelScope 魔搭社区上的机器学习模型，采用 Apache License 2.0 许可，基于 syxppp/SoulX-Singer-onnx-directml 构建。

- **Repository**: syxppp/SoulX-Singer-onnx-directml-fp16
- **License**: Apache License 2.0
- **Base model**: syxppp/SoulX-Singer-onnx-directml
- **Downloads**: 3
- **Stars**: 0
- **Last updated**: 2026-10-24

Source: https://www.modelscope.cn/models/syxppp/SoulX-Singer-onnx-directml-fp16

---

# SoulX-Singer ONNX 模型 (FP16)

> ## ⚠️ 必须立即升级到 v3
>
> **2026-10-24** · 修复 RMVPE 音高检测的致命缺陷
>
> 旧版 `preprocess/rmvpe_model.onnx` 输出是 `(1, T, 360)`，应用却按 `(T, 2560)` 解码：
> `base = t * 2560` 很快越界，`Float32Array` 越界返回 `undefined`，argmax 永远停在索引 0，
> **整条 F0 曲线锁死在 30 Hz**（前 2 秒是错位数据的乱跳）。这是形状契约错误，
> 不是精度问题 —— 旧模型在当前应用里 100% 不可用。
>
> 修复版模型：输入 `audio (1, N)` 动态长度（mel 帧数按 32 对齐），输出 `salience (1, T, 360)`；
> 清音帧由应用按 `max(salience) ≤ 0.03` 判为 0。**新旧模型互不兼容**，
> 新代码会直接抛 `INVALID_MODEL_OUTPUT` 拒绝加载旧模型。
>
> **请立即在应用内「模型管理 → 更新模型」升级到 v3，不要停留在旧版本。**
>
> <sub>English: fixes RMVPE F0 stuck at 30 Hz (output was read as `(T,2560)` instead of
> `(1,T,360)`). The model is now dynamic-length and emits `(1,T,360)` salience. Old and new
> models are mutually incompatible — update immediately via Model Manager.</sub>


FP16（半精度）量化版本的 SoulX-Singer ONNX 模型，权重从 FP32 转换为 FP16，输入输出数据类型也相应变为 Float16。

## 模型信息

- **量化方式**: FP16（Float16 权重 + Float16 输入输出）
- **IR Version**: 10（主模型）/ 8（预处理模型）
- **Producer**: pytorch
- **Opset 版本**:
  - `ai.onnx` 17: note_text_encoder, note_pitch_encoder, note_type_encoder, f0_encoder, cond_emb
  - `ai.onnx` 18: diff_step_dml, vocoder_dml, mel_transform, preflow

## 模型大小对比

### 主模型

| 模型文件 | FP32 大小 | FP16 大小 | 压缩比 | 说明 |
|---------|----------|----------|--------|------|
| `diff_step_dml.onnx` | 1,772 MB | 887 MB | 50.1% | 扩散步骤预测 |
| `vocoder_dml.onnx` | 1,054 MB | 519 MB | 49.3% | 梅尔频谱转波形 |
| `preflow.onnx` | 17.1 MB | 25.6 MB | 149.4% | 预处理流 |
| `note_text_encoder.onnx` | 6.1 MB | 9.2 MB | 150.0% | 文本嵌入 |
| `cond_emb.onnx` | 2.2 MB | 3.2 MB | 148.6% | 条件嵌入 |
| `f0_encoder.onnx` | 740 KB | 1.1 MB | 150.0% | F0 轮廓嵌入 |
| `note_pitch_encoder.onnx` | 525 KB | 787 KB | 150.0% | 音高嵌入 |
| `note_type_encoder.onnx` | 525 KB | 787 KB | 150.0% | 音符类型嵌入 |
| `mel_transform.onnx` | 511 KB | 761 KB | 148.9% | 音频转梅尔频谱 |

> **注意**: 小模型（encoders, preflow, cond_emb）使用外部数据文件（`.onnx.data`），FP16 转换后因权重从 FP32 变为 FP16 但 `.onnx` 文件结构开销增加，导致总大小反而增大。大模型（diff_step_dml, vocoder_dml）权重内嵌在 `.onnx` 文件中，FP16 转换后大小约为 FP32 的 50%。

### 预处理模型

| 模型文件 | FP32 大小 | FP16 大小 | 压缩比 | 说明 |
|---------|----------|----------|--------|------|
| `preprocess/rmvpe_model.onnx` | 362 MB | 181 MB | 50.0% | 音高检测 |
| `preprocess/rosvot_model.onnx` | 54.6 MB | 29.9 MB | 54.7% | MIDI/Note 识别（已修复图结构错误） |
| `preprocess/rmvpe_mel.onnx` | 271 KB | 137 KB | 50.7% | 音频转梅尔频谱 |
| `preprocess/rosvot_mel.onnx` | 88 KB | 46 KB | 52.5% | 音频转梅尔频谱 |

### basic_pitch_model

| 模型文件 | 大小 | 说明 |
|---------|------|------|
| `basic_pitch_model/group1-shard1of1.bin` | 742 KB | 与 FP32 版本相同（TFJS 格式，未量化） |

## 精度对比（FP16 vs FP32）

使用随机输入测试，与 FP32 原始模型对比：

### 主模型

| 模型文件 | 余弦相似度 | 最大绝对误差 | MSE | 精度评价 |
|---------|-----------|------------|-----|---------|
| `note_text_encoder.onnx` | 0.99999988 | 0.001825 | 4e-8 | 优秀 |
| `note_pitch_encoder.onnx` | 1.00000000 | 0.000975 | 4e-8 | 优秀 |
| `note_type_encoder.onnx` | 0.99999988 | 0.000971 | 4e-8 | 优秀 |
| `f0_encoder.onnx` | 0.99999988 | 0.001375 | 4e-8 | 优秀 |
| `cond_emb.onnx` | 0.99999958 | 0.000653 | 2e-8 | 优秀 |
| `mel_transform.onnx` | 1.00000000 | 0.001116 | 3e-7 | 优秀 |
| `preflow.onnx` | 0.99999988 | 0.001513 | 1.4e-7 | 优秀 |
| `diff_step_dml.onnx` | 0.99999988 | 0.000500 | 1e-8 | 优秀 |
| `vocoder_dml.onnx` | 0.99999225 | 0.000103 | ~0 | 优秀 |

### 预处理模型

| 模型文件 | 余弦相似度 | 最大绝对误差 | MSE | 精度评价 |
|---------|-----------|------------|-----|---------|
| `preprocess/rmvpe_mel.onnx` | 0.99999976 | 0.003394 | 3.1e-7 | 优秀 |
| `preprocess/rosvot_mel.onnx` | 0.99999946 | 0.010627 | 5.9e-7 | 优秀 |
| `preprocess/rmvpe_model.onnx` | - | - | - | CPU 推理崩溃（Access Violation） |
| `preprocess/rosvot_model.onnx` | - | - | - | 已修复图结构错误，可正常加载运行 |

## 使用说明

### 输入数据类型

FP16 模型的浮点输入输出均为 **Float16** 类型（非 Float32）。使用时需将输入数据转换为 `float16`：

```python
import onnxruntime as ort
import numpy as np

# 加载 FP16 模型
sess = ort.InferenceSession("onnx_models/fp16/mel_transform.onnx")

# 输入必须为 float16
waveform = np.random.randn(1, 48000).astype(np.float16)

# 推理
outputs = sess.run(None, {"waveform": waveform})
```

### DirectML 推理

FP16 模型在 DirectML（GPU）上推理效率更高：

```python
sess = ort.InferenceSession(
    "onnx_models/fp16/diff_step_dml.onnx",
    providers=['DmlExecutionProvider']
)
```

## 已知问题

1. **rmvpe_model.onnx**: FP16 版本在 CPU 上推理会崩溃（Access Violation），建议使用 DirectML 推理
2. **小模型体积增大**: 使用外部数据的小模型（encoders, preflow, cond_emb）FP16 版本体积反而增大约 50%，因为 `.onnx` 文件结构开销超过了权重节省

## 优化记录

### rosvot_model.onnx 图结构修复

原模型存在 `tensor(bool)` 类型不匹配错误，Squeeze 节点输出 bool 张量被送入不支持 bool 输入的 Add 等算子，导致无法加载。

- **修复方案**: 从修复后的 FP32 模型重新进行 FP16 转换，并修复 ScatterElements 节点的 float16 兼容性问题
- **结果**: FP16 版本可正常加载和推理

## 依赖

- onnxruntime >= 1.17
- onnxruntime-directml >= 1.17（推荐，用于 GPU 加速）
- numpy >= 1.23
