nonebot-plugin-vits-tts


Namenonebot-plugin-vits-tts JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/Redmomn/nonebot-plugin-vits-tts
Summarynonebot-plugin-vits-tts
upload_time2024-04-30 10:14:47
maintainerNone
docs_urlNone
authorRedmomn
requires_pythonNone
licenseApache-2.0
keywords nonebot2 vits tts
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://v2.nonebot.dev/"><img src="https://v2.nonebot.dev/logo.png" width="200" height="200" alt="nonebot"></a>
</p>

<div align="center">

# nonebot-plugin-vits-tts

✨ 基于vits的nonebot语音合成插件 ✨

<p align="center">
  <a href="https://github.com/Redmomn/nonebot-plugin-vits-tts/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/Redmomn/nonebot-plugin-vits-tts.svg" alt="license">
  </a>
  <img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="Python">
  <a href="https://pypi.org/project/nonebot-plugin-vits-tts">
    <img src="https://badgen.net/pypi/v/nonebot-plugin-vits-tts" alt="pypi">
  </a>
</p>

</div>

## 📖 介绍

基于vits的tts语音生成,适配onebot v11协议  
已兼容pydantic v1&v2

## 💿 安装

<details open>
<summary>nb-cli</summary>

    nb plugin install nonebot-plugin-vits-tts

</details>

<details open>
<summary>pip</summary>

    pip install nonebot_plugin_vits_tts

</details>

## ⚙️ 配置

| 配置项                         | 类型    | 默认值       | 说明                                                                    |
|-----------------------------|-------|-----------|-----------------------------------------------------------------------|
| VITS__DEVICE                | int   | 0         | 使用指定的cuda设备进行tts合成,如果指定的设备不存在会自动使用cpu进行推理                             |
| VITS__VMODEL_PATH           | str   | models    | 插件会读取此文件夹下的所有模型                                                       |
| VITS__AT_BOT                | bool  | false     | 使用语音合成是否需要@bot                                                        |
| VITS__COOLDOWN              | int   | 0         | 在每个群里生成语音的冷却时间,防止设备负载过大                                               |
| VITS__VMODEL_FILE_NAME      | str   | model.pth | 模型文件名                                                                 |
| VITS__CONFIG_FILE_NAME      | str   | config    | 模型配置文件                                                                |
| VITS__TENCENT_SECRET_ID     | str   |           | 腾讯云机器翻译SECRET_ID,用于语种识别                                               |
| VITS__TENCENT_SECRET_KEY    | str   |           | 腾讯云机器翻译SECRET_KEY,这两项不配置或者配置不正确会使用langdetect库进行语种识别,使用langdetect准确率较低 |
| VITS__DEFAULT_LENGTH_SCALE  | float | 1         | 整体语速                                                                  |
| VITS__DEFAULT_NOISE_SCALE   | float | 0.667     | 感情变化程度                                                                |
| VITS__DEFAULT_NOISE_SCALE_W | float | 0.6       | 音素发音长度                                                                |
| VITS__AUDIO_CONVERT_TO_MP3  | bool  | false     | 是否将语音转换为mp3格式,默认为wav格式,如果设置为true,需要在设备上安装ffmpeg                       |

假如你的项目配置是这样,则`VITS__VMODEL_PATH`应为`models`,`VITS__VMODEL_FILE_NAME`为`model.pth`,`VITS__CONFIG_FILE_NAME`
为`config.json`

```text
awsomebot
├─ .env
├─ .env.dev
├─ .env.prod
├─ .gitignore
├─ README.md
├─ models
│    ├─ model1
│    │    ├─ config.json
│    │    └─ model.pth
│    └─ model2
│           ├─ config.json
│           └─ model.pth
├─ pyproject.toml
└─ src
   └─ plugins
      └─ ...

```

**注意**  
所有的模型文件名应为`VITS__VMODEL_FILE_NAME`的值,配置文件名应为`VITS__CONFIG_FILE_NAME`的值,一个文件夹只允许放一个模型和配置文件,
不同模型使用文件夹分割开来,插件会自动加载所有文件夹下的模型

**使用cuda设备合成音频**

- 安装合适版本的[cuda-toolkit](https://developer.nvidia.com/cuda-toolkit)
- 需要手动安装GPU版本的pytorch,详见[Pytorch](https://pytorch.org/get-started/locally/)

## 🎉 使用

仅可以在群聊中使用  
使用方法:

- `[角色]说[要合成的文本]`  
  例如:

    - 宁宁说私のオナニを見てください
- 发送`/help` 可以获取可用角色列表

目前仅支持简体中文,日语,英文,插件会自动识别要合成文本的语种

## 模型分享

由我自己训练的模型,目前有以下几个galgame的模型  
[ATRI](https://huggingface.co/Redmonm/ATRI),
[RiddleJoker](https://huggingface.co/Redmonm/RiddleJoker),
[千恋万花](https://huggingface.co/Redmonm/SenrenBanka),
[魔女的夜宴](https://huggingface.co/Redmonm/SanobaWitch),
[星光咖啡馆与死神之蝶](https://huggingface.co/Redmonm/CafeStella)

模型不定期更新,可前往我的[huggingface主页](https://huggingface.co/Redmonm)查看

## 💡 感谢

- 此插件基于[Plachtaa/VITS-fast-fine-tuning](https://github.com/Plachtaa/VITS-fast-fine-tuning)的代码改进而来

## 关于模型训练

Plachtaa/VITS-fast-fine-tuning的[笔记本](https://colab.research.google.com/drive/1pn1xnFfdLK63gVXDwV4zCXfVeo8c-I-0?usp=sharing)  
另外还提供一个我改进过的[笔记本](https://colab.research.google.com/drive/1Uf-ngOqUiDXCPbsm122w56y6nuWiWcnu?usp=sharing)
,这个笔记本只保存最新的模型文件,不会将训练的中间文件保存到云盘导致云盘爆掉不能训练

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Redmomn/nonebot-plugin-vits-tts",
    "name": "nonebot-plugin-vits-tts",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "nonebot2, vits, tts",
    "author": "Redmomn",
    "author_email": "109732988+Redmomn@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/c4/3d/07dc50301f451eecdc672f656eeaeb772abd6049fe666f139abbe039c72b/nonebot_plugin_vits_tts-0.1.7.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://v2.nonebot.dev/\"><img src=\"https://v2.nonebot.dev/logo.png\" width=\"200\" height=\"200\" alt=\"nonebot\"></a>\n</p>\n\n<div align=\"center\">\n\n# nonebot-plugin-vits-tts\n\n\u2728 \u57fa\u4e8evits\u7684nonebot\u8bed\u97f3\u5408\u6210\u63d2\u4ef6 \u2728\n\n<p align=\"center\">\n  <a href=\"https://github.com/Redmomn/nonebot-plugin-vits-tts/blob/master/LICENSE\">\n    <img src=\"https://img.shields.io/github/license/Redmomn/nonebot-plugin-vits-tts.svg\" alt=\"license\">\n  </a>\n  <img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"Python\">\n  <a href=\"https://pypi.org/project/nonebot-plugin-vits-tts\">\n    <img src=\"https://badgen.net/pypi/v/nonebot-plugin-vits-tts\" alt=\"pypi\">\n  </a>\n</p>\n\n</div>\n\n## \ud83d\udcd6 \u4ecb\u7ecd\n\n\u57fa\u4e8evits\u7684tts\u8bed\u97f3\u751f\u6210\uff0c\u9002\u914donebot v11\u534f\u8bae  \n\u5df2\u517c\u5bb9pydantic v1&v2\n\n## \ud83d\udcbf \u5b89\u88c5\n\n<details open>\n<summary>nb-cli</summary>\n\n    nb plugin install nonebot-plugin-vits-tts\n\n</details>\n\n<details open>\n<summary>pip</summary>\n\n    pip install nonebot_plugin_vits_tts\n\n</details>\n\n## \u2699\ufe0f \u914d\u7f6e\n\n| \u914d\u7f6e\u9879                         | \u7c7b\u578b    | \u9ed8\u8ba4\u503c       | \u8bf4\u660e                                                                    |\n|-----------------------------|-------|-----------|-----------------------------------------------------------------------|\n| VITS__DEVICE                | int   | 0         | \u4f7f\u7528\u6307\u5b9a\u7684cuda\u8bbe\u5907\u8fdb\u884ctts\u5408\u6210\uff0c\u5982\u679c\u6307\u5b9a\u7684\u8bbe\u5907\u4e0d\u5b58\u5728\u4f1a\u81ea\u52a8\u4f7f\u7528cpu\u8fdb\u884c\u63a8\u7406                             |\n| VITS__VMODEL_PATH           | str   | models    | \u63d2\u4ef6\u4f1a\u8bfb\u53d6\u6b64\u6587\u4ef6\u5939\u4e0b\u7684\u6240\u6709\u6a21\u578b                                                       |\n| VITS__AT_BOT                | bool  | false     | \u4f7f\u7528\u8bed\u97f3\u5408\u6210\u662f\u5426\u9700\u8981@bot                                                        |\n| VITS__COOLDOWN              | int   | 0         | \u5728\u6bcf\u4e2a\u7fa4\u91cc\u751f\u6210\u8bed\u97f3\u7684\u51b7\u5374\u65f6\u95f4\uff0c\u9632\u6b62\u8bbe\u5907\u8d1f\u8f7d\u8fc7\u5927                                               |\n| VITS__VMODEL_FILE_NAME      | str   | model.pth | \u6a21\u578b\u6587\u4ef6\u540d                                                                 |\n| VITS__CONFIG_FILE_NAME      | str   | config    | \u6a21\u578b\u914d\u7f6e\u6587\u4ef6                                                                |\n| VITS__TENCENT_SECRET_ID     | str   |           | \u817e\u8baf\u4e91\u673a\u5668\u7ffb\u8bd1SECRET_ID\uff0c\u7528\u4e8e\u8bed\u79cd\u8bc6\u522b                                               |\n| VITS__TENCENT_SECRET_KEY    | str   |           | \u817e\u8baf\u4e91\u673a\u5668\u7ffb\u8bd1SECRET_KEY\uff0c\u8fd9\u4e24\u9879\u4e0d\u914d\u7f6e\u6216\u8005\u914d\u7f6e\u4e0d\u6b63\u786e\u4f1a\u4f7f\u7528langdetect\u5e93\u8fdb\u884c\u8bed\u79cd\u8bc6\u522b\uff0c\u4f7f\u7528langdetect\u51c6\u786e\u7387\u8f83\u4f4e |\n| VITS__DEFAULT_LENGTH_SCALE  | float | 1         | \u6574\u4f53\u8bed\u901f                                                                  |\n| VITS__DEFAULT_NOISE_SCALE   | float | 0.667     | \u611f\u60c5\u53d8\u5316\u7a0b\u5ea6                                                                |\n| VITS__DEFAULT_NOISE_SCALE_W | float | 0.6       | \u97f3\u7d20\u53d1\u97f3\u957f\u5ea6                                                                |\n| VITS__AUDIO_CONVERT_TO_MP3  | bool  | false     | \u662f\u5426\u5c06\u8bed\u97f3\u8f6c\u6362\u4e3amp3\u683c\u5f0f\uff0c\u9ed8\u8ba4\u4e3awav\u683c\u5f0f\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3atrue\uff0c\u9700\u8981\u5728\u8bbe\u5907\u4e0a\u5b89\u88c5ffmpeg                       |\n\n\u5047\u5982\u4f60\u7684\u9879\u76ee\u914d\u7f6e\u662f\u8fd9\u6837\uff0c\u5219`VITS__VMODEL_PATH`\u5e94\u4e3a`models`\uff0c`VITS__VMODEL_FILE_NAME`\u4e3a`model.pth`\uff0c`VITS__CONFIG_FILE_NAME`\n\u4e3a`config.json`\n\n```text\nawsomebot\n\u251c\u2500 .env\n\u251c\u2500 .env.dev\n\u251c\u2500 .env.prod\n\u251c\u2500 .gitignore\n\u251c\u2500 README.md\n\u251c\u2500 models\n\u2502    \u251c\u2500 model1\n\u2502    \u2502    \u251c\u2500 config.json\n\u2502    \u2502    \u2514\u2500 model.pth\n\u2502    \u2514\u2500 model2\n\u2502           \u251c\u2500 config.json\n\u2502           \u2514\u2500 model.pth\n\u251c\u2500 pyproject.toml\n\u2514\u2500 src\n   \u2514\u2500 plugins\n      \u2514\u2500 ...\n\n```\n\n**\u6ce8\u610f**  \n\u6240\u6709\u7684\u6a21\u578b\u6587\u4ef6\u540d\u5e94\u4e3a`VITS__VMODEL_FILE_NAME`\u7684\u503c\uff0c\u914d\u7f6e\u6587\u4ef6\u540d\u5e94\u4e3a`VITS__CONFIG_FILE_NAME`\u7684\u503c\uff0c\u4e00\u4e2a\u6587\u4ef6\u5939\u53ea\u5141\u8bb8\u653e\u4e00\u4e2a\u6a21\u578b\u548c\u914d\u7f6e\u6587\u4ef6\uff0c\n\u4e0d\u540c\u6a21\u578b\u4f7f\u7528\u6587\u4ef6\u5939\u5206\u5272\u5f00\u6765\uff0c\u63d2\u4ef6\u4f1a\u81ea\u52a8\u52a0\u8f7d\u6240\u6709\u6587\u4ef6\u5939\u4e0b\u7684\u6a21\u578b\n\n**\u4f7f\u7528cuda\u8bbe\u5907\u5408\u6210\u97f3\u9891**\n\n- \u5b89\u88c5\u5408\u9002\u7248\u672c\u7684[cuda-toolkit](https://developer.nvidia.com/cuda-toolkit)\n- \u9700\u8981\u624b\u52a8\u5b89\u88c5GPU\u7248\u672c\u7684pytorch\uff0c\u8be6\u89c1[Pytorch](https://pytorch.org/get-started/locally/)\n\n## \ud83c\udf89 \u4f7f\u7528\n\n\u4ec5\u53ef\u4ee5\u5728\u7fa4\u804a\u4e2d\u4f7f\u7528  \n\u4f7f\u7528\u65b9\u6cd5\uff1a\n\n- `[\u89d2\u8272]\u8bf4[\u8981\u5408\u6210\u7684\u6587\u672c]`  \n  \u4f8b\u5982\uff1a\n\n    - \u5b81\u5b81\u8bf4\u79c1\u306e\u30aa\u30ca\u30cb\u3092\u898b\u3066\u304f\u3060\u3055\u3044\n- \u53d1\u9001`/help` \u53ef\u4ee5\u83b7\u53d6\u53ef\u7528\u89d2\u8272\u5217\u8868\n\n\u76ee\u524d\u4ec5\u652f\u6301\u7b80\u4f53\u4e2d\u6587\uff0c\u65e5\u8bed\uff0c\u82f1\u6587\uff0c\u63d2\u4ef6\u4f1a\u81ea\u52a8\u8bc6\u522b\u8981\u5408\u6210\u6587\u672c\u7684\u8bed\u79cd\n\n## \u6a21\u578b\u5206\u4eab\n\n\u7531\u6211\u81ea\u5df1\u8bad\u7ec3\u7684\u6a21\u578b\uff0c\u76ee\u524d\u6709\u4ee5\u4e0b\u51e0\u4e2agalgame\u7684\u6a21\u578b  \n[ATRI](https://huggingface.co/Redmonm/ATRI)\uff0c\n[RiddleJoker](https://huggingface.co/Redmonm/RiddleJoker)\uff0c\n[\u5343\u604b\u4e07\u82b1](https://huggingface.co/Redmonm/SenrenBanka)\uff0c\n[\u9b54\u5973\u7684\u591c\u5bb4](https://huggingface.co/Redmonm/SanobaWitch)\uff0c\n[\u661f\u5149\u5496\u5561\u9986\u4e0e\u6b7b\u795e\u4e4b\u8776](https://huggingface.co/Redmonm/CafeStella)\n\n\u6a21\u578b\u4e0d\u5b9a\u671f\u66f4\u65b0\uff0c\u53ef\u524d\u5f80\u6211\u7684[huggingface\u4e3b\u9875](https://huggingface.co/Redmonm)\u67e5\u770b\n\n## \ud83d\udca1 \u611f\u8c22\n\n- \u6b64\u63d2\u4ef6\u57fa\u4e8e[Plachtaa/VITS-fast-fine-tuning](https://github.com/Plachtaa/VITS-fast-fine-tuning)\u7684\u4ee3\u7801\u6539\u8fdb\u800c\u6765\n\n## \u5173\u4e8e\u6a21\u578b\u8bad\u7ec3\n\nPlachtaa/VITS-fast-fine-tuning\u7684[\u7b14\u8bb0\u672c](https://colab.research.google.com/drive/1pn1xnFfdLK63gVXDwV4zCXfVeo8c-I-0?usp=sharing)  \n\u53e6\u5916\u8fd8\u63d0\u4f9b\u4e00\u4e2a\u6211\u6539\u8fdb\u8fc7\u7684[\u7b14\u8bb0\u672c](https://colab.research.google.com/drive/1Uf-ngOqUiDXCPbsm122w56y6nuWiWcnu?usp=sharing)\n\uff0c\u8fd9\u4e2a\u7b14\u8bb0\u672c\u53ea\u4fdd\u5b58\u6700\u65b0\u7684\u6a21\u578b\u6587\u4ef6\uff0c\u4e0d\u4f1a\u5c06\u8bad\u7ec3\u7684\u4e2d\u95f4\u6587\u4ef6\u4fdd\u5b58\u5230\u4e91\u76d8\u5bfc\u81f4\u4e91\u76d8\u7206\u6389\u4e0d\u80fd\u8bad\u7ec3\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "nonebot-plugin-vits-tts",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/Redmomn/nonebot-plugin-vits-tts"
    },
    "split_keywords": [
        "nonebot2",
        " vits",
        " tts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a2f39d03795716616836f5caeffa2cdf21c367bf5b373b6aef2c51d5b5a6cf7",
                "md5": "6221ca1680bbff057ed54aee99a045b7",
                "sha256": "4618ed7aef2ff5853f5e12e797c3e5f82d0ab90db6a7bbbe6949e65c2df8218a"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_vits_tts-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6221ca1680bbff057ed54aee99a045b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 50315,
            "upload_time": "2024-04-30T10:14:46",
            "upload_time_iso_8601": "2024-04-30T10:14:46.445471Z",
            "url": "https://files.pythonhosted.org/packages/4a/2f/39d03795716616836f5caeffa2cdf21c367bf5b373b6aef2c51d5b5a6cf7/nonebot_plugin_vits_tts-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c43d07dc50301f451eecdc672f656eeaeb772abd6049fe666f139abbe039c72b",
                "md5": "af6a51f58f00ec3bc384857fa5ab680c",
                "sha256": "cb23714f2de89d64bb3a6a85ca41b30dcf51761bb2d4adb1f2375b694f418426"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_vits_tts-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "af6a51f58f00ec3bc384857fa5ab680c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 43328,
            "upload_time": "2024-04-30T10:14:47",
            "upload_time_iso_8601": "2024-04-30T10:14:47.655460Z",
            "url": "https://files.pythonhosted.org/packages/c4/3d/07dc50301f451eecdc672f656eeaeb772abd6049fe666f139abbe039c72b/nonebot_plugin_vits_tts-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 10:14:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Redmomn",
    "github_project": "nonebot-plugin-vits-tts",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "nonebot-plugin-vits-tts"
}
        
Elapsed time: 0.27129s