{"id":18654351,"url":"https://github.com/llmkira/vitsserver","last_synced_at":"2025-04-05T20:05:49.460Z","repository":{"id":250041562,"uuid":"624800877","full_name":"LlmKira/VitsServer","owner":"LlmKira","description":"🌻 VITS ONNX TTS server designed for fast inference 🔥 ","archived":false,"fork":false,"pushed_at":"2025-02-01T13:51:19.000Z","size":2284,"stargazers_count":127,"open_issues_count":3,"forks_count":7,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T19:02:51.297Z","etag":null,"topics":["onnx","onnxruntime","so-vits-svc","tts","tts-api","vits"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LlmKira.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-07T09:37:25.000Z","updated_at":"2025-03-26T04:24:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d090564-fbe4-44e8-a629-6b62b528acb6","html_url":"https://github.com/LlmKira/VitsServer","commit_stats":null,"previous_names":["llmkira/vitsserver"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LlmKira%2FVitsServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LlmKira%2FVitsServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LlmKira%2FVitsServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LlmKira%2FVitsServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LlmKira","download_url":"https://codeload.github.com/LlmKira/VitsServer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393568,"owners_count":20931812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["onnx","onnxruntime","so-vits-svc","tts","tts-api","vits"],"created_at":"2024-11-07T07:14:44.557Z","updated_at":"2025-04-05T20:05:49.443Z","avatar_url":"https://github.com/LlmKira.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![cover.png](docs/cover.png)\n\n[![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-BSD3-green)](LICENSE)\n[![Docker](https://github.com/LlmKira/VitsServer/actions/workflows/docker-latest.yaml/badge.svg)](https://github.com/LlmKira/VitsServer/actions/workflows/docker-latest.yaml)\n------\n\n# Vits-Server 🔥\n\n⚡ A VITS ONNX server designed for fast inference, supporting streaming and additional inference settings to enable model\npreference settings and optimize performance.\n\n## 🧪 Experimental purposes only\n\nThis project is for experimental purposes only.\n\n**If you are looking for a production-ready TTS implementation, go to https://github.com/RVC-Boss/GPT-SoVITS**\n\n## Advantages 💪\n\n- [x] Long Voice Generation, Support Streaming. 长语音批次推理合并。\n- [x] Automatic language type parsing for text, eliminating the need for language recognition segmentation.\n  自动识别语言类型并处理一切。\n- [x] Supports multiple audio formats, including ogg, wav, flac, and silk. 多格式返回写入。\n- [x] Multiple models, streaming inference. 多模型初始化。\n- [x] Additional inference settings to enable model preference settings and optimize performance. 额外的推理设置，启用模型偏好设置。\n- [x] Auto Convert PTH to ONNX. 自动转换pth到onnx。\n- [ ] Support for multiple languages, including Chinese, English, Japanese, and Korean. 多语言多模型合并支持（任务批次分发到不同模型）。\n\n## API Documentation 📖\n\nWe offer out-of-the-box call systems.\n\n- [Python SDK](docs/sdk.py)\n- [JavaScript SDK](docs/sdk.js)\n\n```python\nclient = VITS(\"http://127.0.0.1:9557\")\nres = client.generate_voice(model_id=\"model_01\", text=\"你好，世界！\", speaker_id=0, audio_type=\"wav\",\n                            length_scale=1.0, noise_scale=0.5, noise_scale_w=0.5, auto_parse=True)\nwith open(\"output.wav\", \"wb\") as f:\n    for chunk in res.iter_content(chunk_size=1024):\n        if chunk:\n            f.write(chunk)\n```\n\n## Running 🏃\n\nWe recommend using a virtual environment to isolate the runtime environment. Because this project's dependencies may\npotentially disrupt your dependency library, we recommend using `pipenv` to manage the dependency package.\n\n### Config Server 🐚\n\nConfiguration is in `.env`, including the following fields:\n\n```dotenv\nVITS_SERVER_HOST=0.0.0.0\nVITS_SERVER_PORT=9557\nVITS_SERVER_RELOAD=false\n# VITS_SERVER_WORKERS=1\n# VITS_SERVER_INIT_CONFIG=\"https://....json\"\n# VITS_SERVER_INIT_MODEL=\"https://.....pth or onnx\"\n```\n\nor you can use the following command to set the environment variable:\n\n```shell\nexport VITS_SERVER_HOST=\"0.0.0.0\"\nexport VITS_SERVER_PORT=\"9557\"\nexport VITS_SERVER_RELOAD=\"false\"\nexport VITS_DISABLE_GPU=\"false\"\n\n```\n\n`VITS_SERVER_RELOAD` means auto restart server when file changed.\n\n### Running from pipenv 🐍 and pm2.json 🚀\n\n```shell\napt-get update \u0026\u0026\n  apt-get install -y build-essential libsndfile1 vim gcc g++ cmake\napt install python3-pip\npip3 install pipenv\npipenv install  # Create and install dependency packages\npipenv shell    # Activate the virtual environment\npython3 main.py # Run\n# then ctrl+c exit\n```\n\n```shell\napt install npm\nnpm install pm2 -g\npm2 start pm2.json\n# then the server will run in the background\n\n```\n\nand we have a one-click script to install `pipenv` and `npm`:\n\n```shell\ncurl -LO https://raw.githubusercontent.com/LlmKira/VitsServer/main/deploy_script.sh \u0026\u0026 chmod +x deploy_script.sh \u0026\u0026 ./deploy_script.sh\n\n```\n\n### Building from Docker 🐋\n\nwe have `docker pull sudoskys/vits-server:main` to docker hub.\n\nyou can also build from Dockerfile.\n\n```shell\ndocker build -t \u003cimage-name\u003e .\n```\n\nwhere `\u003cimage-name\u003e` is the name you want to give to the image. Then, use the following command to start the container:\n\n```shell\ndocker run -d -p 9557:9557 -v \u003clocal-path\u003e/vits_model:/app/model \u003cimage-name\u003e\n```\n\nwhere `\u003clocal-path\u003e` is the local folder path you want to map to the /app/model directory in the container.\n\n## Model Configuration 📁\n\nIn the `model` folder, place the `model.pth`/ `model.onnx` and corresponding `model.json` files. If it is `.pth`, it\nwill be automatically converted to `.onnx`!\n\nyou can use `.env` to set `VITS_SERVER_INIT_CONFIG` and `VITS_SERVER_INIT_MODEL` to download model files.\n\n```dotenv\nVITS_SERVER_INIT_CONFIG=\"https://....json\"\nVITS_SERVER_INIT_MODEL=\"https://.....pth?trace=233 or onnx?trace=233\"\n```\n\n`model` folder structure:\n\n```\n.\n├── 1000_epochs.json\n├── 1000_epochs.onnx\n├── 1000_epochs.pth\n├── 233_epochs.json\n├── 233_epochs.onnx\n└── 233_epochs.pth\n```\n\n`Model ID` is `1000_epochs` and `233_epochs`.\n\n**when you put model files in the `model` folder, you should restart the server.**\n\n### Model Extension Design 🔍\n\nYou can add extra fields in the model configuration to obtain information such as the model name corresponding to the\nmodel ID through the API.\n\n```json5\n{\n  //...\n  \"info\": {\n    \"name\": \"coco\",\n    \"description\": \"a vits model\",\n    \"author\": \"someone\",\n    \"cover\": \"https://xxx.com/xxx.jpg\",\n    \"email\": \"xx@ws.com\"\n  },\n  \"infer\": {\n    \"noise_scale\": 0.667,\n    \"length_scale\": 1.0,\n    \"noise_scale_w\": 0.8\n  }\n  //....\n}\n```\n\n`infer` is the default(prefer) inference settings for the model.\n\n`info` is the model information.\n\n### How can I retrieve these model information?\n\nYou can access `{your_base_url}/model/list?show_speaker=True\u0026show_ms_config=True` to obtain detailed information about\nmodel roles and configurations.\n\n## TODO 📝\n\n- [ ] Test Silk format\n- [x] Docker for automatic deployment\n- [x] Shell script for automatic deployment\n\n## Acknowledgements 🙏\n\nWe would like to acknowledge the contributions of the following projects in the development of this project:\n\n- MoeGoe: https://github.com/CjangCjengh/MoeGoe\n- vits_with_chatbot: https://huggingface.co/Mahiruoshi/vits_with_chatbot\n- vits: https://huggingface.co/spaces/Plachta/VITS-Umamusume-voice-synthesizer\n- espnet: https://github.com/espnet/espnet_onnx\n- onnxruntime: https://onnxruntime.ai/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllmkira%2Fvitsserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllmkira%2Fvitsserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllmkira%2Fvitsserver/lists"}