24a's blog
0x24a's personal blog website.
首页
友情链接
关于
文章分类
按月归档
常用标签
友情链接

在学校实在无聊,晚自习拿出了草稿纸开始头脑风暴。
最近试玩了 So-VITS-SVC 并且通过批量推理的方式给自己做了高质量的 UTAU VCV 声库,但整个录制过程过于困难(录制训练 SoVITS 的样本所花费的时间约为 2 天),于是想到了一种懒人方法来训练 TTS SoVITS 模型的方法。

事先叠甲

本篇教程仅提供 大体思路 ,对于部分操作步骤(如使用 Google Colab 进行训练、文中提到的开源软件的具体使用方法),请发挥你的 Geek 精神:读文档、善用搜索或自己摸索。

流程简介

  1. 录制原音声( 2 分钟 即可达到 非常优质 的效果!)
  2. 训练 GPT-SoVITS 模型
  3. 使用大量随机语料,生成净时间约为 3hr 的训练样本
  4. 使用 GPT-SoVITS 的输出训练 So-VITS-SVC 模型
  5. (Optional) 下载任意 UTAU 声库并通过批量 Infer 以制作高质量声库

具体步骤

W.I.P.

2024-04-04T05:24:33.png
自动评论机器人能不能都 414 啊😓

问题的发现

一次试图启动 WatchDiscord,显示“无法找到使用此主机名的主机”,吓嘻了。
以为我域名给运营商 DNS 污染了,回家一看,使用 1.1.1.1,8.8.8.8 还有一堆 DoH,DoT 解析器都只返回 NXDOMAIN。


第一时间以为是 cf 的问题,可经过一番搜索,好像除了我没有第二个人出过这个问题。于是跑到注册商腾讯云看一眼。
不出所料,开幕雷击,ServerHold!

Domain Status: serverDeleteProhibited https://www.icann.org/epp#serverDeleteProhibited
Domain Status: serverHold https://www.icann.org/epp#serverHold
Domain Status: serverTransferProhibited https://www.icann.org/epp#serverTransferProhibited

试图解决

Google 搜了一下,发现 serverHold 只有两种可能,一种是 whois 联系人信息是虚假的,还有就是域名有滥用行为。
众所周知,腾讯云会对 whois 联系人进行严格的认证,所以不可能是第一种。
那就是第二种了??我一向遵纪守法,怎么会干出 abuse 的事。
向腾讯云发了工单,光速回答是误封,说注册局需要 1 - 3 个工作日才能回答。
等了五天,还没有回答,给我气急了,又发了一次工单,这次就火速Domain Status: ok了。

吐槽

icann 你收这么多钱还瞎几把封域名,什么 b 东西啊

对于 Cloudflare WARP, 大家可能都有所听闻。经过 n 次的失败和试水之后,我总结出了一份 99% 成功免费获得 Warp 的教程。

DISCLAIMER: WARP 仅用于保护隐私,如有人使用本教程违法翻墙、发布不当言论等,与本博客作者无关。

方式

用 WARP,有多种选择。(实用度从 WARP+ 最强到 WARP 最弱)

  • WARP: 共享带宽,连接困难,但不需要复杂的配置。
  • Zero Trust: 和 WARP+ 几乎同配置,但线路稍不如 WARP+。
  • WARP+: 独享线路,秒连接,配置较复杂。

本文章将会主要针对第二和第三种方式进行讲解。

下载客户端

这三种方法的使用都依赖于 1.1.1.1 客户端。
(Windows 8/higher) https://1111-releases.cloudflareclient.com/windows/Cloudflare_WARP_Release-x64.msi
(iOS)App Store: https://itunes.apple.com/us/app/1-1-1-1-faster-internet/id1423538627
(macOS) https://1111-releases.cloudflareclient.com/mac/Cloudflare_WARP.zip
(Android)Google play: https://play.google.com/store/apps/details?id=com.cloudflare.onedotonedotonedotone
(Android)无法访问 Google play 的读者请下载:https://www.apkmirror.com/apk/cloudflare/1-1-1-1-faster-safer-internet/1-1-1-1-faster-safer-internet-6-29-release/1-1-1-1-warp-safer-internet-6-29-2-android-apk-download/download/?key=87624c51c097827bb4ca8d0bbb67f46ccc206b97&forcebaseapk=true
其他 Linux 发行版用户可以先跳过这一步,先创建自己的 Zero Trust/Warp+ 账号。

创建 Cloudflare 账号

如果你已经有一个了,请跳过这一步。
前往 https://dash.cloudflare.com/sign-up 使用你的邮箱注册一个账号,在此不作赘述,可自行查找其他教学。

Zero Trust

打开 https://dash.cloudflare.com/ 后,在侧边栏找到“Zero Trust”.
初次打开,会让你选择你的团队名,随便输入一个就好。(一定要记住,这很重要!)
点击 Free plan 下的 Select plan 按钮,选择免费方案。
点击右侧的 Proceed to payment,会提醒你需要支付方式,直接关闭页面。然后重新从 https://dash.cloudflare.com/ 进入 Zero trust, 你的账号就创建好了。

在 Zero trust 侧边栏找到 Access -> Access groups,点击 Add a group.
Group Name 可以随便填写,你不需要记住,勾选 Set as default group, 在 Selector 的第一个下拉菜单选择 Everyone,然后点击右下角 Save.

之后你就可以在你的 1.1.1.1 客户端首选项内的“账号”找到从Zero trust登录,如果你的客户端不是中文的,那就是 Peferences->Account-> 带有 Zero Trust 字眼的按钮。
会弹出一个输入框,填写你团队的名称(不要加上.cloudflareaccess.com!)

然后填写你的邮箱,输验证码,把主页面开关打开,就可以愉快的使用 Zero Trust 了。

Warp+

Warp+ 需要在 TG 的@generatewarpplusbot使用/generate指令
会让你计算,使用/generate 计算结果的格式进行人机验证就可以获得专属于自己的 WARP+ Key 了。
如果你没有 TG, 可以前往本篇文章底部的公开 Key 随便拿一个比较靠底部的。
成功拿到 Key 之后,它应该是类似12345678-12345678-12345678的格式。

导入方式

Android 客户端

右上角按钮 ->Account->Key->Change Key-> 粘贴你的 key
中文:右上角按钮 -> 账号 -> 按键 -> 更改密钥 -> 粘贴你的 key
记得右上角按钮 -> 改为 WARP+ 而不是 1.1.1.1。

MacOS 客户端

托盘图标 -> 齿轮图案 ->Perferences->Account->Use Different Key-> 粘贴你的 Key

Linux CLI

使用你的包管理器安装 warp-cli。
输入warp-cli register来注册客户端。(不成功的话,多换几个网络环境)
输入warp-cli set-license <你的key>来设置你的 key
输入warp-cli connect来连接 warp.

其他平台

我没有亲自试过所以不做教学,希望大家发挥自己的摸索精神。如果有读者知道,可以在评论区留言一下,我会加上去的。

导入成功后,你应该能看见你有 24.49PB 的流量(够用十几年了,等于 24598562 GB),把主页面开关打开,就可以快乐的使用了!

关于客户端一些奇奇葩葩的 Q &A

Q: 为什么显示无法注册客户端?
A: 多换几个网络环境,再试试。

Q: 为什么 Cloudflare dashboard 这么慢?
A: 耐心!

Q: 为什么我的安卓客户端会显示致命错误?
A: 安装谷歌三件套,我这里比较推荐 Go 谷歌安装器,点此下载 ,如链接失效,请自行百度。

Q: 我还有问题!
A: 评论区始终向你敞开。

公开的 WARP+ Keys

上次更新:2023/8/30

🔐 Key: d6O0H4b5-r94NW8C2-5NQHF472 (24598562 GB)
🔐 Key: w2G709sc-75JkY2D0-9xD4U86q (24598562 GB)
🔐 Key: 6OM5A0c7-75N60LZl-BVU852J3 (24598562 GB)
🔐 Key: P17F5ZC2-zf5v643D-785Lm0Mn (24598562 GB)
🔐 Key: VWB89t51-D964o5Rq-3R79ed1G (24598562 GB)
🔐 Key: Dv2J9F07-1I92S5CD-K34E2wM5 (24598562 GB)
🔐 Key: C9325xKM-D0ls6O87-85Mys21W (24598562 GB)
🔐 Key: 2N785arZ-83M69nsG-4J01ApN5 (24598562 GB)
🔐 Key: 6broX014-v6B4b3j2-549Gu7Pf (24598562 GB)
🔐 Key: f8p4Db07-bM03f6I1-3T2mul49 (24598562 GB)

尝试使用 extern

  尽管我没学过 C ++, 但我知道有 extern 这个关键字,可以让编译器从其他文件找到变量的内容。
一开始试图采用import {} from {}的语法,即为将其他的 SBLang 文件编译为头文件后,在 g ++ 编译最终文件时链接起来。
经过测试,无论怎么修改,结果只有两种:访问的是无效变量或报错。
由于 extern 太复杂,我尝试通过将其他 SBLang 转换为 C ++ 头文件后,在主程序内 include。
实现代码如下:

def fromimport(runtime,line):
    runtime.externs.add(line[1])

然后在编译器 (sblang2c.py) 中:

print('-| Resolving externs')
links=[]
mapping={}
if len(runtime.externs) == 0:
    print("-| No externs")
else:
    runtime.externs=list(runtime.externs)
    print(f"-| Compiling {len(runtime.externs)} head(s)")
    for count in range(1,len(runtime.externs)+1):
        print(f"- -|{count}/{len(runtime.externs)}: {runtime.externs[count-1]}")
        filename=f"_sblang_header_{secrets.token_hex(16)}.h"
        temps.append(filename)
        with open(runtime.externs[count-1],"r",encoding="utf-8") as f:
            modcode=f.read()
        with open(filename,"w+") as f:
            rt=converter.Runtime()
            try:
                for i in modcode.splitlines():
                    rt.translate(i)
            except BaseException as e:
                print(f"\n! Error when converting: {e}")
                from traceback import print_exc
                print_exc()
                exit(1)
            rt.heads=[]
            f.write(rt.export_final())
            if rt.externs != []:
                print("WARN: Multi-layer extern is not supported yet, ignoring.")
        mapping.update({runtime.externs[count-1]:filename})
        print(f"- -|{count}/{len(runtime.externs)}: {runtime.externs[count-1]}: Success")
new=[]
for i in runtime.externs:
    data=mapping.get(i,i)
    if data != i:
        data=os.getcwd()+"/"+data
    runtime.heads.add(data)

注:这里os.getcwd()+"/"+data是因为经过测试,只有使用绝对路径 G ++ 才能正确的同时编译头文件。

开始跑测试。
import.sbl

main
    import import_head.sbl
    output "1+1="
    output plusOne(1)
end

import_head.sbl

define plusOne num
    return (1+num)
define end
python3 sblang2c.py --gcc-binary=/opt/homebrew/bin/g++-13 --debug import.sbl
SBLang2C Compiler and converter v0.0.2-dev-2
-| Reading File 0.13995 ms
-| Converting to C++
- -| Creating Runtime 0.0031 ms
- -| Converting
DEBUG:root:Running Dynamic Command: main
DEBUG:root:Running Dynamic Command: import
DEBUG:root:Running Dynamic Command: output
DEBUG:root:Running Dynamic Command: output

 0.09823 ms
-| Resolving externs
-| Compiling 1 head(s)
- -|1/1: import_head.sbl
DEBUG:root:Running Dynamic Command: define
DEBUG:root:Function Info:
DEBUG:root:Running Checker:return (1+num)
DEBUG:root:{'DEFINEING': True, 'DEFINE_DATA': {'name': 'plusOne', 'args': ['auto num'], 'lines': []}}
DEBUG:root:Running Dynamic Command: return
DEBUG:root:Added: {'name': 'plusOne', 'args': ['auto num'], 'lines': ['return (1+num);']}
DEBUG:root:Stopped by Global-Checker
DEBUG:root:Running Checker:define end
DEBUG:root:Generated Program:auto plusOne(auto num){
return (1+num);}
DEBUG:root:Stopped by Global-Checker
DEBUG:root:Exporting....
DEBUG:root:Headers: []
- -|1/1: import_head.sbl: Success
- -| Writing to temp file
DEBUG:root:Exporting....
DEBUG:root:Headers: {'/Users/0x24a/Desktop/Projects/SBLang2C/tests/_sblang_header_720038921a2546135b37567b58b5aae4.h', 'bits/stdc++.h'}

 0.09298 ms
-| Compiling with g++
- -| Awaiting G++ execute 1371.68694 ms
-| Removeing Tempfile
-| Exiting Compile.
➜  tests git:(main) ✗ ./import
1+1=2

这里虽然仅仅输出了“1+1=2”, 但这个 "2" 是从其他文件获得的,这是 SBLang2C 的一个大进步!