{"id":128,"date":"2025-02-12T11:11:00","date_gmt":"2025-02-12T03:11:00","guid":{"rendered":"http:\/\/blog.sayoung.xyz\/?p=128"},"modified":"2026-02-10T15:27:55","modified_gmt":"2026-02-10T07:27:55","slug":"%e5%ad%a6%e4%b9%a0%e6%97%a5%e5%bf%97%e7%bb%93%e5%90%88gpt-sovites%e4%b8%8ellm%ef%bc%881%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.sayoung.wang\/index.php\/2025\/02\/12\/%e5%ad%a6%e4%b9%a0%e6%97%a5%e5%bf%97%e7%bb%93%e5%90%88gpt-sovites%e4%b8%8ellm%ef%bc%881%ef%bc%89\/","title":{"rendered":"\u5b66\u4e60\u65e5\u5fd7|\u7ed3\u5408GPT-SoVites\u4e0eLLM\uff081\uff09"},"content":{"rendered":"\n<p>\u6700\u8fd1\u6362\u4e86\u7535\u8111\uff0c\u7ec8\u4e8e\u53ef\u4ee5\u8bd5\u8bd5GSV\u548cRVC\u4e86\u3002\u5728\u7b80\u5355\u4f53\u9a8c\u4e00\u756a\u540e\uff0c\u840c\u751f\u4e86\u5c06\u5176\u4e0eLLM\u7ed3\u5408\u8d77\u6765\u7684\u60f3\u6cd5\u3002 <hm>\uff08\u6bd5\u7adf\u8c01\u4e0d\u60f3\u8ba9AI\u7528\u81ea\u5df1\u559c\u7231\u7684\u865a\u62df\u89d2\u8272\u7684\u58f0\u97f3\u8bf4\u8bdd\u5462<\/hm><\/p>\n\n\n\n<p>\u5b9e\u73b0\u65b9\u6cd5\u4e5f\u7b80\u5355\uff0c\u5b98\u65b9\u5df2\u7ecf\u63d0\u4f9b\u4e86API\uff0c\u53ea\u9700\u8981\u628aLLM\u8f93\u51fa\u7684\u8bdd\u7528\u5b83\u5904\u7406\u4e00\u904d\u5c31\u597d\u4e86\u3002\uff08\u5f53\u7136\uff0c\u8003\u8651\u5230TTS\u9700\u8981\u6d88\u8017\u4e00\u5b9a\u65f6\u95f4\uff0c\u8fd8\u9700\u8981\u5bf9\u53e5\u5b50\u8fdb\u884c\u62c6\u5206\uff0c\u5206\u6bb5\u8fdb\u884c\u6d41\u5f0f\u8f93\u51fa\u3002\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">API<\/h2>\n\n\n\n<p>\u4ee5v2\u7248\u672c\u4e3a\u4f8b\uff0c\u8981\u60f3\u4f7f\u7528GSV\u7684API\uff0c\u9996\u5148\u8981\u8fd0\u884c\u5176\u6839\u76ee\u5f55\u4e0b\u7684api_v2.py\u6587\u4ef6\u3002\u9700\u8981\u5728\u6839\u76ee\u5f55\u4e0b\u6253\u5f00CMD\uff0c\u7136\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nruntime\\python api_v2.py -a 127.0.0.1 -p 9880 -c GPT_SoVITS\/configs\/tts_infer.yaml\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>-a<\/strong> &#8211; \u7ed1\u5b9a\u5730\u5740, \u9ed8\u8ba4&#8221;127.0.0.1&#8243;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>-p<\/strong> &#8211; \u7ed1\u5b9a\u7aef\u53e3, \u9ed8\u8ba49880<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>-c<\/strong>&#8211; TTS\u914d\u7f6e\u6587\u4ef6\u8def\u5f84, \u9ed8\u8ba4&#8221;GPT_SoVITS\/configs\/tts_infer.yaml&#8221;<\/li>\n<\/ul>\n\n\n\n<p>\u5b98\u65b9\u63d0\u4f9b\u7684API\u652f\u6301GET\/POST\u65b9\u6cd5<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#GET:\nhttp:\/\/127.0.0.1:9880\/tts?text=\u5148\u5e1d\u521b\u4e1a\u672a\u534a\u800c\u4e2d\u9053\u5d29\u6b82\uff0c\u4eca\u5929\u4e0b\u4e09\u5206\uff0c\u76ca\u5dde\u75b2\u5f0a\uff0c\u6b64\u8bda\u5371\u6025\u5b58\u4ea1\u4e4b\u79cb\u4e5f\u3002&amp;text_lang=zh&amp;ref_audio_path=archive_jingyuan_1.wav&amp;prompt_lang=zh&amp;prompt_text=\u6211\u662f\u300c\u7f57\u6d6e\u300d\u4e91\u9a91\u5c06\u519b\u666f\u5143\u3002\u4e0d\u5fc5\u62d8\u8c28\uff0c\u300c\u5c06\u519b\u300d\u53ea\u662f\u4e00\u65f6\u7684\u8eab\u4efd\uff0c\u4f60\u79f0\u547c\u6211\u666f\u5143\u4fbf\u53ef&amp;text_split_method=cut5&amp;batch_size=1&amp;media_type=wav&amp;streaming_mode=true\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#POST\n{\n    &quot;text&quot;: &quot;&quot;,                   # str.(required) text to be synthesized\n    &quot;text_lang: &quot;&quot;,               # str.(required) language of the text to be synthesized\n    &quot;ref_audio_path&quot;: &quot;&quot;,         # str.(required) reference audio path\n    &quot;aux_ref_audio_paths&quot;: &#x5B;],    # list.(optional) auxiliary reference audio paths for multi-speaker synthesis\n    &quot;prompt_text&quot;: &quot;&quot;,            # str.(optional) prompt text for the reference audio\n    &quot;prompt_lang&quot;: &quot;&quot;,            # str.(required) language of the prompt text for the reference audio\n    &quot;top_k&quot;: 5,                   # int. top k sampling\n    &quot;top_p&quot;: 1,                   # float. top p sampling\n    &quot;temperature&quot;: 1,             # float. temperature for sampling\n    &quot;text_split_method&quot;: &quot;cut0&quot;,  # str. text split method, see text_segmentation_method.py for details.\n    &quot;batch_size&quot;: 1,              # int. batch size for inference\n    &quot;batch_threshold&quot;: 0.75,      # float. threshold for batch splitting.\n    &quot;split_bucket&quot;: True,          # bool. whether to split the batch into multiple buckets.\n    &quot;return_fragment&quot;: False,     # bool. step by step return the audio fragment.\n    &quot;speed_factor&quot;:1.0,           # float. control the speed of the synthesized audio.\n    &quot;streaming_mode&quot;: False,      # bool. whether to return a streaming response.\n    &quot;seed&quot;: -1,                   # int. random seed for reproducibility.\n    &quot;parallel_infer&quot;: True,       # bool. whether to use parallel inference.\n    &quot;repetition_penalty&quot;: 1.35    # float. repetition penalty for T2S model.\n}\n<\/pre><\/div>\n\n\n<p>\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff08\u4f7f\u7528\u9ed8\u8ba4\u914d\u7f6e\uff09\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport requests\nimport json\n\nurl = &quot;http:\/\/127.0.0.1:9880\/tts&quot;\n\n    data = {\n        &quot;text&quot;: &quot;\u6211\u5728\u8fd9\u91cc\uff0c\u535a\u58eb\u3002&quot;,                   \n        &quot;text_lang&quot;: &quot;zh&quot;,               \n        &quot;ref_audio_path&quot;: &quot;\u5e72\u5458\u62a5\u5230.wav&quot;,        \n        &quot;aux_ref_audio_paths&quot;: &#x5B;],   \n        &quot;prompt_text&quot;: &quot;\u661f\u8c61\u5b66\u8005\uff0c\u661f\u6781\uff0c\u4ee5\u8fd1\u536b\u5e72\u5458\u8eab\u4efd\u4efb\u804c\uff0c\u4eca\u540e\u5c31\u7531\u60a8\u5dee\u9063\u4e86\uff0c\u535a\u58eb\u3002&quot;,      \n        &quot;prompt_lang&quot;: &quot;zh&quot;,            \n        &quot;top_k&quot;: 5,                   \n        &quot;top_p&quot;: 1,                   \n        &quot;temperature&quot;: 1,            \n        &quot;text_split_method&quot;: &quot;cut5&quot;,  \n        &quot;batch_size&quot;: 1,              \n        &quot;batch_threshold&quot;: 0.75,      \n        &quot;split_bucket&quot;: True,          \n        &quot;speed_factor&quot;:1.0,           \n        &quot;fragment_interval&quot;:0.3,      \n        &quot;seed&quot;: -1,                   \n        &quot;media_type&quot;: &quot;wav&quot;,          \n        &quot;streaming_mode&quot;: False,      \n        &quot;parallel_infer&quot;: True,       \n        &quot;repetition_penalty&quot;: 1.35    \n    }\n\n    headers = {&quot;Content-Type&quot;: &quot;application\/json&quot;}\n\n    response = requests.post(url, data=json.dumps(data), headers=headers)\n\n    if response.status_code == 200:\n        # \u4fdd\u5b58\u751f\u6210\u7684\u97f3\u9891\n        with open(&quot;output.wav&quot;, &quot;wb&quot;) as f:\n            f.write(response.content) \n        print(&quot;\u97f3\u9891\u751f\u6210\u6210\u529f\uff01&quot;)\n        return response.content\n    else:\n        print(f&quot;\u8bf7\u6c42\u5931\u8d25\uff0c\u72b6\u6001\u7801\uff1a{response.status_code}, \u9519\u8bef\u4fe1\u606f\uff1a{response.text}&quot;)\n<\/pre><\/div>\n\n\n<p>\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-audio\"><audio controls src=\"https:\/\/blog.sayoung.wang\/wp-content\/uploads\/2025\/02\/audio-4.wav\"><\/audio><figcaption class=\"wp-element-caption\">                                                                      GSV\u8f93\u51fa\u7684\u6548\u679c<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-audio\"><audio controls src=\"https:\/\/blog.sayoung.wang\/wp-content\/uploads\/2025\/02\/\u7f16\u5165\u961f\u4f0d.wav\"><\/audio><figcaption class=\"wp-element-caption\">                                                                               \u539f\u58f0<\/figcaption><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u542c\u51fa\u6765\uff0c\u5c3d\u7ba1\u6ca1\u6709\u5bf9\u6a21\u578b\u8fdb\u884c\u8fc7\u5fae\u8c03\uff0c\u5176\u97f3\u8272\u5374\u5df2\u7ecf\u6bd4\u8f83\u63a5\u8fd1\u539f\u58f0\u3002\u4e0d\u8fc7\u7f8e\u4e2d\u4e0d\u8db3\u7684\u662f\u5176\u60c5\u611f\u4e0a\u8fd8\u662f\u6709\u4e9b\u5e73\u6de1\u3002\u6211\u4eec\u53ef\u4ee5\u589e\u52a0\u4e00\u4e9b\u53c2\u8003\u97f3\u9891\u6765\u6539\u5584\u8fd9\u70b9\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-audio\"><audio controls src=\"https:\/\/blog.sayoung.wang\/wp-content\/uploads\/2025\/02\/audio-3.wav\"><\/audio><figcaption class=\"wp-element-caption\">                                                              \u53c2\u8003\u97f3\u9891\u4e3a&#8221;\u7f16\u5165\u961f\u4f0d.wav&#8221;<\/figcaption><\/figure>\n\n\n\n<p>\u9664\u6b64\u4e4b\u5916\uff0cAPI\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u63a7\u5236\u547d\u4ee4<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n### \u547d\u4ee4\u63a7\u5236\n\nendpoint: `\/control`\n\ncommand:\n&quot;restart&quot;: \u91cd\u65b0\u8fd0\u884c\n&quot;exit&quot;: \u7ed3\u675f\u8fd0\u884c\n\nGET:\n```\nhttp:\/\/127.0.0.1:9880\/control?command=restart\n```\nPOST:\n```json\n{\n    &quot;command&quot;: &quot;restart&quot;\n}\n```\n\nRESP: \u65e0\n<\/pre><\/div>\n\n\n<p>\u4ee5\u53ca\u5207\u6362GPT\u548cSoVites\u6a21\u578b<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n### \u5207\u6362GPT\u6a21\u578b\n\nendpoint: `\/set_gpt_weights`\n\nGET:\n```\nhttp:\/\/127.0.0.1:9880\/set_gpt_weights?weights_path=GPT_SoVITS\/pretrained_models\/s1bert25hz-2kh-longer-epoch=68e-step=50232.ckpt\n```\nRESP: \n\u6210\u529f: \u8fd4\u56de&quot;success&quot;, http code 200\n\u5931\u8d25: \u8fd4\u56de\u5305\u542b\u9519\u8bef\u4fe1\u606f\u7684 json, http code 400\n\n\n### \u5207\u6362Sovits\u6a21\u578b\n\nendpoint: `\/set_sovits_weights`\n\nGET:\n```\nhttp:\/\/127.0.0.1:9880\/set_sovits_weights?weights_path=GPT_SoVITS\/pretrained_models\/s2G488k.pth\n```\n\nRESP: \n\u6210\u529f: \u8fd4\u56de&quot;success&quot;, http code 200\n\u5931\u8d25: \u8fd4\u56de\u5305\u542b\u9519\u8bef\u4fe1\u606f\u7684 json, http code 400\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u53c2\u8003\u81eaGPT-SoVites\u5b98\u65b9\u6587\u6863\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u6362\u4e86\u7535\u8111\uff0c\u7ec8\u4e8e\u53ef\u4ee5\u8bd5\u8bd5GSV\u548cRVC\u4e86\u3002\u5728\u7b80\u5355\u4f53\u9a8c\u4e00\u756a\u540e\uff0c\u840c\u751f\u4e86\u5c06\u5176\u4e0eLLM\u7ed3\u5408\u8d77\u6765\u7684\u60f3\u6cd5\u3002 \uff08\u6bd5\u7adf\u8c01\u4e0d\u60f3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[12,13,7],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-11","tag-ai","tag-gpt-sovites","tag-python"],"_links":{"self":[{"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":9,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/posts\/128\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sayoung.wang\/index.php\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}