RvcPyInfer 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. rvcpyinfer-0.1.4/.github/workflows/pr-check.yml +37 -0
  2. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/.github/workflows/release.yml +2 -2
  3. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/PKG-INFO +30 -33
  4. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/README.md +26 -32
  5. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/pyproject.toml +5 -1
  6. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/__init__.py +5 -3
  7. rvcpyinfer-0.1.4/src/RvcPyInfer/_version.py +1 -0
  8. rvcpyinfer-0.1.4/src/RvcPyInfer/onnx/model/Optimizer.py +77 -0
  9. {rvcpyinfer-0.1.3/src/RvcPyInfer/onnx/export → rvcpyinfer-0.1.4/src/RvcPyInfer/onnx/model}/cli.py +49 -0
  10. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/uv.lock +124 -1
  11. rvcpyinfer-0.1.3/src/RvcPyInfer/_version.py +0 -1
  12. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/.gitignore +0 -0
  13. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/.python-version +0 -0
  14. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/license +0 -0
  15. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/InferProviders.py +0 -0
  16. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/InferTask.py +0 -0
  17. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/RvcContext.py +0 -0
  18. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/__main__.py +0 -0
  19. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/audio/audio_utils.py +0 -0
  20. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/cli.py +0 -0
  21. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/error/InferEnvError.py +0 -0
  22. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/error/NotSupportedAlgorithmError.py +0 -0
  23. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/f0_utils.py +0 -0
  24. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/index/RvcFeatIndex.py +0 -0
  25. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/infer_env.py +0 -0
  26. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/onnx/ContentVec.py +0 -0
  27. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/onnx/ModelSimplePool.py +0 -0
  28. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/onnx/RvcGen.py +0 -0
  29. {rvcpyinfer-0.1.3/src/RvcPyInfer/onnx/export → rvcpyinfer-0.1.4/src/RvcPyInfer/onnx/model}/Exporter.py +0 -0
  30. {rvcpyinfer-0.1.3/src/RvcPyInfer/onnx/export → rvcpyinfer-0.1.4/src/RvcPyInfer/onnx/model}/direct_read_sr.py +0 -0
  31. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/onnx/model_loader.py +0 -0
  32. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/ov/OVCoreSingleton.py +0 -0
  33. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/path_utils.py +0 -0
  34. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/resource/template/export_onnx.py +0 -0
  35. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/type_alist.py +0 -0
  36. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/warn/InferEnvWarn.py +0 -0
  37. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/warn/InferModelWarn.py +0 -0
  38. {rvcpyinfer-0.1.3 → rvcpyinfer-0.1.4}/src/RvcPyInfer/warn/InferWarn.py +0 -0
@@ -0,0 +1,37 @@
1
+ name: PR Check
2
+ run-name: "PR #${{ github.event.pull_request.number }} by @${{ github.actor }} - ${{ github.event.pull_request.title }}"
3
+
4
+ on:
5
+ pull_request:
6
+ types:
7
+ - opened
8
+ - synchronize
9
+ - reopened
10
+ branches:
11
+ - main
12
+ - dev
13
+ - 'release/*'
14
+ paths-ignore:
15
+ - '**.md'
16
+ - 'docs/**'
17
+
18
+ jobs:
19
+ check:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v6
24
+
25
+ - name: Setup uv
26
+ uses: astral-sh/setup-uv@v8.3.2
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Install dependencies
31
+ run: uv sync --extra dev --frozen
32
+
33
+ - name: Run ruff lint
34
+ run: uv run ruff check
35
+
36
+ - name: Run pyright type check
37
+ run: uv run pyright
@@ -3,7 +3,7 @@ name: Release
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - "v*.*.*"
6
+ - "v*"
7
7
 
8
8
  jobs:
9
9
  check:
@@ -18,7 +18,7 @@ jobs:
18
18
  enable-cache: true
19
19
 
20
20
  - name: Install dependencies
21
- run: uv sync --extra dev
21
+ run: uv sync --extra dev --frozen
22
22
 
23
23
  - name: Run ruff lint
24
24
  run: uv run ruff check
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RvcPyInfer
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Rvc 的 ONNX 模型导出格式推理实现
5
5
  Project-URL: Homepage, https://github.com/TwoCreepers/RvcPyInfer
6
6
  Project-URL: Repository, https://github.com/TwoCreepers/RvcPyInfer
@@ -24,13 +24,17 @@ Provides-Extra: index
24
24
  Requires-Dist: faiss-cpu>=1.14.3; extra == 'index'
25
25
  Provides-Extra: openvino
26
26
  Requires-Dist: openvino>=2026.2.1; extra == 'openvino'
27
+ Provides-Extra: optimize
28
+ Requires-Dist: onnx>=1.22.0; extra == 'optimize'
29
+ Requires-Dist: onnxsim>=0.6.5; extra == 'optimize'
27
30
  Description-Content-Type: text/markdown
28
31
 
29
32
  # [RvcPyInfer](https://github.com/TwoCreepers/RvcPyInfer)
30
33
 
31
34
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://mit-license.org/)
32
35
  [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
33
- ![ONNX](https://img.shields.io/badge/ONNX-supported-blue)
36
+ ![PyPI Version](https://img.shields.io/pypi/v/RvcPyInfer)
37
+ ![ONNX](https://img.shields.io/badge/ONNX-supported-blue)
34
38
 
35
39
  [RVC](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) 的 ONNX 模型导出格式推理实现。
36
40
 
@@ -44,32 +48,16 @@ Description-Content-Type: text/markdown
44
48
  ~~并且推理真的很难测试欸。~~
45
49
 
46
50
  ## 安装
47
- 本库尚未上传至 [PyPI](https://pypi.org) ,我们还在筹备这方面的工作。
48
- 你可以直接 clone 该仓库然后使用如下命令构建 `.whl` 文件。
51
+ 本库已上传至 [PyPI](https://pypi.org/project/RvcPyInfer/),你可以直接使用我们构建好的轮子。
52
+ `pip` 安装示例:
49
53
  ```shell
50
- # 克隆该仓库
51
- git clone https://github.com/TwoCreepers/RvcPyInfer.git
52
- # 进入该仓库目录
53
- cd RvcPyInfer
54
- # 使用 uv 构建
55
- uv build
56
- # 安装生成的 wheel 包 (以实际文件名为准)
57
- pip install ./dist/rvcpyinfer-0.1.0-py3-none-any.whl
54
+ pip install RvcPyInfer[cpu]
58
55
  ```
59
- 不出意外的话,现在你需要的轮子文件应该出现在 `dist/` 下面了。
60
- 这里出现的 [`uv`](https://github.com/astral-sh/uv) 是一个使用 `Rust` 编写的 `Python` 项目管理工具。
61
- 它可以为你剩下非常多在依赖管理方面的麻烦,就比如上面的 `uv build` 它会自动为你生成虚拟环境并安装好依赖。
62
- 当然了, [`uv`](https://github.com/astral-sh/uv) 不是必须的,我们使用 [`hatchling`](https://pypi.org/project/hatchling) 作为构建后端,你可以自己研究一下如何构建。
63
-
64
- 或者你也可以直接把当前项目作为库安装,例如:
56
+ 使用 `uv` 添加到项目依赖示例:
65
57
  ```shell
66
- # 假设你已经在仓库目录里了
67
- pip install .
68
- # 如果需要安装 CPU 引擎和特征索引支持的话是
69
- pip install ".[cpu,index]"
58
+ uv add RvcPyInfer[cpu]
70
59
  ```
71
60
 
72
-
73
61
  ## 关于特征模型
74
62
  你可以在[这里](https://huggingface.co/NaruseMioShirakana/MoeSS-SUBModel/tree/main)找到 `MoeSS` 使用的 `onnx` 特征模型。它们是通用的。
75
63
  **通常情况下最常见的 `v2` 版本的生成器模型使用的是 `vec-768-layer-12.onnx`**
@@ -77,10 +65,9 @@ pip install ".[cpu,index]"
77
65
  ## 关于推理引擎
78
66
  你可能已经看到了那个未安装任何推理引擎的警告或者错误。
79
67
  请在安装命令后面添加 `[xxx]` 来安装可选依赖。
80
- 例如:
68
+ 例如:
81
69
  ```shell
82
- # 假设你已经在 dist/ 目录下构建好了 whl 文件
83
- pip install "./dist/rvcpyinfer-0.1.0-py3-none-any[cpu]"
70
+ pip install RvcPyInfer[dml]
84
71
  ```
85
72
  目前我们支持以下推理引擎:
86
73
 
@@ -97,6 +84,10 @@ pip install "./dist/rvcpyinfer-0.1.0-py3-none-any[cpu]"
97
84
  ## 关于特征索引
98
85
  原项目的 `.index` 文件可直接使用,无需转换。
99
86
  但你需要使用 `[index]` 来安装我们需要用于读取特征索引的依赖—— `faiss`。
87
+ 例如同时安装特征索引支持和 `CPU`:
88
+ ```shell
89
+ pip install RvcPyInfer[cpu,index]
90
+ ```
100
91
 
101
92
  ## 快速使用
102
93
  一个简单的示例:
@@ -123,30 +114,36 @@ task.run_and_save(
123
114
  我们已经预制了一些 `CLI` 在库中了,并随库一并打包。
124
115
  以下是库内置的命令:
125
116
  - `rvc-infer`:用以快速推理模型而无需编写代码
126
- - `rvc-model`:与原项目模型相关的命令
117
+ - `rvc-model`:与模型相关的命令
127
118
 
128
119
  ### rvc-infer
129
120
  最简格式: `rvc-infer --vec-model <你的特征模型路径> --gen-model <你的生成器模型路径> --gen-model-sr <你的生成器模型的输出采样率> -i <输入音频文件路径> -o <输出音频文件路径>`
130
121
  **Tips:可出现多个 -i 和 -o,只要它们的数量一致,多个 -i 和 -o 按出现顺序一一对应。**
131
122
 
132
123
  ### rvc-model
133
- 该命令用于查看原项目的 `.pth` 模型的生成采样率,以及在 `Windows` 上快速导出 onnx 模型。
124
+ 该命令用于查看原项目的 `.pth` 模型的生成采样率,和在 `Windows` 上快速导出 onnx 模型,以及优化导出的 onnx 模型。
134
125
 
135
126
  #### rvc-model show-sr
136
- 格式: `rvc-model show-sr -m <你的pth模型路径>`
127
+ 安全地查看原项目的 `.pth` 模型的采样率
128
+ 格式: `rvc-model show-sr -m <你的pth模型路径>`
137
129
 
138
130
  #### rvc-model export
139
- **⚠️注意:你必须安装源项目的整合包或至少有一个能运行源项目的环境以便 `PyTorch` 导出 `.onnx` 模型。**
131
+ 导出 ONNX 模型
132
+ **⚠️注意:你必须安装原项目的整合包或至少有一个能运行原项目的环境以便 `PyTorch` 导出 `.onnx` 模型。**
140
133
  它并不依赖项目内置的 `tools/export_onnx.py` 我们有自己的方法。
141
134
  ~~事实上原项目的 export_onnx.py 甚至没有做 v2 版本的支持~~
142
135
  格式: `rvc-model export -m <你的pth模型路径> -t <你希望输出到哪> -r <rvc 原项目的根路径> --runtime <可选的导出用的 python 解释器路径,默认使用 rvc 原项目整合包自带的解释器>`
143
136
 
137
+ #### rvc-model optimize
138
+ 优化导出的 ONNX 模型
139
+ **⚠️注意:你必须安装 [optimize] 可选依赖,否则该子命令将不会出现在 `-h` 输出上**
140
+ 格式: `rvc-model optimize -m <你的pth模型路径> -t <你希望输出到哪>`
141
+
144
142
  ## 未来的计划
145
- - [ ] Github Action 可重现性构建流水线
146
- - [ ] 发布至 PyPI
143
+ 暂无,欢迎各位提出 issue
147
144
 
148
145
  ## 许可证
149
- 在文件头部或文件所在目录未有额外说明的情况下,本项目代码部分使用 [`MIT`](https://mit-license.org/) 许可证授权与你,非代码部分使用 `CC BY 4.0` 授权与你。
146
+ 在文件头部或文件所在目录未有额外说明的情况下,本项目代码部分使用 [`MIT`](https://mit-license.org/) 许可证授权于你,非代码部分使用 `CC BY 4.0` 授权于你。
150
147
 
151
148
  ## 🎉鸣谢
152
149
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://mit-license.org/)
4
4
  [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
5
- ![ONNX](https://img.shields.io/badge/ONNX-supported-blue)
5
+ ![PyPI Version](https://img.shields.io/pypi/v/RvcPyInfer)
6
+ ![ONNX](https://img.shields.io/badge/ONNX-supported-blue)
6
7
 
7
8
  [RVC](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) 的 ONNX 模型导出格式推理实现。
8
9
 
@@ -16,32 +17,16 @@
16
17
  ~~并且推理真的很难测试欸。~~
17
18
 
18
19
  ## 安装
19
- 本库尚未上传至 [PyPI](https://pypi.org) ,我们还在筹备这方面的工作。
20
- 你可以直接 clone 该仓库然后使用如下命令构建 `.whl` 文件。
20
+ 本库已上传至 [PyPI](https://pypi.org/project/RvcPyInfer/),你可以直接使用我们构建好的轮子。
21
+ `pip` 安装示例:
21
22
  ```shell
22
- # 克隆该仓库
23
- git clone https://github.com/TwoCreepers/RvcPyInfer.git
24
- # 进入该仓库目录
25
- cd RvcPyInfer
26
- # 使用 uv 构建
27
- uv build
28
- # 安装生成的 wheel 包 (以实际文件名为准)
29
- pip install ./dist/rvcpyinfer-0.1.0-py3-none-any.whl
23
+ pip install RvcPyInfer[cpu]
30
24
  ```
31
- 不出意外的话,现在你需要的轮子文件应该出现在 `dist/` 下面了。
32
- 这里出现的 [`uv`](https://github.com/astral-sh/uv) 是一个使用 `Rust` 编写的 `Python` 项目管理工具。
33
- 它可以为你剩下非常多在依赖管理方面的麻烦,就比如上面的 `uv build` 它会自动为你生成虚拟环境并安装好依赖。
34
- 当然了, [`uv`](https://github.com/astral-sh/uv) 不是必须的,我们使用 [`hatchling`](https://pypi.org/project/hatchling) 作为构建后端,你可以自己研究一下如何构建。
35
-
36
- 或者你也可以直接把当前项目作为库安装,例如:
25
+ 使用 `uv` 添加到项目依赖示例:
37
26
  ```shell
38
- # 假设你已经在仓库目录里了
39
- pip install .
40
- # 如果需要安装 CPU 引擎和特征索引支持的话是
41
- pip install ".[cpu,index]"
27
+ uv add RvcPyInfer[cpu]
42
28
  ```
43
29
 
44
-
45
30
  ## 关于特征模型
46
31
  你可以在[这里](https://huggingface.co/NaruseMioShirakana/MoeSS-SUBModel/tree/main)找到 `MoeSS` 使用的 `onnx` 特征模型。它们是通用的。
47
32
  **通常情况下最常见的 `v2` 版本的生成器模型使用的是 `vec-768-layer-12.onnx`**
@@ -49,10 +34,9 @@ pip install ".[cpu,index]"
49
34
  ## 关于推理引擎
50
35
  你可能已经看到了那个未安装任何推理引擎的警告或者错误。
51
36
  请在安装命令后面添加 `[xxx]` 来安装可选依赖。
52
- 例如:
37
+ 例如:
53
38
  ```shell
54
- # 假设你已经在 dist/ 目录下构建好了 whl 文件
55
- pip install "./dist/rvcpyinfer-0.1.0-py3-none-any[cpu]"
39
+ pip install RvcPyInfer[dml]
56
40
  ```
57
41
  目前我们支持以下推理引擎:
58
42
 
@@ -69,6 +53,10 @@ pip install "./dist/rvcpyinfer-0.1.0-py3-none-any[cpu]"
69
53
  ## 关于特征索引
70
54
  原项目的 `.index` 文件可直接使用,无需转换。
71
55
  但你需要使用 `[index]` 来安装我们需要用于读取特征索引的依赖—— `faiss`。
56
+ 例如同时安装特征索引支持和 `CPU`:
57
+ ```shell
58
+ pip install RvcPyInfer[cpu,index]
59
+ ```
72
60
 
73
61
  ## 快速使用
74
62
  一个简单的示例:
@@ -95,30 +83,36 @@ task.run_and_save(
95
83
  我们已经预制了一些 `CLI` 在库中了,并随库一并打包。
96
84
  以下是库内置的命令:
97
85
  - `rvc-infer`:用以快速推理模型而无需编写代码
98
- - `rvc-model`:与原项目模型相关的命令
86
+ - `rvc-model`:与模型相关的命令
99
87
 
100
88
  ### rvc-infer
101
89
  最简格式: `rvc-infer --vec-model <你的特征模型路径> --gen-model <你的生成器模型路径> --gen-model-sr <你的生成器模型的输出采样率> -i <输入音频文件路径> -o <输出音频文件路径>`
102
90
  **Tips:可出现多个 -i 和 -o,只要它们的数量一致,多个 -i 和 -o 按出现顺序一一对应。**
103
91
 
104
92
  ### rvc-model
105
- 该命令用于查看原项目的 `.pth` 模型的生成采样率,以及在 `Windows` 上快速导出 onnx 模型。
93
+ 该命令用于查看原项目的 `.pth` 模型的生成采样率,和在 `Windows` 上快速导出 onnx 模型,以及优化导出的 onnx 模型。
106
94
 
107
95
  #### rvc-model show-sr
108
- 格式: `rvc-model show-sr -m <你的pth模型路径>`
96
+ 安全地查看原项目的 `.pth` 模型的采样率
97
+ 格式: `rvc-model show-sr -m <你的pth模型路径>`
109
98
 
110
99
  #### rvc-model export
111
- **⚠️注意:你必须安装源项目的整合包或至少有一个能运行源项目的环境以便 `PyTorch` 导出 `.onnx` 模型。**
100
+ 导出 ONNX 模型
101
+ **⚠️注意:你必须安装原项目的整合包或至少有一个能运行原项目的环境以便 `PyTorch` 导出 `.onnx` 模型。**
112
102
  它并不依赖项目内置的 `tools/export_onnx.py` 我们有自己的方法。
113
103
  ~~事实上原项目的 export_onnx.py 甚至没有做 v2 版本的支持~~
114
104
  格式: `rvc-model export -m <你的pth模型路径> -t <你希望输出到哪> -r <rvc 原项目的根路径> --runtime <可选的导出用的 python 解释器路径,默认使用 rvc 原项目整合包自带的解释器>`
115
105
 
106
+ #### rvc-model optimize
107
+ 优化导出的 ONNX 模型
108
+ **⚠️注意:你必须安装 [optimize] 可选依赖,否则该子命令将不会出现在 `-h` 输出上**
109
+ 格式: `rvc-model optimize -m <你的pth模型路径> -t <你希望输出到哪>`
110
+
116
111
  ## 未来的计划
117
- - [ ] Github Action 可重现性构建流水线
118
- - [ ] 发布至 PyPI
112
+ 暂无,欢迎各位提出 issue
119
113
 
120
114
  ## 许可证
121
- 在文件头部或文件所在目录未有额外说明的情况下,本项目代码部分使用 [`MIT`](https://mit-license.org/) 许可证授权与你,非代码部分使用 `CC BY 4.0` 授权与你。
115
+ 在文件头部或文件所在目录未有额外说明的情况下,本项目代码部分使用 [`MIT`](https://mit-license.org/) 许可证授权于你,非代码部分使用 `CC BY 4.0` 授权于你。
122
116
 
123
117
  ## 🎉鸣谢
124
118
 
@@ -37,7 +37,7 @@ Homepage = "https://github.com/TwoCreepers/RvcPyInfer"
37
37
  Repository = "https://github.com/TwoCreepers/RvcPyInfer"
38
38
 
39
39
  [project.scripts]
40
- rvc-model = "RvcPyInfer.onnx.export.cli:main"
40
+ rvc-model = "RvcPyInfer.onnx.model.cli:main"
41
41
  rvc-infer = "RvcPyInfer.__main__:infer_main"
42
42
 
43
43
  # 构建系统
@@ -66,6 +66,10 @@ dev = [
66
66
  "pyright>=1.1.411",
67
67
  "ruff>=0.15.21",
68
68
  ]
69
+ optimize = [
70
+ "onnx>=1.22.0",
71
+ "onnxsim>=0.6.5",
72
+ ]
69
73
 
70
74
  [tool.uv]
71
75
  conflicts = [ # 这几个是互斥的,防止 uv 傻乎乎地全装上了
@@ -7,9 +7,10 @@ from .error.NotSupportedAlgorithmError import NotSupportedAlgorithmError
7
7
  from .InferProviders import InferProviders
8
8
  from .InferTask import InferTask
9
9
  from .onnx.ContentVec import ContentVec
10
- from .onnx.export import Exporter as OnnxExporter
11
- from .onnx.export.cli import main as ModelExportToolCLI
12
- from .onnx.export.direct_read_sr import direct_read_sr
10
+ from .onnx.model.cli import main as ModelExportToolCLI
11
+ from .onnx.model.direct_read_sr import direct_read_sr
12
+ from .onnx.model.Exporter import Exporter as OnnxExporter
13
+ from .onnx.model.Optimizer import Optimizer as OnnxOptimizer
13
14
  from .onnx.ModelSimplePool import ModelSimplePool
14
15
  from .onnx.RvcGen import RvcGen
15
16
  from .RvcContext import RvcContext
@@ -33,6 +34,7 @@ __all__ = [
33
34
  "RvcContext",
34
35
  "InferTask",
35
36
  "OnnxExporter",
37
+ "OnnxOptimizer",
36
38
  "direct_read_sr",
37
39
  "ModelExportToolCLI",
38
40
  "ContentVec",
@@ -0,0 +1 @@
1
+ __version__ = "0.1.4"
@@ -0,0 +1,77 @@
1
+ from collections import Counter
2
+
3
+ from ...type_alist import PathLike
4
+
5
+
6
+ class Optimizer:
7
+ def __init__(self, model: PathLike) -> None:
8
+ import onnx # pyright: ignore[reportMissingImports]
9
+ self.model = onnx.load_model(model)
10
+
11
+ def simplify(self, output: PathLike, is_static_batch: bool = True, is_print_result: bool = True) -> None:
12
+ orig_total, orig_types = self.get_node_stats(self.model)
13
+
14
+ if is_static_batch:
15
+ for inp in self.model.graph.input:
16
+ tensor_type = inp.type.tensor_type
17
+ if tensor_type.shape.dim[0].dim_param:
18
+ tensor_type.shape.dim[0].dim_value = 1
19
+
20
+ # 不得已直接调用 C 导出,它的 python 包装内部没有处理我还有可能保留一点动态维度的情况
21
+ model_bytes = self.model.SerializeToString()
22
+ skip_constant_folding = False # 我不管了
23
+ skip_shape_inference = False
24
+ import onnxsim.onnxsim_cpp2py_export as C # pyright: ignore[reportMissingImports]
25
+ model_opt_bytes = C.simplify(
26
+ model_bytes,
27
+ [],
28
+ not skip_constant_folding,
29
+ not skip_shape_inference,
30
+ 1024 * 1024 * 1024, # 这边导出的模型基本就 100M,随便写写了
31
+ )
32
+ import onnx # pyright: ignore[reportMissingImports]
33
+ model_simp = onnx.load_from_string(model_opt_bytes)
34
+ onnx.save_model(model_simp, output)
35
+ print(f"模型已保存至: {output}")
36
+
37
+ simp_total, simp_types = self.get_node_stats(model_simp)
38
+
39
+ if is_print_result:
40
+ self.print_result(orig_total, orig_types, simp_total, simp_types)
41
+
42
+ @staticmethod
43
+ def get_node_stats(model):
44
+ """获取模型的总算子数和按类型分类的算子数"""
45
+ total_nodes = len(model.graph.node)
46
+ # 统计每种算子类型的出现次数
47
+ node_types = [node.op_type for node in model.graph.node]
48
+ type_counts = Counter(node_types)
49
+ return total_nodes, type_counts
50
+
51
+ @staticmethod
52
+ def print_result(orig_total, orig_types, simp_total, simp_types):
53
+ diff = orig_total - simp_total
54
+ print("="*40)
55
+ print(f"减少了 {diff} 个算子,约占原始模型的 {diff / orig_total * 100.0:.1f} %")
56
+ print("="*40)
57
+
58
+ print("\n--- 算子类型变化明细 ---")
59
+ all_types = set(list(orig_types.keys()) + list(simp_types.keys()))
60
+
61
+ # 按减少的数量降序排列
62
+ type_diffs = []
63
+ for t in all_types:
64
+ orig_count = orig_types.get(t, 0)
65
+ simp_count = simp_types.get(t, 0)
66
+ if orig_count != simp_count:
67
+ type_diffs.append((t, orig_count, simp_count, orig_count - simp_count))
68
+
69
+ # 排序:减少最多的排在前面
70
+ type_diffs.sort(key=lambda x: x[3], reverse=True)
71
+
72
+ print(f"{'算子类型':<25} | {'优化前':>6} | {'优化后':>6} | {'变化量':>6}")
73
+ print("-" * 55)
74
+ for t, o, s, d in type_diffs:
75
+ # d>0 表示算子减少,d<0 表示算子增加
76
+ sign = "↓" if d > 0 else "↑"
77
+ print(f"{t:<25} | {o:>6} | {s:>6} | {sign} {abs(d):>4}")
@@ -61,6 +61,37 @@ def show_sr_command(args) -> None:
61
61
  sr = direct_read_sr(model_path)
62
62
  print(f"模型采样率是: {sr}")
63
63
 
64
+ def optimize_command(args) -> None:
65
+ """处理 optimize 子命令的具体逻辑"""
66
+ model_path = Path(args.model).resolve()
67
+ target_path = Path(args.target).resolve()
68
+ is_static_batch = not args.disable_static_batch
69
+ is_print_result = not args.disable_print_result
70
+
71
+ if not model_path.is_file():
72
+ print(f"[错误] 找不到模型文件: {model_path}")
73
+ sys.exit(1)
74
+
75
+ # 确保输出目录存在
76
+ if not target_path.parent.exists():
77
+ print(f"[提示] 创建输出目录: {target_path.parent}")
78
+ target_path.parent.mkdir(parents=True, exist_ok=True)
79
+
80
+ try:
81
+ from .Optimizer import Optimizer
82
+ optimizer = Optimizer(model_path)
83
+ optimizer.simplify(target_path, is_static_batch, is_print_result)
84
+ except ImportError as e:
85
+ print(f"\n[错误] 这可能是因为你未安装 [optimize] 可选依赖: {e}")
86
+ import traceback
87
+ traceback.print_exc()
88
+ sys.exit(1)
89
+ except Exception as e:
90
+ print(f"\n[错误] 导出过程中发生未预期的异常: {e}")
91
+ import traceback
92
+ traceback.print_exc()
93
+ sys.exit(1)
94
+
64
95
  def main() -> None:
65
96
  # 主解析器
66
97
  parser = argparse.ArgumentParser(
@@ -94,6 +125,24 @@ def main() -> None:
94
125
  show_sr_parser.add_argument("-m", "--model", type=str, required=True, help="输入的 RVC 模型路径")
95
126
  show_sr_parser.set_defaults(func=show_sr_command)
96
127
 
128
+ # 按需注册 optimize 子命令
129
+ try:
130
+ import onnx # pyright: ignore[reportMissingImports,reportUnusedImport] # noqa: F401
131
+ from onnxsim import simplify # pyright: ignore[reportMissingImports,reportUnusedImport] # noqa: F401
132
+
133
+ optimize_parser = subparsers.add_parser(
134
+ "optimize",
135
+ help="优化 ONNX 模型",
136
+ description="通过固定批大小、常量折叠、算子融合等方式减少算子数量,提高运行效率"
137
+ )
138
+ optimize_parser.add_argument("-m", "--model", type=str, required=True, help="输入的 ONNX 模型路径")
139
+ optimize_parser.add_argument("-t", "--target", type=str, required=True, help="简化的 ONNX 模型目标路径")
140
+ optimize_parser.add_argument("-dsb", "--disable-static-batch", action="store_true", required=False, help="是否禁用静态批大小优化")
141
+ optimize_parser.add_argument("-dpr", "--disable-print-result", action="store_true", required=False, help="是否禁用打印优化结果")
142
+ optimize_parser.set_defaults(func=optimize_command)
143
+ except ImportError:
144
+ ...
145
+
97
146
  # 解析参数
98
147
  args = parser.parse_args()
99
148
 
@@ -111,6 +111,58 @@ wheels = [
111
111
  { url = "https://files.pythonhosted.org/packages/e8/2d/d2a548598be01649e2d46231d151a6c56d10b964d94043a335ae56ea2d92/flatbuffers-25.12.19-py2.py3-none-any.whl", hash = "sha256:7634f50c427838bb021c2d66a3d1168e9d199b0607e6329399f04846d42e20b4", size = 26661, upload-time = "2025-12-19T23:16:13.622Z" },
112
112
  ]
113
113
 
114
+ [[package]]
115
+ name = "markdown-it-py"
116
+ version = "4.2.0"
117
+ source = { registry = "https://pypi.org/simple" }
118
+ dependencies = [
119
+ { name = "mdurl" },
120
+ ]
121
+ sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" }
122
+ wheels = [
123
+ { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" },
124
+ ]
125
+
126
+ [[package]]
127
+ name = "mdurl"
128
+ version = "0.1.2"
129
+ source = { registry = "https://pypi.org/simple" }
130
+ sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" }
131
+ wheels = [
132
+ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" },
133
+ ]
134
+
135
+ [[package]]
136
+ name = "ml-dtypes"
137
+ version = "0.5.4"
138
+ source = { registry = "https://pypi.org/simple" }
139
+ dependencies = [
140
+ { name = "numpy" },
141
+ ]
142
+ sdist = { url = "https://files.pythonhosted.org/packages/0e/4a/c27b42ed9b1c7d13d9ba8b6905dece787d6259152f2309338aed29b2447b/ml_dtypes-0.5.4.tar.gz", hash = "sha256:8ab06a50fb9bf9666dd0fe5dfb4676fa2b0ac0f31ecff72a6c3af8e22c063453", size = 692314, upload-time = "2025-11-17T22:32:31.031Z" }
143
+ wheels = [
144
+ { url = "https://files.pythonhosted.org/packages/d9/a1/4008f14bbc616cfb1ac5b39ea485f9c63031c4634ab3f4cf72e7541f816a/ml_dtypes-0.5.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8c760d85a2f82e2bed75867079188c9d18dae2ee77c25a54d60e9cc79be1bc48", size = 676888, upload-time = "2025-11-17T22:31:56.907Z" },
145
+ { url = "https://files.pythonhosted.org/packages/d3/b7/dff378afc2b0d5a7d6cd9d3209b60474d9819d1189d347521e1688a60a53/ml_dtypes-0.5.4-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce756d3a10d0c4067172804c9cc276ba9cc0ff47af9078ad439b075d1abdc29b", size = 5036993, upload-time = "2025-11-17T22:31:58.497Z" },
146
+ { url = "https://files.pythonhosted.org/packages/eb/33/40cd74219417e78b97c47802037cf2d87b91973e18bb968a7da48a96ea44/ml_dtypes-0.5.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:533ce891ba774eabf607172254f2e7260ba5f57bdd64030c9a4fcfbd99815d0d", size = 5010956, upload-time = "2025-11-17T22:31:59.931Z" },
147
+ { url = "https://files.pythonhosted.org/packages/e1/8b/200088c6859d8221454825959df35b5244fa9bdf263fd0249ac5fb75e281/ml_dtypes-0.5.4-cp313-cp313-win_amd64.whl", hash = "sha256:f21c9219ef48ca5ee78402d5cc831bd58ea27ce89beda894428bc67a52da5328", size = 212224, upload-time = "2025-11-17T22:32:01.349Z" },
148
+ { url = "https://files.pythonhosted.org/packages/8f/75/dfc3775cb36367816e678f69a7843f6f03bd4e2bcd79941e01ea960a068e/ml_dtypes-0.5.4-cp313-cp313-win_arm64.whl", hash = "sha256:35f29491a3e478407f7047b8a4834e4640a77d2737e0b294d049746507af5175", size = 160798, upload-time = "2025-11-17T22:32:02.864Z" },
149
+ { url = "https://files.pythonhosted.org/packages/4f/74/e9ddb35fd1dd43b1106c20ced3f53c2e8e7fc7598c15638e9f80677f81d4/ml_dtypes-0.5.4-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:304ad47faa395415b9ccbcc06a0350800bc50eda70f0e45326796e27c62f18b6", size = 702083, upload-time = "2025-11-17T22:32:04.08Z" },
150
+ { url = "https://files.pythonhosted.org/packages/74/f5/667060b0aed1aa63166b22897fdf16dca9eb704e6b4bbf86848d5a181aa7/ml_dtypes-0.5.4-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6a0df4223b514d799b8a1629c65ddc351b3efa833ccf7f8ea0cf654a61d1e35d", size = 5354111, upload-time = "2025-11-17T22:32:05.546Z" },
151
+ { url = "https://files.pythonhosted.org/packages/40/49/0f8c498a28c0efa5f5c95a9e374c83ec1385ca41d0e85e7cf40e5d519a21/ml_dtypes-0.5.4-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:531eff30e4d368cb6255bc2328d070e35836aa4f282a0fb5f3a0cd7260257298", size = 5366453, upload-time = "2025-11-17T22:32:07.115Z" },
152
+ { url = "https://files.pythonhosted.org/packages/8c/27/12607423d0a9c6bbbcc780ad19f1f6baa2b68b18ce4bddcdc122c4c68dc9/ml_dtypes-0.5.4-cp313-cp313t-win_amd64.whl", hash = "sha256:cb73dccfc991691c444acc8c0012bee8f2470da826a92e3a20bb333b1a7894e6", size = 225612, upload-time = "2025-11-17T22:32:08.615Z" },
153
+ { url = "https://files.pythonhosted.org/packages/e5/80/5a5929e92c72936d5b19872c5fb8fc09327c1da67b3b68c6a13139e77e20/ml_dtypes-0.5.4-cp313-cp313t-win_arm64.whl", hash = "sha256:3bbbe120b915090d9dd1375e4684dd17a20a2491ef25d640a908281da85e73f1", size = 164145, upload-time = "2025-11-17T22:32:09.782Z" },
154
+ { url = "https://files.pythonhosted.org/packages/72/4e/1339dc6e2557a344f5ba5590872e80346f76f6cb2ac3dd16e4666e88818c/ml_dtypes-0.5.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:2b857d3af6ac0d39db1de7c706e69c7f9791627209c3d6dedbfca8c7e5faec22", size = 673781, upload-time = "2025-11-17T22:32:11.364Z" },
155
+ { url = "https://files.pythonhosted.org/packages/04/f9/067b84365c7e83bda15bba2b06c6ca250ce27b20630b1128c435fb7a09aa/ml_dtypes-0.5.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:805cef3a38f4eafae3a5bf9ebdcdb741d0bcfd9e1bd90eb54abd24f928cd2465", size = 5036145, upload-time = "2025-11-17T22:32:12.783Z" },
156
+ { url = "https://files.pythonhosted.org/packages/c6/bb/82c7dcf38070b46172a517e2334e665c5bf374a262f99a283ea454bece7c/ml_dtypes-0.5.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14a4fd3228af936461db66faccef6e4f41c1d82fcc30e9f8d58a08916b1d811f", size = 5010230, upload-time = "2025-11-17T22:32:14.38Z" },
157
+ { url = "https://files.pythonhosted.org/packages/e9/93/2bfed22d2498c468f6bcd0d9f56b033eaa19f33320389314c19ef6766413/ml_dtypes-0.5.4-cp314-cp314-win_amd64.whl", hash = "sha256:8c6a2dcebd6f3903e05d51960a8058d6e131fe69f952a5397e5dbabc841b6d56", size = 221032, upload-time = "2025-11-17T22:32:15.763Z" },
158
+ { url = "https://files.pythonhosted.org/packages/76/a3/9c912fe6ea747bb10fe2f8f54d027eb265db05dfb0c6335e3e063e74e6e8/ml_dtypes-0.5.4-cp314-cp314-win_arm64.whl", hash = "sha256:5a0f68ca8fd8d16583dfa7793973feb86f2fbb56ce3966daf9c9f748f52a2049", size = 163353, upload-time = "2025-11-17T22:32:16.932Z" },
159
+ { url = "https://files.pythonhosted.org/packages/cd/02/48aa7d84cc30ab4ee37624a2fd98c56c02326785750cd212bc0826c2f15b/ml_dtypes-0.5.4-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:bfc534409c5d4b0bf945af29e5d0ab075eae9eecbb549ff8a29280db822f34f9", size = 702085, upload-time = "2025-11-17T22:32:18.175Z" },
160
+ { url = "https://files.pythonhosted.org/packages/5a/e7/85cb99fe80a7a5513253ec7faa88a65306be071163485e9a626fce1b6e84/ml_dtypes-0.5.4-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2314892cdc3fcf05e373d76d72aaa15fda9fb98625effa73c1d646f331fcecb7", size = 5355358, upload-time = "2025-11-17T22:32:19.7Z" },
161
+ { url = "https://files.pythonhosted.org/packages/79/2b/a826ba18d2179a56e144aef69e57fb2ab7c464ef0b2111940ee8a3a223a2/ml_dtypes-0.5.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0d2ffd05a2575b1519dc928c0b93c06339eb67173ff53acb00724502cda231cf", size = 5366332, upload-time = "2025-11-17T22:32:21.193Z" },
162
+ { url = "https://files.pythonhosted.org/packages/84/44/f4d18446eacb20ea11e82f133ea8f86e2bf2891785b67d9da8d0ab0ef525/ml_dtypes-0.5.4-cp314-cp314t-win_amd64.whl", hash = "sha256:4381fe2f2452a2d7589689693d3162e876b3ddb0a832cde7a414f8e1adf7eab1", size = 236612, upload-time = "2025-11-17T22:32:22.579Z" },
163
+ { url = "https://files.pythonhosted.org/packages/ad/3f/3d42e9a78fe5edf792a83c074b13b9b770092a4fbf3462872f4303135f09/ml_dtypes-0.5.4-cp314-cp314t-win_arm64.whl", hash = "sha256:11942cbf2cf92157db91e5022633c0d9474d4dfd813a909383bd23ce828a4b7d", size = 168825, upload-time = "2025-11-17T22:32:23.766Z" },
164
+ ]
165
+
114
166
  [[package]]
115
167
  name = "mpmath"
116
168
  version = "1.3.0"
@@ -179,6 +231,32 @@ wheels = [
179
231
  { url = "https://files.pythonhosted.org/packages/43/bb/e1c71a4295b1b1d1393d50dbb4f2a36283c6859d9d3892e84f00ec5a91d5/numpy-2.4.6-cp314-cp314t-win_arm64.whl", hash = "sha256:0c9136e14ed34a9e343a31c533d78a9813a69a3148332bce5e9821cb2f996e66", size = 10565867, upload-time = "2026-05-18T23:36:47.114Z" },
180
232
  ]
181
233
 
234
+ [[package]]
235
+ name = "onnx"
236
+ version = "1.22.0"
237
+ source = { registry = "https://pypi.org/simple" }
238
+ dependencies = [
239
+ { name = "ml-dtypes" },
240
+ { name = "numpy" },
241
+ { name = "protobuf" },
242
+ { name = "typing-extensions" },
243
+ ]
244
+ sdist = { url = "https://files.pythonhosted.org/packages/04/19/8ea73a64b368b75fe339771a20a02bc61ea1f551484c9e3d9d0bfbd0450f/onnx-1.22.0.tar.gz", hash = "sha256:ef40c0aaf0b643857ea9306fc7eddce17eaf9fb0407e4801f1fc5758443a38e0", size = 12024721, upload-time = "2026-06-15T12:50:05.354Z" }
245
+ wheels = [
246
+ { url = "https://files.pythonhosted.org/packages/ee/6a/481561f1093834376ed493e4ca42a73e5be0d50031f2969c86593bdc7c96/onnx-1.22.0-cp312-abi3-macosx_12_0_universal2.whl", hash = "sha256:596fbf0490947533c1c1045ba860851dc9fb77471023dac9a71ba5b42ceab103", size = 20167081, upload-time = "2026-06-15T12:49:32.078Z" },
247
+ { url = "https://files.pythonhosted.org/packages/84/55/b34fc2aa30aa54b4a775402d24c4082242c720283a274fe976ac8eb94480/onnx-1.22.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ae5a563f281cd9d2845622cecf6c092a57e4ee1b138f66fdbbdd4200567a5e16", size = 18889249, upload-time = "2026-06-15T12:49:34.7Z" },
248
+ { url = "https://files.pythonhosted.org/packages/09/a6/bd32357e6cc1ecb473afd78193d7231724f284435d2db25696ecfaaa1503/onnx-1.22.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:955e02e1f6d385b53d52f9cd7b9cdf5caf417c300bcfe3c64c6d542be763845b", size = 19106514, upload-time = "2026-06-15T12:49:37.424Z" },
249
+ { url = "https://files.pythonhosted.org/packages/5a/9d/3af461ac6c714b8b369cb71499659932f4f12cfb066250b62f7567c3d530/onnx-1.22.0-cp312-abi3-pyemscripten_2025_0_wasm32.whl", hash = "sha256:82e9f27fc1223cb06d68a56bed6f9d3caf3d0dad1b61bce45006d529b15bd94c", size = 16966387, upload-time = "2026-06-15T12:49:40.918Z" },
250
+ { url = "https://files.pythonhosted.org/packages/d0/f0/68195b5e5a53e333faf2660f5352ee43738d0e42fc5216cc6b1871a9fbfb/onnx-1.22.0-cp312-abi3-win32.whl", hash = "sha256:cc8b66b312f8f03a53e268afb67180a2d97dd12cc79e2b61361c6c0073448016", size = 17081568, upload-time = "2026-06-15T12:49:43.398Z" },
251
+ { url = "https://files.pythonhosted.org/packages/13/a8/734725bb703c5fabb687f79c79e51249475212b3eb37771ac4a4ac9b487f/onnx-1.22.0-cp312-abi3-win_amd64.whl", hash = "sha256:72ccebab3bac07215c204ce8848d42e78eaaa666badbf72d25cd359b9f269e3a", size = 17213290, upload-time = "2026-06-15T12:49:45.933Z" },
252
+ { url = "https://files.pythonhosted.org/packages/bd/2a/8ce48d8ae26a8761ad4e5dc771961b155c5c3c7c8540ec7f2f2d71b69af0/onnx-1.22.0-cp312-abi3-win_arm64.whl", hash = "sha256:f3c120dcdb70ad738f3c061b32798f408ea299eb69f84dd69ab4a6bf3c2ec01f", size = 17207030, upload-time = "2026-06-15T12:49:48.635Z" },
253
+ { url = "https://files.pythonhosted.org/packages/f3/13/47323b97846387848efb1044ded11bb94b83526f3d1fbdb37c6480d4520f/onnx-1.22.0-cp314-cp314t-macosx_12_0_universal2.whl", hash = "sha256:19e45e4af88e3fe3261458d4b8cc461957ae2782a358a3560503569bf3b23b72", size = 20176465, upload-time = "2026-06-15T12:49:51.311Z" },
254
+ { url = "https://files.pythonhosted.org/packages/13/0c/d3b8a7e7eee123938586c608bb9894b5723f2342b9450c0eec59fbec7099/onnx-1.22.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c21a0e59fd967a95b358e4a6e756d1f1eec2d304a83480f329f66e30d2bf0223", size = 18894028, upload-time = "2026-06-15T12:49:54.451Z" },
255
+ { url = "https://files.pythonhosted.org/packages/b8/8a/da2a97ab46fe6e0cd9beb3ac14603a22f5be492f9ca347faf8233a07bb33/onnx-1.22.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2632406b8f523ef2e2873c363f90b20a3d88c0fbcfac757d3addffccf8f452c2", size = 19110420, upload-time = "2026-06-15T12:49:57.665Z" },
256
+ { url = "https://files.pythonhosted.org/packages/b9/a3/ce984063017518307ebfaa545782fc400e593dc2d7fdf4f23ce4be1ed197/onnx-1.22.0-cp314-cp314t-win_amd64.whl", hash = "sha256:a3a39fc4643867aecb33417fdddb11e308ee79d2d4a584b9d50cc7aec2091b13", size = 17237547, upload-time = "2026-06-15T12:50:00.382Z" },
257
+ { url = "https://files.pythonhosted.org/packages/00/50/257a880384a1dd502d543b0067945074d63cd17d0840e958355bc8197da8/onnx-1.22.0-cp314-cp314t-win_arm64.whl", hash = "sha256:8e268cdc0547e3949799ffd4a44451dc2b9080b57d0824a2db680b6ec65506f0", size = 17231391, upload-time = "2026-06-15T12:50:03.047Z" },
258
+ ]
259
+
182
260
  [[package]]
183
261
  name = "onnxruntime"
184
262
  version = "1.27.0"
@@ -241,6 +319,23 @@ wheels = [
241
319
  { url = "https://files.pythonhosted.org/packages/83/06/e1b690df1c70772d76464c5d8b2d11b436ade1cf93a061303cdf9d72b3bf/onnxruntime_gpu-1.27.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42696d6137d6974325a67c88a65dd41625e49bf076da79c658514b498b297142", size = 220327139, upload-time = "2026-06-18T18:27:59.096Z" },
242
320
  ]
243
321
 
322
+ [[package]]
323
+ name = "onnxsim"
324
+ version = "0.6.5"
325
+ source = { registry = "https://pypi.org/simple" }
326
+ dependencies = [
327
+ { name = "onnx" },
328
+ { name = "rich" },
329
+ ]
330
+ sdist = { url = "https://files.pythonhosted.org/packages/c1/ac/8b1635f72adafc2be084bae43dc7a5043424eced4587a341430d7213dd32/onnxsim-0.6.5.tar.gz", hash = "sha256:ae63902477793c3d160fc8dcc796cfd041c38e72f1fb74358a0cbd85bc3e777f", size = 2730302, upload-time = "2026-06-08T11:33:40.597Z" }
331
+ wheels = [
332
+ { url = "https://files.pythonhosted.org/packages/05/2a/658fd32b774643196c29793cf92cdf56590597d845a96fcd215506565c4f/onnxsim-0.6.5-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:4047cbb6902c48104abd16b41fd982a6f6254cbc8f390c7d2740b1b61aaed8dc", size = 1868175, upload-time = "2026-06-08T11:33:30.969Z" },
333
+ { url = "https://files.pythonhosted.org/packages/3b/4e/c3647021735e7473e557d26c6740297da097790ea5d7e0bc92e6422c93a3/onnxsim-0.6.5-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2a4abf6bde92ad23bca70d05e4a3f5eb13144bdc126ef6b24849e2ed24647c10", size = 2628908, upload-time = "2026-06-08T11:33:32.992Z" },
334
+ { url = "https://files.pythonhosted.org/packages/01/82/6ea262bb9500a30b54181946ec0ce093530895afacb66ac6b86688713dff/onnxsim-0.6.5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bc7c2717c0bc0ffa21e501c675af520f344e70f2bfda835e8fefa127ffd6ac92", size = 2937976, upload-time = "2026-06-08T11:33:34.72Z" },
335
+ { url = "https://files.pythonhosted.org/packages/4a/86/714847c834ee49f5e689034eea65ef8c789b3b9078c655e8d1e7f53d1559/onnxsim-0.6.5-cp312-abi3-win_amd64.whl", hash = "sha256:34305a8ea447b91c3b3b74d6eb5451fa7fef3ad2708f934c3eabac91e329dd12", size = 1641985, upload-time = "2026-06-08T11:33:36.615Z" },
336
+ { url = "https://files.pythonhosted.org/packages/5b/60/cb6923cded2b7933a8ae171bbc377f87dc1203464c0fd9f006ffe61857ac/onnxsim-0.6.5-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:30025eaed4c5262fb0f2e2faec911c4693029e89104b7595fb207bf6f6c9471d", size = 2943591, upload-time = "2026-06-08T11:33:38.203Z" },
337
+ ]
338
+
244
339
  [[package]]
245
340
  name = "openvino"
246
341
  version = "2026.2.1"
@@ -306,6 +401,15 @@ wheels = [
306
401
  { url = "https://files.pythonhosted.org/packages/0c/c3/44f3fbbfa403ea2a7c779186dc20772604442dde72947e7d01069cbe98e3/pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992", size = 48172, upload-time = "2026-01-21T14:26:50.693Z" },
307
402
  ]
308
403
 
404
+ [[package]]
405
+ name = "pygments"
406
+ version = "2.20.0"
407
+ source = { registry = "https://pypi.org/simple" }
408
+ sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f", size = 4955991, upload-time = "2026-03-29T13:29:33.898Z" }
409
+ wheels = [
410
+ { url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176", size = 1231151, upload-time = "2026-03-29T13:29:30.038Z" },
411
+ ]
412
+
309
413
  [[package]]
310
414
  name = "pyright"
311
415
  version = "1.1.411"
@@ -331,6 +435,19 @@ wheels = [
331
435
  { url = "https://files.pythonhosted.org/packages/6f/5c/7e8fb5417ef96cbeca125b5ee507ec5568ce4bde7b576d20db2d2d4a80fc/pyworld-0.3.5-cp313-cp313-win_amd64.whl", hash = "sha256:860c5c3528f1dbc5c68fa71a16e3bb6990244619e5b9baf62952f3a6bfc6131c", size = 222371, upload-time = "2025-01-21T15:59:08.319Z" },
332
436
  ]
333
437
 
438
+ [[package]]
439
+ name = "rich"
440
+ version = "15.0.0"
441
+ source = { registry = "https://pypi.org/simple" }
442
+ dependencies = [
443
+ { name = "markdown-it-py" },
444
+ { name = "pygments" },
445
+ ]
446
+ sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" }
447
+ wheels = [
448
+ { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" },
449
+ ]
450
+
334
451
  [[package]]
335
452
  name = "ruff"
336
453
  version = "0.15.21"
@@ -386,14 +503,20 @@ index = [
386
503
  openvino = [
387
504
  { name = "openvino" },
388
505
  ]
506
+ optimize = [
507
+ { name = "onnx" },
508
+ { name = "onnxsim" },
509
+ ]
389
510
 
390
511
  [package.metadata]
391
512
  requires-dist = [
392
513
  { name = "faiss-cpu", marker = "extra == 'index'", specifier = ">=1.14.3" },
393
514
  { name = "numpy", specifier = ">=2.3" },
515
+ { name = "onnx", marker = "extra == 'optimize'", specifier = ">=1.22.0" },
394
516
  { name = "onnxruntime", marker = "extra == 'cpu'", specifier = ">=1.27.0" },
395
517
  { name = "onnxruntime-directml", marker = "extra == 'dml'", specifier = ">=1.24.4" },
396
518
  { name = "onnxruntime-gpu", marker = "extra == 'cuda'", specifier = ">=1.27.0" },
519
+ { name = "onnxsim", marker = "extra == 'optimize'", specifier = ">=0.6.5" },
397
520
  { name = "openvino", marker = "extra == 'openvino'", specifier = ">=2026.2.1" },
398
521
  { name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.411" },
399
522
  { name = "pyworld", specifier = ">=0.3.5" },
@@ -401,7 +524,7 @@ requires-dist = [
401
524
  { name = "samplerate", specifier = ">=0.2.4" },
402
525
  { name = "soundfile", specifier = ">=0.14.0" },
403
526
  ]
404
- provides-extras = ["cpu", "cuda", "dev", "dml", "index", "openvino"]
527
+ provides-extras = ["cpu", "cuda", "dev", "dml", "index", "openvino", "optimize"]
405
528
 
406
529
  [[package]]
407
530
  name = "samplerate"
@@ -1 +0,0 @@
1
- __version__ = "0.1.3"
File without changes
File without changes
File without changes