cortico-world-fish-sing 0.4.7 → 0.4.9
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.
- package/CHANGELOG.md +11 -0
- package/dist/{webui-a1576ab5.js → webui-efe43ccf.js} +3 -1
- package/dist/webui.js +3 -1
- package/package.json +2 -2
- package/src/worker.ts +16 -4
- package/src/world.ts +49 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循语义化。
|
|
4
4
|
|
|
5
|
+
## [0.4.9] - 2026-11-02
|
|
6
|
+
|
|
7
|
+
### 修复
|
|
8
|
+
- **训练完成后选模对比静默跳过**("只有一个可用存档(中间档可能被清理了)"):`save_every_weights=1` 时 RVC 把存档点导出成 `assets/weights/<实验>_e<N>_s<X>.pth`,logs 里只留滚动的 `G_2333333`(与 final 重复)。原实现只查 logs 里的 `G_<步数>.pth`,所以永远凑不齐两档。现在优先从 weights 目录取最近两个导出档(自动跳过与 final 重复的那个),老实验才退回查 logs。
|
|
9
|
+
|
|
10
|
+
## [0.4.8] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### 修复
|
|
13
|
+
- **「停止训练」点了没停住,面板却显示已停止**:取消请求发出后不再无条件宣布成功——现在会轮询 worker 的 `/current` 实测 12 秒,真停了才说"已停止",没停住会明确告诉你("worker 还有任务在跑,可能是重启前留下的孤儿")并写 warn 日志。面板也会把这句话显示出来。
|
|
14
|
+
- `worker.cancel()` 的返回值(HTTP 状态 / worker 的答复 / 网络错误)全部带出来并记日志,不再静默吞掉。
|
|
15
|
+
|
|
5
16
|
## [0.4.7] - 2026-11-02
|
|
6
17
|
|
|
7
18
|
### 新增
|
|
@@ -1461,7 +1461,9 @@ function mountTrain(ctx) {
|
|
|
1461
1461
|
stopT.addEventListener('click', async () => {
|
|
1462
1462
|
stopT.disabled = true;
|
|
1463
1463
|
try {
|
|
1464
|
-
await call('trainStop', []);
|
|
1464
|
+
const r = await call('trainStop', []);
|
|
1465
|
+
// 把 world 的实话显示出来:真停了 / 没停住 都要看得见
|
|
1466
|
+
if (r && r.text) say(r.text, !/^已停止/.test(String(r.text)));
|
|
1465
1467
|
} catch {
|
|
1466
1468
|
/* 已显示 */
|
|
1467
1469
|
}
|
package/dist/webui.js
CHANGED
|
@@ -1461,7 +1461,9 @@ function mountTrain(ctx) {
|
|
|
1461
1461
|
stopT.addEventListener('click', async () => {
|
|
1462
1462
|
stopT.disabled = true;
|
|
1463
1463
|
try {
|
|
1464
|
-
await call('trainStop', []);
|
|
1464
|
+
const r = await call('trainStop', []);
|
|
1465
|
+
// 把 world 的实话显示出来:真停了 / 没停住 都要看得见
|
|
1466
|
+
if (r && r.text) say(r.text, !/^已停止/.test(String(r.text)));
|
|
1465
1467
|
} catch {
|
|
1466
1468
|
/* 已显示 */
|
|
1467
1469
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-fish-sing",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"local"
|
|
37
37
|
],
|
|
38
38
|
"describe": "describe.json",
|
|
39
|
-
"webUiClient": "dist/webui-
|
|
39
|
+
"webUiClient": "dist/webui-efe43ccf.js"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"doctor": "node tools/doctor.mjs"
|
package/src/worker.ts
CHANGED
|
@@ -313,16 +313,28 @@ export class WorkerClient {
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
async cancel(): Promise<
|
|
316
|
+
async cancel(): Promise<{ ok: boolean; message: string }> {
|
|
317
|
+
// 返回值要带出去:以前这里吞掉一切,面板点「停止训练」失败也显示"已停止",
|
|
318
|
+
// 结果训练继续跑(0.4.7 那次真实事故),排查时完全看不到线索。
|
|
317
319
|
try {
|
|
318
|
-
await fetch(`${this.baseUrl}/stop`, {
|
|
320
|
+
const res = await fetch(`${this.baseUrl}/stop`, {
|
|
319
321
|
method: 'POST',
|
|
320
322
|
headers: this.authHeaders(),
|
|
321
323
|
body: '{}',
|
|
322
324
|
signal: AbortSignal.timeout(5000),
|
|
323
325
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
+
const body = (await res.json().catch(() => ({}))) as { ok?: boolean; message?: string };
|
|
327
|
+
const message = String(body.message ?? `HTTP ${res.status}`);
|
|
328
|
+
if (!res.ok || body.ok === false) {
|
|
329
|
+
this.log.warn(`取消请求没被接受:HTTP ${res.status} ${message}`);
|
|
330
|
+
return { ok: false, message };
|
|
331
|
+
}
|
|
332
|
+
this.log.info(`取消请求已送达:${message}`);
|
|
333
|
+
return { ok: true, message };
|
|
334
|
+
} catch (e) {
|
|
335
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
336
|
+
this.log.warn(`取消请求发不出去(worker 没响应):${message}`);
|
|
337
|
+
return { ok: false, message: `连不上 worker:${message}` };
|
|
326
338
|
}
|
|
327
339
|
}
|
|
328
340
|
|
package/src/world.ts
CHANGED
|
@@ -329,15 +329,38 @@ export class FishSingWorld implements World {
|
|
|
329
329
|
};
|
|
330
330
|
const variants: { ckpt: string; label: string; index: string }[] = [];
|
|
331
331
|
const finalPth = join(weights, `${exp}.pth`);
|
|
332
|
-
|
|
332
|
+
const hasFinal = existsSync(finalPth);
|
|
333
|
+
if (hasFinal) variants.push({ ckpt: finalPth, label: 'final', index: indexOf(logDir) });
|
|
333
334
|
try {
|
|
334
|
-
// 中间档从新到旧取 2
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
335
|
+
// 中间档从新到旧取 2 个。
|
|
336
|
+
// 注意:save_every_weights=1 时 RVC 把每个存档点导出成 weights/<exp>_e<N>_s<X>.pth,
|
|
337
|
+
// logs 里只剩滚动的 G_2333333(跟 final 重复)——所以必须优先看 weights 目录。
|
|
338
|
+
// (0.4.8 之前只查 logs 里的 G_<步数>.pth,结果永远"只有一个存档",选模对比被静默跳过。)
|
|
339
|
+
const esc = exp.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
340
|
+
const re = new RegExp(`^${esc}_e(\\d+)_s\\d+\\.pth$`);
|
|
341
|
+
const exported = readdirSync(weights)
|
|
342
|
+
.map((f) => re.exec(f))
|
|
343
|
+
.filter((m): m is RegExpExecArray => Boolean(m))
|
|
344
|
+
.map((m) => ({ epoch: Number(m[1]), file: m[0] }))
|
|
345
|
+
.sort((a, b) => b.epoch - a.epoch);
|
|
346
|
+
// 最新一个导出的存档通常就等于 final,跳过它(否则同一份权重会比两次)
|
|
347
|
+
const pool = hasFinal ? exported.slice(1) : exported;
|
|
348
|
+
for (const it of pool.slice(0, 2)) {
|
|
349
|
+
variants.push({
|
|
350
|
+
ckpt: join(weights, it.file),
|
|
351
|
+
label: `e${it.epoch}`,
|
|
352
|
+
index: indexOf(logDir),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
if (variants.length < 2) {
|
|
356
|
+
// 老实验没有导出文件时退回 logs 里的 G_<步数>.pth
|
|
357
|
+
const gs = readdirSync(logDir)
|
|
358
|
+
.map((f) => /^G_(\d+)\.pth$/.exec(f))
|
|
359
|
+
.filter((m): m is RegExpExecArray => Boolean(m) && m[1] !== '2333333')
|
|
360
|
+
.sort((a, b) => Number(b[1]) - Number(a[1]))
|
|
361
|
+
.slice(0, 2);
|
|
362
|
+
for (const m of gs) variants.push({ ckpt: join(logDir, m[0]), label: `e${m[1]}`, index: indexOf(logDir) });
|
|
363
|
+
}
|
|
341
364
|
} catch {
|
|
342
365
|
/* 没有中间档就只用 final */
|
|
343
366
|
}
|
|
@@ -1181,14 +1204,30 @@ export class FishSingWorld implements World {
|
|
|
1181
1204
|
}
|
|
1182
1205
|
|
|
1183
1206
|
if (method === 'trainStop') {
|
|
1184
|
-
await this.worker.cancel();
|
|
1207
|
+
const cres = await this.worker.cancel();
|
|
1208
|
+
// 送达 ≠ 停住:取消请求成功,也可能因为训练是"重启前留下的孤儿"而落空
|
|
1209
|
+
// (worker 当前任务为 null,它只会回"当前没有任务")。所以实测 worker 还在不在跑。
|
|
1210
|
+
let left: { kind?: string } | null = null;
|
|
1211
|
+
for (let i = 0; i < 5; i += 1) {
|
|
1212
|
+
await new Promise((r) => setTimeout(r, 2500));
|
|
1213
|
+
left = await this.worker.currentJob().catch(() => null);
|
|
1214
|
+
if (!left) break;
|
|
1215
|
+
}
|
|
1216
|
+
if (left) {
|
|
1217
|
+
this.host?.log.warn(
|
|
1218
|
+
`[fish-sing] 停止训练:取消请求已发(${cres.message}),但 worker 还有任务在跑(${left.kind ?? '?'})`,
|
|
1219
|
+
);
|
|
1220
|
+
return {
|
|
1221
|
+
text: `取消请求发出去了(${cres.message}),但 worker 那边还有任务在跑——这个训练可能是重启前启动的、worker 管不到它。重启 Coo 后再试。`,
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1185
1224
|
if (this.trainJob?.state === 'running') {
|
|
1186
1225
|
// 立刻落状态:子进程可能还在收尾,面板会一直显示"训练中",用户以为没停
|
|
1187
1226
|
this.trainJob.state = 'error';
|
|
1188
1227
|
this.trainJob.error = '已手动停止';
|
|
1189
1228
|
this.trainJob.msg = '已手动停止';
|
|
1190
1229
|
}
|
|
1191
|
-
return { text:
|
|
1230
|
+
return { text: `已停止训练(${cres.message})。最近的存档还在 logs 里,可以勾「从上次存档继续」接着练。` };
|
|
1192
1231
|
}
|
|
1193
1232
|
|
|
1194
1233
|
if (method === 'cancel') {
|