indextts25-inference 0.1.1__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 (93) hide show
  1. indextts25_inference-0.1.1/.github/workflows/ci.yml +33 -0
  2. indextts25_inference-0.1.1/.github/workflows/openwiki-update.yml +90 -0
  3. indextts25_inference-0.1.1/.github/workflows/release-please.yml +17 -0
  4. indextts25_inference-0.1.1/.github/workflows/release.yml +20 -0
  5. indextts25_inference-0.1.1/.gitignore +12 -0
  6. indextts25_inference-0.1.1/.python-version +1 -0
  7. indextts25_inference-0.1.1/.release-please-manifest.json +3 -0
  8. indextts25_inference-0.1.1/AGENTS.md +16 -0
  9. indextts25_inference-0.1.1/CHANGELOG.md +10 -0
  10. indextts25_inference-0.1.1/DISCLAIMER +43 -0
  11. indextts25_inference-0.1.1/LICENSE +57 -0
  12. indextts25_inference-0.1.1/PKG-INFO +320 -0
  13. indextts25_inference-0.1.1/README.md +276 -0
  14. indextts25_inference-0.1.1/indextts25/__init__.py +5 -0
  15. indextts25_inference-0.1.1/indextts25/accel/__init__.py +2 -0
  16. indextts25_inference-0.1.1/indextts25/accel/accel_engine.py +205 -0
  17. indextts25_inference-0.1.1/indextts25/accel/attention.py +148 -0
  18. indextts25_inference-0.1.1/indextts25/accel/gpt2_accel.py +131 -0
  19. indextts25_inference-0.1.1/indextts25/accel/kv_manager.py +62 -0
  20. indextts25_inference-0.1.1/indextts25/api.py +191 -0
  21. indextts25_inference-0.1.1/indextts25/codec/__init__.py +0 -0
  22. indextts25_inference-0.1.1/indextts25/codec/models.py +97 -0
  23. indextts25_inference-0.1.1/indextts25/gpt/__init__.py +0 -0
  24. indextts25_inference-0.1.1/indextts25/gpt/conformer/__init__.py +0 -0
  25. indextts25_inference-0.1.1/indextts25/gpt/conformer/attention.py +311 -0
  26. indextts25_inference-0.1.1/indextts25/gpt/conformer/embedding.py +162 -0
  27. indextts25_inference-0.1.1/indextts25/gpt/conformer/subsampling.py +85 -0
  28. indextts25_inference-0.1.1/indextts25/gpt/conformer_encoder.py +503 -0
  29. indextts25_inference-0.1.1/indextts25/gpt/model_v2.py +487 -0
  30. indextts25_inference-0.1.1/indextts25/gpt/perceiver.py +180 -0
  31. indextts25_inference-0.1.1/indextts25/infer_v2_5.py +565 -0
  32. indextts25_inference-0.1.1/indextts25/s2mel/modules/audio.py +51 -0
  33. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/activations.py +120 -0
  34. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/alias_free_activation/torch/__init__.py +2 -0
  35. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/alias_free_activation/torch/act.py +31 -0
  36. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/alias_free_activation/torch/filter.py +102 -0
  37. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/alias_free_activation/torch/resample.py +58 -0
  38. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/bigvgan.py +119 -0
  39. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/env.py +8 -0
  40. indextts25_inference-0.1.1/indextts25/s2mel/modules/bigvgan/utils.py +6 -0
  41. indextts25_inference-0.1.1/indextts25/s2mel/modules/campplus/DTDNN.py +122 -0
  42. indextts25_inference-0.1.1/indextts25/s2mel/modules/campplus/layers.py +251 -0
  43. indextts25_inference-0.1.1/indextts25/s2mel/modules/commons.py +40 -0
  44. indextts25_inference-0.1.1/indextts25/s2mel/modules/diffusion_transformer.py +237 -0
  45. indextts25_inference-0.1.1/indextts25/s2mel/modules/encodec.py +92 -0
  46. indextts25_inference-0.1.1/indextts25/s2mel/modules/flow_matching.py +55 -0
  47. indextts25_inference-0.1.1/indextts25/s2mel/modules/gpt_fast/model.py +225 -0
  48. indextts25_inference-0.1.1/indextts25/s2mel/modules/length_regulator.py +33 -0
  49. indextts25_inference-0.1.1/indextts25/s2mel/modules/wavenet.py +73 -0
  50. indextts25_inference-0.1.1/indextts25/utils/__init__.py +0 -0
  51. indextts25_inference-0.1.1/indextts25/utils/checkpoint.py +43 -0
  52. indextts25_inference-0.1.1/indextts25/utils/common.py +120 -0
  53. indextts25_inference-0.1.1/indextts25/utils/front.py +417 -0
  54. indextts25_inference-0.1.1/indextts25/utils/ja_g2p.py +102 -0
  55. indextts25_inference-0.1.1/indextts25/utils/model_download.py +30 -0
  56. indextts25_inference-0.1.1/indextts25/utils/nemo_tn.py +200 -0
  57. indextts25_inference-0.1.1/indextts25/utils/tokenizer.py +200 -0
  58. indextts25_inference-0.1.1/indextts25/utils/typical_sampling.py +31 -0
  59. indextts25_inference-0.1.1/openwiki/.claims/api/public-api.json +200 -0
  60. indextts25_inference-0.1.1/openwiki/.claims/architecture/overview.json +126 -0
  61. indextts25_inference-0.1.1/openwiki/.claims/operations/dependencies-and-compatibility.json +174 -0
  62. indextts25_inference-0.1.1/openwiki/.claims/operations/model-loading-and-caches.json +134 -0
  63. indextts25_inference-0.1.1/openwiki/.claims/pipeline/acoustic-decoding.json +108 -0
  64. indextts25_inference-0.1.1/openwiki/.claims/pipeline/flash-engine.json +160 -0
  65. indextts25_inference-0.1.1/openwiki/.claims/pipeline/gpt-generation.json +130 -0
  66. indextts25_inference-0.1.1/openwiki/.claims/pipeline/text-frontend.json +122 -0
  67. indextts25_inference-0.1.1/openwiki/.claims/pipeline/voice-and-emotion-conditioning.json +110 -0
  68. indextts25_inference-0.1.1/openwiki/.claims/quickstart.json +52 -0
  69. indextts25_inference-0.1.1/openwiki/.claims/testing/testing-and-benchmarks.json +122 -0
  70. indextts25_inference-0.1.1/openwiki/.last-update.json +8 -0
  71. indextts25_inference-0.1.1/openwiki/.page-manifest.json +82 -0
  72. indextts25_inference-0.1.1/openwiki/api/index.md +3 -0
  73. indextts25_inference-0.1.1/openwiki/api/public-api.md +144 -0
  74. indextts25_inference-0.1.1/openwiki/architecture/index.md +3 -0
  75. indextts25_inference-0.1.1/openwiki/architecture/overview.md +122 -0
  76. indextts25_inference-0.1.1/openwiki/index.md +15 -0
  77. indextts25_inference-0.1.1/openwiki/operations/dependencies-and-compatibility.md +131 -0
  78. indextts25_inference-0.1.1/openwiki/operations/index.md +4 -0
  79. indextts25_inference-0.1.1/openwiki/operations/model-loading-and-caches.md +111 -0
  80. indextts25_inference-0.1.1/openwiki/pipeline/acoustic-decoding.md +109 -0
  81. indextts25_inference-0.1.1/openwiki/pipeline/flash-engine.md +114 -0
  82. indextts25_inference-0.1.1/openwiki/pipeline/gpt-generation.md +105 -0
  83. indextts25_inference-0.1.1/openwiki/pipeline/index.md +7 -0
  84. indextts25_inference-0.1.1/openwiki/pipeline/text-frontend.md +116 -0
  85. indextts25_inference-0.1.1/openwiki/pipeline/voice-and-emotion-conditioning.md +100 -0
  86. indextts25_inference-0.1.1/openwiki/quickstart.md +77 -0
  87. indextts25_inference-0.1.1/openwiki/testing/index.md +3 -0
  88. indextts25_inference-0.1.1/openwiki/testing/testing-and-benchmarks.md +127 -0
  89. indextts25_inference-0.1.1/pyproject.toml +73 -0
  90. indextts25_inference-0.1.1/release-please-config.json +12 -0
  91. indextts25_inference-0.1.1/scripts/benchmark.py +74 -0
  92. indextts25_inference-0.1.1/tests/test_regressions.py +128 -0
  93. indextts25_inference-0.1.1/uv.lock +3317 -0
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - uses: astral-sh/setup-uv@v6
15
+ with:
16
+ enable-cache: true
17
+
18
+ - run: uv run --only-group dev ruff check
19
+
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - uses: astral-sh/setup-uv@v6
26
+ with:
27
+ enable-cache: true
28
+
29
+ - run: uv run --group test pytest --cov=indextts25 --cov-report=xml
30
+
31
+ - uses: codecov/codecov-action@v5
32
+ with:
33
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,90 @@
1
+ name: OpenWiki Update
2
+
3
+ # Paused: there is no LLM API key yet. To turn on the daily update, add the
4
+ # OPENAI_API_KEY secret and uncomment the schedule; until then it only runs by hand.
5
+ on:
6
+ workflow_dispatch:
7
+ # schedule:
8
+ # - cron: "0 8 * * *"
9
+
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
13
+
14
+ jobs:
15
+ update:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Check out repository
19
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
20
+ with:
21
+ # Full history so `openwiki code --update` can diff HEAD against the
22
+ # commit it last documented; a shallow clone hides that commit and the
23
+ # update runs against an empty change summary.
24
+ fetch-depth: 0
25
+
26
+ - name: Set up Node.js
27
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
28
+ with:
29
+ node-version: "22"
30
+
31
+ - name: Install OpenWiki
32
+ # mermaid + jsdom are optional; they add high-fidelity validation of Mermaid diagrams. Remove if your wiki has none.
33
+ run: npm install --global openwiki@0.7.2 mermaid@11.16.0 jsdom@29.1.1
34
+
35
+ - name: Run OpenWiki
36
+ id: openwiki
37
+ continue-on-error: true
38
+ run: openwiki code --update --print
39
+ env:
40
+ OPENWIKI_PROVIDER: openai
41
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
42
+ OPENWIKI_MODEL_ID: "gpt-5.6-terra"
43
+ # Required for the LangSmith connector's code-mode pull to authenticate.
44
+ # For extra workspaces, add OPENWIKI_LANGSMITH_API_KEY_2, _3, ... as repo
45
+ # secrets and env entries here.
46
+ OPENWIKI_LANGSMITH_API_KEY: ${{ secrets.OPENWIKI_LANGSMITH_API_KEY }}
47
+ # Optional: also trace this workflow's own OpenWiki run to LangSmith.
48
+ LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}
49
+ LANGCHAIN_PROJECT: openwiki
50
+ LANGCHAIN_TRACING_V2: "true"
51
+
52
+ - name: Remove transient OpenWiki run state
53
+ if: ${{ !cancelled() }}
54
+ run: rm -f -- openwiki/.run.json
55
+
56
+ - name: List OpenWiki update paths
57
+ id: paths
58
+ if: ${{ !cancelled() }}
59
+ # CLAUDE.md is listed only when present: git add fails on a missing path
60
+ # and then stages nothing.
61
+ run: |
62
+ paths=openwiki,AGENTS.md,.github/workflows/openwiki-update.yml
63
+ if [ -e CLAUDE.md ]; then paths="$paths,CLAUDE.md"; fi
64
+ echo "list=$paths" >> "$GITHUB_OUTPUT"
65
+
66
+ - name: Create OpenWiki update pull request
67
+ id: create-pr
68
+ if: ${{ !cancelled() }}
69
+ uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
70
+ with:
71
+ add-paths: ${{ steps.paths.outputs.list }}
72
+ branch: openwiki/update
73
+ commit-message: "docs: update OpenWiki"
74
+ title: "docs: update OpenWiki"
75
+ body: |
76
+ Automated OpenWiki documentation update.
77
+
78
+ OpenWiki result: ${{ steps.openwiki.outcome }}
79
+
80
+ When the result is `failure`, this PR intentionally preserves only the
81
+ pages completed before the failure. Merge it to make that progress the
82
+ baseline for the next scheduled run.
83
+
84
+ - name: Annotate OpenWiki update pull request
85
+ if: ${{ !cancelled() && steps.create-pr.outputs.pull-request-url != '' }}
86
+ run: echo "::notice title=OpenWiki update pull request::${{ steps.create-pr.outputs.pull-request-url }}"
87
+
88
+ - name: Propagate OpenWiki failure
89
+ if: ${{ steps.openwiki.outcome == 'failure' }}
90
+ run: exit 1
@@ -0,0 +1,17 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: write
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ release-please:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: googleapis/release-please-action@v4
16
+ with:
17
+ token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
@@ -0,0 +1,20 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: astral-sh/setup-uv@v6
17
+
18
+ - run: uv build
19
+
20
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ checkpoints/
8
+ *.wav
9
+ .pytest_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ coverage.xml
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.1"
3
+ }
@@ -0,0 +1,16 @@
1
+ <!-- OPENWIKI:START -->
2
+
3
+ ## OpenWiki
4
+
5
+ This repository has a generated `openwiki/` evidence index. It is optional just-in-time context, not required startup reading.
6
+
7
+ - Do not enumerate, preload, or search wikis at task start. Use retrieval when the user asks for it, when unfamiliar architecture or dependency behavior materially affects the task, or when source inspection leaves an important uncertainty. Stop once the question is grounded.
8
+ - When those conditions apply and OpenWiki retrieval tools are available, use `openwiki_search` for just-in-time context and `openwiki_read` for the relevant complete sections. If search returns `workspace_required`, ask which listed workspace to use and retry with its ID.
9
+ - Use `openwiki_list_workspaces` or `openwiki_list_wikis` when workspace membership itself needs to be discovered.
10
+ - If the retrieval tools are unavailable, read `openwiki/quickstart.md` and follow its links to the relevant pages.
11
+ - Treat source code and tests as authoritative. A brief's unknowns and review items are verification gaps, not automatic requirements.
12
+ - Prefer the narrowest quiet validation that proves the changed behavior. Preserve complete failure output.
13
+
14
+ The scheduled OpenWiki GitHub Actions workflow refreshes the repository wiki. Do not hand-edit generated OpenWiki pages unless explicitly asked; prefer updating source code/docs and letting OpenWiki regenerate.
15
+
16
+ <!-- OPENWIKI:END -->
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## [0.1.1](https://github.com/nicokim/indextts25-inference/compare/v0.1.0...v0.1.1) (2026-10-16)
4
+
5
+
6
+ ### Documentation
7
+
8
+ * inicializar OpenWiki ([5a774df](https://github.com/nicokim/indextts25-inference/commit/5a774dfcd4237b2c476270c734d530c367d86f7d))
9
+ * OpenWiki al día con los comentarios en inglés ([94d59e1](https://github.com/nicokim/indextts25-inference/commit/94d59e1e8306e881209d156f038c2081be15c3f1))
10
+ * README en inglés con medidas, stacks recomendados y compatibilidad ([769f871](https://github.com/nicokim/indextts25-inference/commit/769f87198723a83babfb081a345471433b05c227))
@@ -0,0 +1,43 @@
1
+ TTS语音合成技术免责声明
2
+
3
+ 1. 总则
4
+ 本声明适用于 Index-TTS(以下简称"本项目")的所有用户和使用者。使用本项目即表示您已阅读、理解并同意遵守本免责声明的全部内容。
5
+
6
+ 2. 使用限制
7
+ 2.1 本项目仅供用户进行技术研究、学习和合法的创意应用,不得用于任何违反法律法规的活动。
8
+
9
+ 2.2 用户不得使用本项目:
10
+ a) 合成政治人物、公众人物或任何未经授权的个人声音;
11
+ b) 创建诋毁、侮辱、歧视或损害他人名誉和权益的内容;
12
+ c) 进行欺诈、身份盗用或任何形式的违法活动;
13
+ d) 传播虚假信息或制造社会恐慌;
14
+ e) 侵犯他人知识产权、肖像权或隐私权;
15
+ f) 未经授权将合成声音用于商业目的;
16
+ g) 违反特定行业(如金融、医疗等)的法规要求;
17
+ h) 创建或使用涉及未成年人的不当声音内容;
18
+ i) 制作可能威胁国家安全的内容;
19
+ j) 违反任何地区关于深度伪造技术的法律法规。
20
+
21
+ 3. 知识产权与授权
22
+ 3.1 本项目以[开源许可证类型]许可证开源。
23
+ 3.2 用户在使用本项目过程中产生的所有内容及其法律责任由用户自行承担。
24
+
25
+ 4. 责任限制
26
+ 4.1 项目开发者不对用户使用本项目所产生的任何直接或间接后果承担责任。
27
+ 4.2 项目开发者不保证本项目的功能满足用户的所有需求,也不保证运行不会中断或出错。
28
+ 4.3 用户因使用本项目而产生的任何法律纠纷、损失或损害,项目开发者概不负责。
29
+
30
+ 5. 法律适用
31
+ 5.1 本免责声明受[国家/地区]法律管辖。
32
+ 5.2 如本声明的任何条款与适用法律相抵触,则以适用法律为准。
33
+
34
+ 6. 声明更新
35
+ 6.1 项目开发者保留随时更新本免责声明的权利,更新后的声明自发布之日起生效。
36
+ 6.2 用户应定期查阅本声明以了解任何变更。
37
+
38
+ 7. 其他条款
39
+ 7.1 用户在使用本项目前,应确保其使用行为符合所在地区的法律法规。
40
+ 7.2 如用户对本项目的使用引起任何法律纠纷,用户应积极配合相关调查并承担相应责任。
41
+
42
+ 最后更新日期:2025.3.17
43
+ 开发者:Bilibili Index Team
@@ -0,0 +1,57 @@
1
+ bilibili Model Use License Agreement
2
+
3
+ By clicking “I agree” to this bilibili Model Use License Agreement (“this Agreement”) , or by otherwise using any portion or element of the Model or any Derivative Work, you will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately. If you do not agree to this Agreement, you must immediately cease all use and permanently delete the Model and any Derivative Works.
4
+
5
+ 1. Definitions
6
+ 1.1 “This Agreement”: means the bilibili Model Use License Agreement, including all of its terms and conditions.
7
+ 1.2 “We”, “us”, or “our”: means bilibili , the original right-holder of the Model.
8
+ 1.3 “You”: means any natural person or legal entity exercising rights granted by this Agreement and/or using the Model for any purpose and in any field of use.
9
+ 1.4 “Model”: means the artificial-intelligence model named “bilibili indextts2”, including but not limited to model weights and final code, in each case only to the extent that such components are published by us at https://github.com/index-tts/index-tts.
10
+ 1.5 “Derivative Work”: means any derivative of the Model, including without limitation:
11
+  (i) any modification of the Model, model outputs, or their derivatives;
12
+  (ii) any work based on the Model, model outputs, or their derivatives;
13
+  (iii) any other machine learning model which is created by re-training, fine-tuning, quantizing, LoRA, parameter-efficient fine-tuning, or any other method involving incremental weights or merged checkpoints, in each case based on the Model, model outputs, or their derivatives.
14
+ 1.6 “Use”: means downloading, copying, training, modifying, creating Derivative Works, distributing, publishing, running, fine-tuning, publicly displaying, communicating to the public, or otherwise exploiting the Model or any Derivative Work.
15
+
16
+ 2. Scope of License and Restrictions
17
+ 2.1 Subject to the terms and conditions of this Agreement, we grant you a worldwide, non-exclusive, non-transferable, royalty-free limited license to Use the Model or any Derivative Work based on the intellectual properties or other rights owned by Us embodied in the Model or any Derivative Work.
18
+ 2.2 If You intend to Use, or have already Used, the Model or any Derivative Work, and either (i) your or any of your Affiliates’ products or services had more than 100 million monthly active users in the immediately preceding calendar month, or (ii) your or any of your Affiliates’ annual revenue in the immediately preceding calendar year exceeded RMB 1 billion, You must request a separated license from us, which We may grant to You in our sole discretion. You are not authorized to exercise any of the rights under this Agreement unless and until We have expressly granted You such rights in writing.
19
+ 2.3 This Agreement is an open-source license for the Model in which we possess intellectual properties and other rights. It governs your Use of the Model only and does not limit any rights that we have regarding the Model.
20
+
21
+ 3. Disclaimer and Risk Allocation
22
+ 3.1 The Model and any outputs generated thereby are provided “AS IS,” without warranty of any kind, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, non-infringement, absence of errors or omissions, continuity, accuracy, reliability, or stability. You are solely responsible for determining the appropriateness of using or redistributing the Model and assume all risks associated with exercising any rights granted under this Agreement.
23
+ 3.2 You shall bear sole responsibility for any infringement, illegality, breach of contract, damages, fines, regulatory investigations, or other liabilities (including, without limitation, infringement of third-party patents, copyrights, trademarks, trade secrets, personality rights, data-protection rights, or any other rights) arising out of or related to your Use of the Model or any outputs generated thereby. We assume no joint, several, supplementary, or advance payment liability.
24
+ 3.3 Under no circumstances shall we be liable to you or any third party for any direct, indirect, incidental, special, punitive, or consequential damages (including, without limitation, loss of data, business interruption, or loss of profits) arising out of or related to the Use of the Model, even if we have been advised of the possibility of such damages.
25
+ 3.4 Additional Obligations for You and Downstream Recipients
26
+ a) You must ensure that any downstream recipient of the Model or any Derivative Work that you distribute complies with this Agreement, and you must impose appropriate contractual terms on such downstream recipients. If any downstream recipient breaches this Agreement, you shall be responsible for the consequences thereof.
27
+ b) You must retain all original copyright notices and a copy of this Agreement in every copy of the Model or any Derivative Work that you Use.
28
+ c) You may not Use the bilibili indextts2 or any Derivative Work to improve any AI model, except for the bilibili indextts2 itself, its Derivative Works,or non-commercial AI models.
29
+
30
+ 4. Compliance Obligations
31
+ 4.1 Usage Restrictions
32
+ a) If you distribute a Derivative Work, you must clearly state in the distribution page or accompanying documentation: “Any modifications made to the original model in this Derivative Work are not endorsed, warranted, or guaranteed by the original right-holder of the original model, and the original right-holder disclaims all liability related to this Derivative Work.”
33
+ b) If your Use of the Model or any Derivative Work incorporates any third-party data or weights, you must obtain all necessary authorizations on your own and bear full responsibility for compliance.
34
+ c) You may not Use the Model or any Derivative Work for any purpose that violates the laws or regulatory requirements of the jurisdiction where the outputs and/or the Model are generated or used (including, without limitation, generating false information, discriminatory content, or content that infringes privacy).
35
+ d) If the Model or any Derivative Work is capable of generating content, you must ensure that such content does not violate the laws or regulatory requirements of the applicable jurisdiction (including, without limitation, generating false information, discriminatory content, or content that infringes privacy).
36
+ 4.2 Prohibited High-Risk Use
37
+ You must ensure that the Model and any Derivative Work are not deployed, directly or indirectly, in high-risk scenarios such as medical diagnosis, autonomous driving, military applications, critical-infrastructure control, large-scale biometric surveillance, or automated decision-making (e.g., credit or employment evaluations). If you insist on such deployment, you must independently complete all compliance obligations under applicable laws and regulations (including but not limited to GDPR, CCPA, HIPAA, export-control laws, and AI-specific regulations), and we shall bear no liability for any consequences arising therefrom.
38
+ 4.3 Infringement Liability
39
+ Should any third party raise claims against you with respect to any Derivative Work you develop or your Use of the Model or any Derivative Work, you shall bear full and independent responsibility for defending against and resolving such claims. If your actions cause us to incur any third-party claims, administrative penalties, or other losses, you shall indemnify us for all losses we thereby suffer, including but not limited to attorney fees, litigation costs, damages, and fines, and shall take all necessary measures to eliminate any adverse impact on us.
40
+
41
+ 5. Reserved Rights
42
+ 5.1 We reserve the right to revoke the license granted to you under this Agreement in the event of your breach. Upon revocation, you must immediately cease all Use and permanently delete all copies of the Model and any Derivative Work. Sections 3 and 6 of this Agreement shall survive termination of this Agreement under this circumstance.
43
+ 5.2 Nothing in this Agreement grants you any right to use our trade names, trademarks, service marks, or product names, except as reasonably and customarily required to describe the origin of the Model or any Derivative Work—such as reproducing the content of a NOTICE file under Section 3.4 of this Agreement.
44
+ 5.3 If you or any of your Affiliates institutes or participates in any legal proceeding (including any cross-claim or counterclaim in a lawsuit) against us or any of our Affiliates, alleging that the Model or any output or any portion thereof infringes any intellectual property or other rights that you own or control, all licenses granted to you under this Agreement shall terminate automatically as of the date such proceeding is filed.
45
+
46
+ 6. Governing Law and Dispute Resolution
47
+ 6.1 This Agreement shall be governed by and construed in accordance with the laws of the People’s Republic of China.
48
+ 6.2 In the event of any dispute arising out of or in connection with this Agreement, the parties shall first attempt to resolve such dispute through friendly negotiation. If negotiation fails, the dispute shall be submitted to the Shanghai Arbitration Commission for arbitration in accordance with its then-effective arbitration rules. The arbitration award shall be final and binding on both parties. The prevailing party shall be entitled to recover reasonable costs, including notarization and investigation fees, arbitration costs, attorneys’ fees, and travel expenses.
49
+
50
+ 7. Severability
51
+ If any provision of this Agreement is held to be invalid or unenforceable, the remaining provisions shall remain in full force and effect. The invalid or unenforceable provision shall be replaced with a valid and enforceable provision that, to the maximum extent permitted by law, most closely reflects the original intent of the invalid or unenforceable provision.
52
+
53
+ 8. Version Updates
54
+ We may release new versions of the AI Model Use License Agreement. Any new version will apply only to Uses occurring after the date of its release. If you obtained the Model under an earlier version, the new version will not have retroactive effect; nevertheless, you are encouraged to adopt the new version voluntarily.
55
+
56
+ 9. Language Version
57
+ In the event of any discrepancy or conflict between the English-language version set forth above and the Chinese-language version of this bilibili Model Use License Agreement, the Chinese-language version shall prevail for all purposes and shall govern the rights and obligations of the parties.
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.5
2
+ Name: indextts25-inference
3
+ Version: 0.1.1
4
+ Summary: IndexTTS-2.5 inference library: zero-shot TTS with emotion, speed and streaming control
5
+ Project-URL: Homepage, https://github.com/nicokim/indextts25-inference
6
+ Project-URL: Upstream, https://github.com/index-tts/index-tts
7
+ Author: Bilibili IndexTTS Team
8
+ Maintainer: Kimox
9
+ License-Expression: LicenseRef-Bilibili-IndexTTS
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: einops>=0.8
24
+ Requires-Dist: huggingface-hub>=0.30
25
+ Requires-Dist: librosa>=0.10
26
+ Requires-Dist: nemo-text-processing>=1.1; sys_platform == 'linux' and platform_machine == 'x86_64' and python_version < '3.14'
27
+ Requires-Dist: numpy>=1.26
28
+ Requires-Dist: omegaconf>=2.3
29
+ Requires-Dist: pyyaml>=5.1
30
+ Requires-Dist: safetensors>=0.4.3
31
+ Requires-Dist: tiktoken>=0.7
32
+ Requires-Dist: torch>=2.8
33
+ Requires-Dist: transformers>=4.52
34
+ Provides-Extra: flash
35
+ Requires-Dist: flash-attn>=2.8.3; extra == 'flash'
36
+ Requires-Dist: triton>=3.0; extra == 'flash'
37
+ Provides-Extra: ja
38
+ Requires-Dist: fugashi>=1.2; extra == 'ja'
39
+ Requires-Dist: unidic-lite>=1.0; extra == 'ja'
40
+ Provides-Extra: zh
41
+ Requires-Dist: wetext>=0.1; (sys_platform != 'linux') and extra == 'zh'
42
+ Requires-Dist: wetextprocessing>=1.2; (sys_platform == 'linux') and extra == 'zh'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # indextts25-inference
46
+
47
+ [![CI](https://github.com/nicokim/indextts25-inference/actions/workflows/ci.yml/badge.svg)](https://github.com/nicokim/indextts25-inference/actions/workflows/ci.yml)
48
+ [![PyPI](https://img.shields.io/pypi/v/indextts25-inference)](https://pypi.org/project/indextts25-inference/)
49
+
50
+ Inference library for **IndexTTS-2.5**: zero-shot text-to-speech (voice cloning from one
51
+ reference clip) with emotion and speed control, and streaming that yields every audio chunk
52
+ together with the text that produced it.
53
+
54
+ It packages the inference code of [index-tts](https://github.com/index-tts/index-tts)
55
+ (commit `ee40fa7`) behind a small API, fixes a number of upstream bugs (several of them
56
+ changed what the model actually hears) and drops everything inference does not use, about
57
+ 80 % of the vendored code.
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ pip install indextts25-inference
63
+ ```
64
+
65
+ Python 3.10–3.13 and a CUDA GPU with about 6 GB of free VRAM. The weights are downloaded
66
+ separately; the `qwen0.6bemo4-merge/` text-emotion model in that repo is not used by this
67
+ library and can be skipped:
68
+
69
+ ```bash
70
+ hf download IndexTeam/IndexTTS-2.5 --local-dir=checkpoints --exclude "qwen0.6bemo4-merge/*"
71
+ ```
72
+
73
+ One-time costs on a fresh machine:
74
+
75
+ - **Auxiliary models.** w2v-bert-2.0, CAMPPlus and BigVGAN are read from
76
+ `checkpoints/hf_cache/` if they are there; otherwise only the files the library reads are
77
+ fetched into the standard Hugging Face cache. Set `HF_ENDPOINT` to use a mirror.
78
+ - **Text-normalization grammar.** The first synthesis in a language compiles NeMo's grammar
79
+ for it (about 25 s). It is cached in `~/.cache/indextts25/nemo_tn/` (or under
80
+ `$XDG_CACHE_HOME`), and later processes load it in under a second.
81
+
82
+ ### Optional extras
83
+
84
+ | extra | what it adds |
85
+ |---|---|
86
+ | `flash` | the accelerated GPT engine behind `attn_backend="flash"` (see [Backends](#backends) and [Recommended stack](#recommended-stack)) |
87
+ | `zh` | WeTextProcessing normalization for Chinese and English; without it, both use NeMo |
88
+ | `ja` | Japanese word segmentation (`fugashi` + `unidic-lite`), required for `lang="JA"` |
89
+
90
+ `nemo-text-processing` pins a `pynini` that only ships wheels for Linux x86_64 up to
91
+ CPython 3.13, so it is not installed elsewhere. Without it, text goes to the model
92
+ unnormalized and digits are read poorly: write numbers out, or install `pynini` from
93
+ conda-forge and then `nemo-text-processing`.
94
+
95
+ ## Usage
96
+
97
+ ```python
98
+ from indextts25 import IndexTTS25
99
+
100
+ tts = IndexTTS25(model_dir="checkpoints", attn_backend="flash")
101
+ tts.warm("voice.wav") # pay the one-time costs before the first real request
102
+
103
+ tts.synthesize("Hola, ¿cómo va?", voice="voice.wav", out="out.wav", speed=0.85)
104
+ ```
105
+
106
+ `lang` defaults to `"ES"`; the model also speaks `"EN"`, `"ZH"`, `"JA"` and `"AR"` (Arabic
107
+ text is not normalized). `warm()` runs one short synthesis: it extracts the voice
108
+ conditioning, loads the language's normalization grammar and, with `"flash"`, captures the
109
+ CUDA graph. Pass it `lang=` if you will not be synthesizing Spanish.
110
+
111
+ ### Streaming with synchronized text
112
+
113
+ Each chunk carries the text it was generated from, which is what subtitles or an on-screen
114
+ transcript need:
115
+
116
+ ```python
117
+ for chunk in tts.stream("A long text…", voice="voice.wav", lang="EN"):
118
+ play(chunk.audio) # float32 mono at 22050 Hz
119
+ show(chunk.text) # the segment that produced this audio
120
+ print(chunk.elapsed, chunk.duration)
121
+ ```
122
+
123
+ `chunk.text` is the model input, not your original string: it is normalized (numbers and
124
+ times spelled out) and, for Spanish, upper-cased. Text with nothing to pronounce (only
125
+ punctuation or emoji) yields no chunks, and `synthesize()` raises `ValueError` for it.
126
+ `include_silence=True` also yields the 200 ms pauses between segments.
127
+
128
+ `segment_tokens` (60 by default for streaming) sets latency and text granularity at the same
129
+ time: smaller segments return the first chunk sooner and give finer subtitles. Segments are
130
+ cut at punctuation and, when a stretch has none, between words.
131
+
132
+ ### Fine-tuned models
133
+
134
+ ```python
135
+ tts = IndexTTS25(model_dir="checkpoints", config="checkpoints/config_my_voice.yaml")
136
+ ```
137
+
138
+ A YAML with `gpt_checkpoint:` pointing at your weights. It works for a merged LoRA: the
139
+ resulting model has exactly the size and speed of the base one. Checkpoints are loaded
140
+ strictly, so a missing key is an error instead of silently leaving random weights.
141
+
142
+ ### Emotion and speed
143
+
144
+ ```python
145
+ tts.synthesize(text, voice="voice.wav", out="o.wav",
146
+ emotion="sad_reference.wav", emotion_strength=0.6,
147
+ speed=0.85) # <1 is faster; below 0.78 it saturates
148
+
149
+ # or an emotion vector instead of a reference clip, in the order
150
+ # [happy, angry, sad, afraid, disgusted, melancholic, surprised, calm]
151
+ tts.synthesize(text, voice="voice.wav", out="o.wav", emo_vector=[0, 0, 0.6, 0, 0, 0, 0, 0])
152
+ ```
153
+
154
+ With `emo_vector`, the weight left over (`1 - sum`) goes to the voice's own emotion, so keep
155
+ the sum at 0.8 or less; `emotion_strength` scales the vector. Voice and emotion conditioning
156
+ are cached per file (path and modification time), so alternating between a few references
157
+ costs nothing after the first use of each.
158
+
159
+ ### Generation knobs
160
+
161
+ `synthesize()` and `stream()` forward extra keyword arguments to the generator:
162
+ `temperature` (0.8), `top_p` (0.8), `top_k` (30), `num_beams` (3), `repetition_penalty` (10),
163
+ `do_sample` (True), `max_mel_tokens` (1500) and, for the diffusion stage, `diffusion_steps`
164
+ (25) and `inference_cfg_rate` (0.7). Fewer diffusion steps trade quality for latency.
165
+
166
+ ### Threads
167
+
168
+ An instance is not thread-safe: call it from one thread at a time, for example from a single
169
+ worker thread. Which thread does not matter, because the library leaves process-wide state
170
+ alone: it does not redirect `stdout`/`stderr`, install warning filters or set environment
171
+ variables, and it prints nothing unless you pass `verbose=True`.
172
+
173
+ ## Backends
174
+
175
+ | | `"sdpa"` (default) | `"flash"` |
176
+ |---|---|---|
177
+ | GPT engine | transformers `generate()` | own decoder: paged KV cache, each step replayed as a CUDA graph |
178
+ | decoding | beam sampling (3 beams by default) | sampling, a single beam |
179
+ | sampling knobs | repetition penalty, temperature, top-k, top-p | the same, applied in the same order |
180
+ | needs | nothing extra | a `flash-attn` wheel matching your torch and CUDA |
181
+
182
+ `"flash"` ignores `num_beams`. Measured below, it is faster and scores the same as `"sdpa"`
183
+ on intelligibility and speaker similarity.
184
+
185
+ ## Performance
186
+
187
+ RTX 5090 (driver 595, CUDA 13.2), Ryzen 9 9900X, torch 2.9.1+cu130, transformers 4.57.6;
188
+ medians of 5 runs of `scripts/benchmark.py` with a Spanish voice. The sentence has 49
189
+ characters and the paragraph 425 (34 s of audio); TTFA is the time to the first `stream()`
190
+ chunk.
191
+
192
+ | backend | version | load | warm | TTFA sentence | TTFA paragraph | paragraph | peak VRAM |
193
+ |---|---|---|---|---|---|---|---|
194
+ | sdpa | 0.1.0 | 9.3 s | 25.6 s | 1.23 s | 2.36 s | 8.94 s | 22.8 GB |
195
+ | sdpa | **0.2.0** | 3.0 s | 1.8 s | 0.85 s | 1.43 s | 6.17 s | 6.0 GB |
196
+ | sdpa + fp16 | 0.2.0 | 3.0 s | 1.8 s | 0.94 s | 1.54 s | 6.27 s | 4.3 GB |
197
+ | flash | 0.1.0 | 14.3 s | 25.7 s | 0.81 s | 1.64 s | 4.67 s | 25.3 GB |
198
+ | flash | **0.2.0** | 3.0 s | 1.9 s | 0.73 s | 1.16 s | 4.54 s | 6.3 GB |
199
+ | flash + fp16 | 0.2.0 | 3.2 s | 1.9 s | 0.72 s | 1.19 s | 4.56 s | 4.6 GB |
200
+
201
+ - `warm` is the first synthesis in a new process: 0.1.0 compiled the text-normalization
202
+ grammar every time, 0.2.0 loads it from its cache.
203
+ - The peak VRAM of 0.1.0 came mostly from autograd graphs kept alive in its voice cache.
204
+ - `fp16=True` runs the GPT in bf16: 1.7 GB less VRAM, but no faster (with `sdpa`, about
205
+ 0.1 s more to the first chunk).
206
+ - On the recommended stacks below, `sdpa` with torch 2.14.1 measured 0.89 s / 6.39 s
207
+ (TTFA sentence / paragraph) and `flash` with torch 2.10, 0.71 s / 4.30 s.
208
+
209
+ ## Recommended stack
210
+
211
+ **`"sdpa"`**: nothing to choose. A plain `pip install indextts25-inference` resolves to the
212
+ newest releases (torch 2.14.1 and transformers 5.20 at the time of writing), which are
213
+ tested.
214
+
215
+ **`"flash"`**: flash-attn ships only a source distribution on PyPI and prebuilt wheels on
216
+ GitHub for a few torch/CUDA/Python combinations. Install torch and the matching wheel
217
+ *before* the extra; otherwise pip tries to compile flash-attn. With an NVIDIA driver ≥ 580
218
+ (CUDA 13) and Python 3.12:
219
+
220
+ ```bash
221
+ pip install torch==2.10.0 --index-url https://download.pytorch.org/whl/cu130
222
+ pip install "https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.3/flash_attn-2.8.3+cu13torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl"
223
+ pip install "indextts25-inference[flash]"
224
+ ```
225
+
226
+ The newest CUDA 13 wheels are for torch 2.10; there are none for torch 2.11 or later. With
227
+ an older driver, or another Python version, use torch 2.8 (CUDA 12.8) and the
228
+ `cu12torch2.8` wheel for your Python from the
229
+ [v2.8.3.post1 release](https://github.com/Dao-AILab/flash-attention/releases/tag/v2.8.3.post1);
230
+ that is the minimum tested stack below.
231
+
232
+ ## Version compatibility
233
+
234
+ Each stack ran the benchmark and six cases (Spanish sentence, paragraph and stream,
235
+ English, Spanish with an emotion reference, Japanese) on the backends listed, and the audio
236
+ was checked with Whisper. With a fixed seed the minimum stack produces bit-identical Spanish
237
+ and Japanese audio to torch 2.9.1.
238
+
239
+ | Python | torch | transformers | flash-attn | backends |
240
+ |---|---|---|---|---|
241
+ | 3.11 | 2.8.0+cu128 | 4.52.1 | 2.8.3.post1 (cu12) | sdpa, flash |
242
+ | 3.12 | 2.9.1+cu130 | 4.57.6 | 2.8.3 (cu13) | sdpa, flash |
243
+ | 3.12 | 2.10.0+cu130 | 4.57.6 and 5.20.0 | 2.8.3 (cu13) | flash |
244
+ | 3.12 | 2.14.1+cu130 | 5.20.0 | — | sdpa |
245
+
246
+ Python 3.10 and 3.13 install and pass the CPU tests (torch 2.14.1). CUDA 13 builds of torch
247
+ need an NVIDIA driver ≥ 580.
248
+
249
+ ## Differences from upstream
250
+
251
+ **Text**
252
+
253
+ 1. **`nemo-text-processing` is a real dependency.** Upstream does not declare it although it
254
+ needs it for Spanish; without it normalization fails silently and digits reach the
255
+ tokenizer raw.
256
+ 2. **Normalization order.** Upstream applies its punctuation map (which turns `":"` into
257
+ `","`) *before* normalizing, so `14:30` was read "catorce **coma** treinta". It now runs
258
+ after NeMo ("catorce **y media**"); for zh/en the colon is left to the normalizer, so
259
+ "8:00 AM" is no longer "eight, zero AM".
260
+ 3. **Exclamation marks reach the model.** In this tokenizer `"!"` has id 0, the same as the
261
+ start-of-text token, and upstream's padding filter deleted every one of them.
262
+ 4. English and Chinese without WeTextProcessing fall back to NeMo instead of being
263
+ normalized to an empty string (which synthesized about 2 s of noise). With `lang="EN"`,
264
+ text without letters is no longer routed to the Chinese normalizer.
265
+ 5. A stretch of text without punctuation is split between words, never inside one.
266
+
267
+ **Generation**
268
+
269
+ 6. **Mel positions.** Generated code *k* now gets mel position *k*, as in training; upstream
270
+ was off by one, which costs about 0.5 nats per token of likelihood on real audio.
271
+ 7. **No stray stop token.** Upstream appended an extra stop token to every segment; it became
272
+ left padding, and the `flash` engine attended to it.
273
+ 8. **`flash` samples like transformers.** It applies repetition penalty, temperature, top-k and
274
+ top-p; upstream's engine sampled with temperature alone.
275
+
276
+ Together, 3 and 6–8 (plus the GELU kernel in 14) take `flash` from 3.2 % WER and 0.899
277
+ speaker similarity to 2.4 % and 0.908, on par with `sdpa` (2.4 %, 0.907 before and
278
+ after): 48 utterances (20 Spanish and 4 English sentences, two seeds), Whisper
279
+ large-v3-turbo for WER, CAMPPlus cosine for similarity.
280
+ 9. The `flash` engine works with transformers 5.x (it has its own block forward), and so
281
+ does `sdpa` on 5.x releases that stopped passing an attention mask.
282
+ 10. Fixed two `flash` crashes: a false prefix-cache hit with segments of 250+ tokens, and
283
+ sequences longer than 2048 tokens.
284
+
285
+ **Memory and speed**
286
+
287
+ 11. **No autograd.** Upstream computes the CAMPPlus style and the prompt condition with
288
+ autograd on and keeps their graphs alive in its voice cache.
289
+ 12. Weights inference never uses are not loaded: w2v-bert layers 18–24, the GPT text head,
290
+ the codec encoder, and the second copy of the GPT that the `flash` engine used to make.
291
+ 13. Models are built directly on the GPU from memory-mapped checkpoints, with weight norm
292
+ folded at load time.
293
+ 14. The GPT uses the fused tanh-GELU kernel (`gelu_pytorch_tanh`, same formula as
294
+ `gelu_new`): 5–6 % faster.
295
+ 15. The emotion vector of a (voice, emotion, strength) triple is computed once and reused.
296
+
297
+ **Library hygiene**
298
+
299
+ 16. **No global side effects.** Upstream sets `HF_HUB_CACHE` (relative to the working
300
+ directory) and silences every `FutureWarning` and `UserWarning` on import; its prints are
301
+ behind `verbose` here. The only global change left is lowering NeMo's and
302
+ WeTextProcessing's loggers, which both set to INFO with their own handler, to WARNING.
303
+ 17. `attn_backend` by name instead of a `use_accel` boolean; streaming yields `(audio, text)`.
304
+ 18. Packaged without IndexTTS-2.0, MaskGCT, training and web-UI code, and without
305
+ `openai-whisper`, `torchaudio`, `munch`, `matplotlib` or `modelscope`. The auxiliary
306
+ download fetches only the files it reads (2.5 GB less on a fresh install).
307
+
308
+ ## Development
309
+
310
+ ```bash
311
+ pip install -e . pytest
312
+ pytest # fast checks: CPU, no weights
313
+ INDEXTTS25_MODEL_DIR=checkpoints INDEXTTS25_VOICE=voice.wav pytest # + end to end on GPU
314
+ python scripts/benchmark.py --voice voice.wav --backend flash # the numbers above
315
+ ```
316
+
317
+ ## License
318
+
319
+ Bilibili Model Use License Agreement — see `LICENSE`. This library is a derivative work;
320
+ its modifications are not endorsed or guaranteed by the original authors.