cortico-world-fish-sing 0.4.24 → 0.4.25

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 CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循语义化。
4
4
 
5
+ ## [0.4.25] - 2026-11-26
6
+
7
+ ### 数据可信
8
+ - manifest 白名单生成训练集;缓存按样本名检查。
9
+ - 切片逐个 sha256 绑进 `dataset_binding.json`,路径必须在 `slices/` 下,空文件 / 重名 / 缺文件直接报错。
10
+ - 无声切片剔除;F0 分析失败单独标记 `f0_analysis_failed`(需复查,不混进静音)。
11
+ - 修正 FLOAT 音频长度桶估算(`getsize // (3*hop)` → `sf.info().frames // hop`)。
12
+
13
+ ### 训练可靠
14
+ - **从头训练拒绝复用旧实验**;同名实验默认不覆盖,续训必须校验数据集内容指纹与增强参数,并显式控制 G/D 恢复,找不到配对存档就报错、**失败不回退底模**。
15
+ - 子进程无输出时也能取消:停止整个进程树并等待退出。
16
+ - 训练结束后校验最终模型确实生成,否则明确报错(不再"假成功")。
17
+ - 默认与教程统一为 **40~70 轮**基线,修正轮次显示多算一轮的问题。
18
+
19
+ ### 选模与可观测
20
+ - **独立低、中、高音三段干声选模**,关闭检索;试听完成后才自动清理中间档。
21
+ - 音域加权显示桶内抽样估计与每轮采样计划;增强源片及副本权重保持合计不变。
22
+
23
+
5
24
  ## [0.4.24] - 2026-11-12
6
25
 
7
26
  ### 修复
package/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # cortico-world-fish-sing · 大肥鱼唱歌
2
2
 
3
3
  让她真的开口唱:**B 站点歌 / 本地文件 → 人声分离 → RVC 换声 → 混音 → 本机出声或发 QQ 语音条**。
4
+
5
+ ### 训练行为更新(0.4.25)
6
+
7
+ 从头训练必须使用新实验名;断点续训要求切片内容、增强参数与原实验一致,旧版无数据指纹的实验请使用新名字重训。训练轮次统一先以 40~70 轮为基线。
8
+ 选模使用另外提供的低、中、高音三段独立干声(关闭检索),不再拿训练切片自测。权重面板按长度桶估计抽样比例,训练页提供实际采样计划。完整用法以 [训练教程](docs/TRAINING.md) 为准。
4
9
  附带一套训练面板:选素材 → 分离 → 切片 → **按音域调权重** → 训练 → 出模型,全程点按钮。
5
10
 
6
11
  给 [Coopanion](https://github.com/Pal-AI-Lab/cortico-extensions) 用的 World 扩展。
@@ -182,7 +187,7 @@ RVC 本来是**均匀采样**:唱得高的片和唱得低的片被抽中的概
182
187
 
183
188
  「已有模型」下拉选一个本机训练过的实验 → 点「导入已训练模型的数据」,
184
189
  它 `logs/<exp>/0_gt_wavs` 里的切片会**硬链接**成数据集(不占空间),
185
- 然后勾着「追加到当前数据集」把新素材加进去,音域分布和权重按合并后的总量重算。
190
+ 然后勾着「追加到当前数据集」把新素材加进去,音域分布和权重按合并后的总量重算。数据变化后请使用新实验名从底模训练;“断点续训”只适用于数据完全一致的实验。
186
191
 
187
192
  > 前提:那个实验的切片还在。清理过 `logs/<exp>/0_gt_wavs` 就只能从原始音频重建。
188
193
  > 用本插件建的会保留 `sep/vocals.wav`,不会丢。
package/describe.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "name": "cortico-world-fish-sing",
4
- "version": "0.1.0",
4
+ "version": "0.4.25",
5
5
  "describe": {
6
6
  "tools": [
7
7
  {
@@ -986,8 +986,17 @@ function mountTrain(ctx) {
986
986
  let wRefs = [];
987
987
 
988
988
  const afterShares = () => {
989
- const total = wrows.reduce((n, r) => n + r.seconds * (wcfg.bands[r.id] ?? 1), 0) || 1;
990
- return wrows.map((r) => (r.seconds * (wcfg.bands[r.id] ?? 1)) / total);
989
+ const counts = wrows.map(() => 0);
990
+ let total = 0;
991
+ for (let bucket = 0; bucket < 8; bucket++) {
992
+ const n = wrows.reduce((sum, r) => sum + (r.buckets?.[bucket] || 0), 0);
993
+ if (!n) continue;
994
+ const draws = Math.ceil(n / 4) * 4;
995
+ const denominator = wrows.reduce((sum, r) => sum + (r.buckets?.[bucket] || 0) * (wcfg.bands[r.id] ?? 1), 0);
996
+ wrows.forEach((r, i) => { counts[i] += draws * (r.buckets?.[bucket] || 0) * (wcfg.bands[r.id] ?? 1) / denominator; });
997
+ total += draws;
998
+ }
999
+ return counts.map(n => n / (total || 1));
991
1000
  };
992
1001
 
993
1002
  const paintWeightNumbers = () => {
@@ -1090,7 +1099,7 @@ function mountTrain(ctx) {
1090
1099
  /* 错误已显示 */
1091
1100
  }
1092
1101
  });
1093
- foot.append(saveBtn, el('span', 'fs-meta', '保存后训练会用这套权重:同一档的片段被抽到的概率按倍数放大,每轮步数不变'));
1102
+ foot.append(saveBtn, el('span', 'fs-meta', '预览为桶内抽样片数占比(非增强 / batch4),不是时长占比;以训练采样报告为准,增强副本按原片音域归组'));
1094
1103
  weightBox.append(foot);
1095
1104
 
1096
1105
  paintWeightNumbers();
@@ -1242,7 +1251,7 @@ function mountTrain(ctx) {
1242
1251
  epIn.type = 'number';
1243
1252
  epIn.min = '10';
1244
1253
  epIn.max = '600';
1245
- epIn.value = '200';
1254
+ epIn.value = '70';
1246
1255
  const bsSel = el('select', 'fs-tin');
1247
1256
  for (const v of [2, 4, 6, 8]) {
1248
1257
  const o = el('option', '', `batch ${v}`);
@@ -1271,8 +1280,8 @@ function mountTrain(ctx) {
1271
1280
  };
1272
1281
 
1273
1282
  tForm.append(
1274
- mkField('实验名', expIn, '产物会落在 logs/<实验名>,同名会复用目录'),
1275
- mkField('轮次', epIn, '200 轮 / 33 分钟数据约 3 小时'),
1283
+ mkField('实验名', expIn, '从头训练使用新实验名;同名仅允许数据一致的断点续训'),
1284
+ mkField('轮次', epIn, '先训练 40~70 轮,使用独立试听选模,增加轮次不保证更好'),
1276
1285
  mkField('批大小', bsSel, '8G 显存用 4,爆显存就降到 2'),
1277
1286
  mkField('每 N 轮存档', seIn, '每 N 轮导出一个小模型到「模型」页'),
1278
1287
  );
@@ -1292,7 +1301,7 @@ function mountTrain(ctx) {
1292
1301
  abChk.checked = false; // 用户要求:不默认勾,想要就自己点
1293
1302
  const abLbl = el('label', 'fs-meta', '训练完生成选模对比');
1294
1303
  abLbl.prepend(abChk);
1295
- abLbl.title = '用同一句训练切片,final 和最后两个中间档各唱一遍,进作品库对比听';
1304
+ abLbl.title = '用下面独立的低、中、高音干声对比 final 和最后两个中间档,关闭检索';
1296
1305
  const lowChk = el('input', 'fs-ck');
1297
1306
  lowChk.type = 'checkbox';
1298
1307
  lowChk.checked = false; // 用户要求:不默认勾(实测只是有限改善)
@@ -1301,6 +1310,14 @@ function mountTrain(ctx) {
1301
1310
  lowLbl.title = '有限改善:把每个切片合成 -2/-4 半音的副本一起训练。实测只能缓解、不能根治"低音不像"(模型在低音区本来就没有音色记忆),且 F0/特征提取时间约 ×3';
1302
1311
  chkRow.append(resumeLbl, rebuildLbl, pruneAfterLbl, abLbl, lowLbl, el('span', 'fs-grow'), startT, stopT);
1303
1312
 
1313
+ const evaluationInputs = ['低音', '中音', '高音'].map(band => {
1314
+ const input = el('input', 'fs-tin');
1315
+ input.placeholder = `${band}独立干声路径(未参与训练,含长音,建议10~30秒)`;
1316
+ return input;
1317
+ });
1318
+ const evaluationBox = el('div', 'fs-list');
1319
+ evaluationBox.append(el('div', 'fs-meta', '选模素材:固定低、中、高音三段独立干声。请确认没有同一首歌的片段进入训练集。'), ...evaluationInputs);
1320
+ const samplingText = el('div', 'fs-meta');
1304
1321
  const tProg = el('div', 'fs-prog');
1305
1322
  const tFill = el('i');
1306
1323
  tProg.append(tFill);
@@ -1320,10 +1337,10 @@ function mountTrain(ctx) {
1320
1337
  const pruneBtn = el('button', 'fs-btn', '清理中间档');
1321
1338
  pruneBtn.title = '只删 assets/weights/<exp>_eN_sX.pth 这种导出的小模型;完整存档、索引、最终模型都不动';
1322
1339
  const abBtn = el('button', 'fs-btn', '生成选模对比');
1323
- abBtn.title = '用当前实验的存档(final + 最后两个中间档)各唱同一句训练切片,生成对比试听进作品库';
1340
+ abBtn.title = '用独立低、中、高音干声对比 final 和最后两个中间档,关闭检索';
1324
1341
  ckptBar.append(el('span', 'fs-meta', '中间档:'), ckptMeta, el('span', 'fs-meta', '每'),
1325
1342
  keepIn, el('span', 'fs-meta', '轮留一个'), el('span', 'fs-grow'), abBtn, pruneBtn);
1326
- trainBox.append(tTitle, tForm, chkRow, tProg, tMsg, losses, lossAxis, tModels, ckptBar);
1343
+ trainBox.append(tTitle, tForm, chkRow, evaluationBox, tProg, tMsg, samplingText, losses, lossAxis, tModels, ckptBar);
1327
1344
 
1328
1345
  let trainExp = '';
1329
1346
  let trainTimer = null;
@@ -1347,7 +1364,7 @@ function mountTrain(ctx) {
1347
1364
  abBtn.disabled = true;
1348
1365
  abBtn.textContent = '生成中…';
1349
1366
  try {
1350
- const r = await ctx.invoke('trainAbTest', [{ exp }]);
1367
+ const r = await ctx.invoke('trainAbTest', [{ exp, evaluationPaths: evaluationInputs.map(input => input.value.trim()) }]);
1351
1368
  tMsg.textContent = (r && r.text) || `选模对比已生成(${exp})`;
1352
1369
  } catch (e) {
1353
1370
  tMsg.textContent = `选模对比失败:${(e && e.message) || e}`;
@@ -1422,6 +1439,11 @@ function mountTrain(ctx) {
1422
1439
  };
1423
1440
 
1424
1441
  const paintTrain = (st) => {
1442
+ const report = st.sampling;
1443
+ const sampleTotal = Object.values(report?.counts || {}).reduce((sum, n) => sum + Number(n), 0);
1444
+ samplingText.textContent = report ? `第 ${report.epoch} 轮采样计划:${sampleTotal} 次 / ${Object.keys(report.counts || {}).length} 个不同切片;` +
1445
+ Object.entries(report.bands || {}).map(([band, n]) => `${({low:'低', mid:'中', high:'偏高', top:'高', unknown:'未知'})[band] || band} ${(Number(n) / (sampleTotal || 1) * 100).toFixed(1)}%`).join(' · ') +
1446
+ (report.replicas > 1 ? '(仅 rank0)' : '') : '实际采样报告:训练启动后显示';
1425
1447
  const job = st.job;
1426
1448
  // 有 job 就看 job;没有但日志还在写 = 重启前留下的训练还在跑,一样要当成「进行中」
1427
1449
  const owned = Boolean(job && job.id);
@@ -1549,13 +1571,14 @@ function mountTrain(ctx) {
1549
1571
  try {
1550
1572
  const r = await call('trainStart', [{
1551
1573
  exp: String(expIn.value || '').trim(),
1552
- epochs: Number(epIn.value) || 200,
1574
+ epochs: Number(epIn.value) || 70,
1553
1575
  batch: Number(bsSel.value) || 4,
1554
1576
  saveEvery: Number(seIn.value) || 10,
1555
1577
  resume: resumeChk.checked,
1556
1578
  rebuild: rebuildChk.checked,
1557
1579
  pruneAfter: pruneAfterChk.checked,
1558
1580
  abTest: abChk.checked,
1581
+ evaluationPaths: evaluationInputs.map(input => input.value.trim()),
1559
1582
  augment: lowChk.checked,
1560
1583
  keepEvery: Math.max(1, Number(keepIn.value) || 50),
1561
1584
  }]);
package/dist/webui.js CHANGED
@@ -986,8 +986,17 @@ function mountTrain(ctx) {
986
986
  let wRefs = [];
987
987
 
988
988
  const afterShares = () => {
989
- const total = wrows.reduce((n, r) => n + r.seconds * (wcfg.bands[r.id] ?? 1), 0) || 1;
990
- return wrows.map((r) => (r.seconds * (wcfg.bands[r.id] ?? 1)) / total);
989
+ const counts = wrows.map(() => 0);
990
+ let total = 0;
991
+ for (let bucket = 0; bucket < 8; bucket++) {
992
+ const n = wrows.reduce((sum, r) => sum + (r.buckets?.[bucket] || 0), 0);
993
+ if (!n) continue;
994
+ const draws = Math.ceil(n / 4) * 4;
995
+ const denominator = wrows.reduce((sum, r) => sum + (r.buckets?.[bucket] || 0) * (wcfg.bands[r.id] ?? 1), 0);
996
+ wrows.forEach((r, i) => { counts[i] += draws * (r.buckets?.[bucket] || 0) * (wcfg.bands[r.id] ?? 1) / denominator; });
997
+ total += draws;
998
+ }
999
+ return counts.map(n => n / (total || 1));
991
1000
  };
992
1001
 
993
1002
  const paintWeightNumbers = () => {
@@ -1090,7 +1099,7 @@ function mountTrain(ctx) {
1090
1099
  /* 错误已显示 */
1091
1100
  }
1092
1101
  });
1093
- foot.append(saveBtn, el('span', 'fs-meta', '保存后训练会用这套权重:同一档的片段被抽到的概率按倍数放大,每轮步数不变'));
1102
+ foot.append(saveBtn, el('span', 'fs-meta', '预览为桶内抽样片数占比(非增强 / batch4),不是时长占比;以训练采样报告为准,增强副本按原片音域归组'));
1094
1103
  weightBox.append(foot);
1095
1104
 
1096
1105
  paintWeightNumbers();
@@ -1242,7 +1251,7 @@ function mountTrain(ctx) {
1242
1251
  epIn.type = 'number';
1243
1252
  epIn.min = '10';
1244
1253
  epIn.max = '600';
1245
- epIn.value = '200';
1254
+ epIn.value = '70';
1246
1255
  const bsSel = el('select', 'fs-tin');
1247
1256
  for (const v of [2, 4, 6, 8]) {
1248
1257
  const o = el('option', '', `batch ${v}`);
@@ -1271,8 +1280,8 @@ function mountTrain(ctx) {
1271
1280
  };
1272
1281
 
1273
1282
  tForm.append(
1274
- mkField('实验名', expIn, '产物会落在 logs/<实验名>,同名会复用目录'),
1275
- mkField('轮次', epIn, '200 轮 / 33 分钟数据约 3 小时'),
1283
+ mkField('实验名', expIn, '从头训练使用新实验名;同名仅允许数据一致的断点续训'),
1284
+ mkField('轮次', epIn, '先训练 40~70 轮,使用独立试听选模,增加轮次不保证更好'),
1276
1285
  mkField('批大小', bsSel, '8G 显存用 4,爆显存就降到 2'),
1277
1286
  mkField('每 N 轮存档', seIn, '每 N 轮导出一个小模型到「模型」页'),
1278
1287
  );
@@ -1292,7 +1301,7 @@ function mountTrain(ctx) {
1292
1301
  abChk.checked = false; // 用户要求:不默认勾,想要就自己点
1293
1302
  const abLbl = el('label', 'fs-meta', '训练完生成选模对比');
1294
1303
  abLbl.prepend(abChk);
1295
- abLbl.title = '用同一句训练切片,final 和最后两个中间档各唱一遍,进作品库对比听';
1304
+ abLbl.title = '用下面独立的低、中、高音干声对比 final 和最后两个中间档,关闭检索';
1296
1305
  const lowChk = el('input', 'fs-ck');
1297
1306
  lowChk.type = 'checkbox';
1298
1307
  lowChk.checked = false; // 用户要求:不默认勾(实测只是有限改善)
@@ -1301,6 +1310,14 @@ function mountTrain(ctx) {
1301
1310
  lowLbl.title = '有限改善:把每个切片合成 -2/-4 半音的副本一起训练。实测只能缓解、不能根治"低音不像"(模型在低音区本来就没有音色记忆),且 F0/特征提取时间约 ×3';
1302
1311
  chkRow.append(resumeLbl, rebuildLbl, pruneAfterLbl, abLbl, lowLbl, el('span', 'fs-grow'), startT, stopT);
1303
1312
 
1313
+ const evaluationInputs = ['低音', '中音', '高音'].map(band => {
1314
+ const input = el('input', 'fs-tin');
1315
+ input.placeholder = `${band}独立干声路径(未参与训练,含长音,建议10~30秒)`;
1316
+ return input;
1317
+ });
1318
+ const evaluationBox = el('div', 'fs-list');
1319
+ evaluationBox.append(el('div', 'fs-meta', '选模素材:固定低、中、高音三段独立干声。请确认没有同一首歌的片段进入训练集。'), ...evaluationInputs);
1320
+ const samplingText = el('div', 'fs-meta');
1304
1321
  const tProg = el('div', 'fs-prog');
1305
1322
  const tFill = el('i');
1306
1323
  tProg.append(tFill);
@@ -1320,10 +1337,10 @@ function mountTrain(ctx) {
1320
1337
  const pruneBtn = el('button', 'fs-btn', '清理中间档');
1321
1338
  pruneBtn.title = '只删 assets/weights/<exp>_eN_sX.pth 这种导出的小模型;完整存档、索引、最终模型都不动';
1322
1339
  const abBtn = el('button', 'fs-btn', '生成选模对比');
1323
- abBtn.title = '用当前实验的存档(final + 最后两个中间档)各唱同一句训练切片,生成对比试听进作品库';
1340
+ abBtn.title = '用独立低、中、高音干声对比 final 和最后两个中间档,关闭检索';
1324
1341
  ckptBar.append(el('span', 'fs-meta', '中间档:'), ckptMeta, el('span', 'fs-meta', '每'),
1325
1342
  keepIn, el('span', 'fs-meta', '轮留一个'), el('span', 'fs-grow'), abBtn, pruneBtn);
1326
- trainBox.append(tTitle, tForm, chkRow, tProg, tMsg, losses, lossAxis, tModels, ckptBar);
1343
+ trainBox.append(tTitle, tForm, chkRow, evaluationBox, tProg, tMsg, samplingText, losses, lossAxis, tModels, ckptBar);
1327
1344
 
1328
1345
  let trainExp = '';
1329
1346
  let trainTimer = null;
@@ -1347,7 +1364,7 @@ function mountTrain(ctx) {
1347
1364
  abBtn.disabled = true;
1348
1365
  abBtn.textContent = '生成中…';
1349
1366
  try {
1350
- const r = await ctx.invoke('trainAbTest', [{ exp }]);
1367
+ const r = await ctx.invoke('trainAbTest', [{ exp, evaluationPaths: evaluationInputs.map(input => input.value.trim()) }]);
1351
1368
  tMsg.textContent = (r && r.text) || `选模对比已生成(${exp})`;
1352
1369
  } catch (e) {
1353
1370
  tMsg.textContent = `选模对比失败:${(e && e.message) || e}`;
@@ -1422,6 +1439,11 @@ function mountTrain(ctx) {
1422
1439
  };
1423
1440
 
1424
1441
  const paintTrain = (st) => {
1442
+ const report = st.sampling;
1443
+ const sampleTotal = Object.values(report?.counts || {}).reduce((sum, n) => sum + Number(n), 0);
1444
+ samplingText.textContent = report ? `第 ${report.epoch} 轮采样计划:${sampleTotal} 次 / ${Object.keys(report.counts || {}).length} 个不同切片;` +
1445
+ Object.entries(report.bands || {}).map(([band, n]) => `${({low:'低', mid:'中', high:'偏高', top:'高', unknown:'未知'})[band] || band} ${(Number(n) / (sampleTotal || 1) * 100).toFixed(1)}%`).join(' · ') +
1446
+ (report.replicas > 1 ? '(仅 rank0)' : '') : '实际采样报告:训练启动后显示';
1425
1447
  const job = st.job;
1426
1448
  // 有 job 就看 job;没有但日志还在写 = 重启前留下的训练还在跑,一样要当成「进行中」
1427
1449
  const owned = Boolean(job && job.id);
@@ -1549,13 +1571,14 @@ function mountTrain(ctx) {
1549
1571
  try {
1550
1572
  const r = await call('trainStart', [{
1551
1573
  exp: String(expIn.value || '').trim(),
1552
- epochs: Number(epIn.value) || 200,
1574
+ epochs: Number(epIn.value) || 70,
1553
1575
  batch: Number(bsSel.value) || 4,
1554
1576
  saveEvery: Number(seIn.value) || 10,
1555
1577
  resume: resumeChk.checked,
1556
1578
  rebuild: rebuildChk.checked,
1557
1579
  pruneAfter: pruneAfterChk.checked,
1558
1580
  abTest: abChk.checked,
1581
+ evaluationPaths: evaluationInputs.map(input => input.value.trim()),
1559
1582
  augment: lowChk.checked,
1560
1583
  keepEvery: Math.max(1, Number(keepIn.value) || 50),
1561
1584
  }]);
package/docs/TRAINING.md CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  | 参数 | 怎么填 | 说明 |
38
38
  |---|---|---|
39
- | 实验名 | 随便,已预填 `fishMMDD` | 同名会复用目录;产物在 `logs/<实验名>/` |
39
+ | 实验名 | 已预填 `fishMMDD` | 从头训练必须使用新实验名;产物在 `logs/<实验名>/` |
40
40
  | 轮次 | **40~70**(推荐) | 越多越久;数据量 30 分钟左右,40 轮就能用,70 轮更稳。200 轮一般没必要 |
41
41
  | 批大小 | 4 | 8G 显存用 4;爆显存降到 2 |
42
42
  | 每 N 轮存档 | 10 | 每 10 轮导出一个中间模型到「模型」页,用于选模对比 |
@@ -45,17 +45,17 @@
45
45
 
46
46
  | 勾选 | 什么时候勾 |
47
47
  |---|---|
48
- | 从上次存档继续 | 上次训练中断过、想接着练。面板检测到没训完的记录时会**自动帮你勾上** |
48
+ | 从上次存档继续 | 仅用于数据和增强参数完全一致的断点续训,需要配对 G/D 存档。轮次填目标总轮次。旧实验没有数据指纹时请换新实验名重训 |
49
49
  | 重算特征 | 数据集换过素材、或上次特征提取失败时 |
50
50
  | 训练完自动清理中间档 | 磁盘紧张才勾。**想跑选模对比就别勾**(对比要靠中间档) |
51
- | 训练完生成选模对比 | 推荐勾:训完自动用同一句话把 final / e60 / e50 各唱一遍,进作品库 |
51
+ | 训练完生成选模对比 | 需填写低、中、高音三段独立干声路径,建议每段 10~30 秒并含长音。final 和最后两个中间档使用同样素材,关闭检索后进入作品库 |
52
52
  | 低音增强 | **别指望它治低音**。实测只是有限改善(把切片降 2/4 半音合成副本),特征提取时间 ×3 |
53
53
 
54
54
  点「开始训练」后:
55
55
 
56
56
  - 顶部进度条实时显示 `轮次 · 秒/轮 · 预计剩余时间`
57
- - **mel 曲线往下走 = 在进步**;数字稳定在低位、不再下降 = 已经收敛
58
- - 训练期间 **GPU 被占满,唱不了歌**(会自动排队/抢占),正常
57
+ - mel 曲线反映训练集拟合程度;下降不保证没学过的歌曲效果更好,选模以固定独立试听为准
58
+ - 训练期间 GPU 被占用,唱歌请求会被拒绝
59
59
  - 想停就点「停止训练」——会真正停掉进程(不是假装停),最近一次存档保留
60
60
 
61
61
  ### 时长参考(8G 显存 / batch 4)
@@ -70,7 +70,7 @@
70
70
  ## 3. 训练完之后
71
71
 
72
72
  1. **模型**页会列出 `fishxxxx.pth`(最终)和 `fishxxxx_eN_sX.pth`(每 N 轮一个的中间档)。
73
- 2. **选模对比**:训练完(若勾了)会自动生成——同一句训练切片,final 和最后两个中间档各唱一遍,进作品库。听完选最喜欢的那档。
73
+ 2. **选模对比**:训练完(若勾了)使用三段独立干声,final 和最后两个中间档各唱一遍,进作品库。低音、中音、高音和长音一起听,不用训练切片自测。系统校验文件内容重复,但无法识别同一首歌的不同片段,请自行避免素材泄漏。
74
74
  3. 在「模型」页**手动切换**到新模型(不会自动切)。
75
75
  4. 中间档不听了的,在训练页底部「清理中间档」删掉(每个 ~53 MB)。
76
76
 
@@ -94,12 +94,18 @@
94
94
  | 训练中断:查不到任务 | 0.4.15 已修(网络抖动误报)。若再出现且训练日志也没在动,才需要真排查 |
95
95
  | 训练完「模型」页没有新模型 | 看②里的进度信息是否真的到了 70 轮;`logs/<实验名>/` 里应有 `*.pth` |
96
96
  | 低音还是不像 | 素材里低音太少(<2 分钟基本学不会)。**别靠低音增强硬堆**,只能缓解。根治要等真实低音素材 |
97
- | 想从头重训 | 用新实验名(或删掉 `logs/<实验名>/`)。同实验名 + 勾「从上次存档继续」= 接着练 |
97
+ | 想从头重训 | 用新实验名保留旧实验。同实验名只允许数据一致的断点续训;增加素材后请换新实验名 |
98
98
  | 训练中断:已取消 | 你自己点的停止,不是故障 |
99
99
 
100
100
  ---
101
101
 
102
102
  ## 6. 想深入
103
103
 
104
+ - 训练只使用 manifest 中标为保留的切片,以内容 SHA-256 和增强参数绑定实验。换素材不能复用旧切片和特征。
105
+ - 音高分析失败单独计入“需复查”,完全无发声帧的切片不会进入训练。
106
+ - 权重面板是按长度桶估计的抽样片数比例(非增强、batch4),不是时长比例。训练页另显示当前轮采样计划的音域比例及不同切片数,多卡时报告仅代表 rank0。
107
+ - 低音增强把源片及其副本权重一起除以份数,合计保持原片权重;全体权重相同走均匀采样。副本统计归入原片音域。
108
+ - 同时勾选选模和自动清理时,先完成试听再清理;试听失败保留中间档。
109
+
104
110
  - 音域加权(③ 高级)的原理与实测数据见 [README「训练自己的音色」](../README.md#训练自己的音色)
105
111
  - 版本间的行为变化见 [CHANGELOG](../CHANGELOG.md)
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "cortico-world-fish-sing",
3
- "version": "0.4.24",
4
- "description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
5
- "type": "module",
6
- "main": "./src/index.ts",
7
- "license": "MIT",
8
- "author": "FXYXL",
9
- "keywords": [
10
- "cortico-world",
11
- "cortico",
12
- "coo",
13
- "sing",
14
- "rvc",
15
- "music",
16
- "qq"
17
- ],
18
- "engines": {
19
- "node": ">=22.6"
20
- },
21
- "homepage": "https://github.com/FXYXL/cortico-world-fish-sing#readme",
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/FXYXL/cortico-world-fish-sing.git"
25
- },
26
- "bugs": {
27
- "url": "https://github.com/FXYXL/cortico-world-fish-sing/issues"
28
- },
29
- "cortico": {
30
- "kind": "world",
31
- "api": 6,
32
- "label": "大肥鱼唱歌",
33
- "tags": [
34
- "music",
35
- "qq",
36
- "local"
37
- ],
38
- "describe": "describe.json",
39
- "webUiClient": "dist/webui-b69dd33a.js"
40
- },
41
- "scripts": {
42
- "doctor": "node tools/doctor.mjs"
43
- },
44
- "dependencies": {}
45
- }
1
+ {
2
+ "name": "cortico-world-fish-sing",
3
+ "version": "0.4.25",
4
+ "description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "license": "MIT",
8
+ "author": "FXYXL",
9
+ "keywords": [
10
+ "cortico-world",
11
+ "cortico",
12
+ "coo",
13
+ "sing",
14
+ "rvc",
15
+ "music",
16
+ "qq"
17
+ ],
18
+ "engines": {
19
+ "node": ">=22.6"
20
+ },
21
+ "homepage": "https://github.com/FXYXL/cortico-world-fish-sing#readme",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/FXYXL/cortico-world-fish-sing.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/FXYXL/cortico-world-fish-sing/issues"
28
+ },
29
+ "cortico": {
30
+ "kind": "world",
31
+ "api": 6,
32
+ "label": "大肥鱼唱歌",
33
+ "tags": [
34
+ "music",
35
+ "qq",
36
+ "local"
37
+ ],
38
+ "describe": "describe.json",
39
+ "webUiClient": "dist/webui-79775549.js"
40
+ },
41
+ "scripts": {
42
+ "doctor": "node tools/doctor.mjs"
43
+ },
44
+ "dependencies": {}
45
+ }
package/src/train.ts CHANGED
@@ -6,6 +6,24 @@
6
6
  */
7
7
  import { existsSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
8
8
  import { basename, join } from 'node:path';
9
+ import { createHash } from 'node:crypto';
10
+
11
+ export function validateEvaluation(paths: string[], trainingFiles: string[]): string[] {
12
+ if (paths.length !== 3 || paths.some(p => !p || !existsSync(p) || !statSync(p).isFile())) {
13
+ throw new Error('请分别提供低、中、高音三段独立干声文件(不要使用训练素材)');
14
+ }
15
+ const digest = (p: string) => createHash('sha256').update(readFileSync(p)).digest('hex');
16
+ const hashes = paths.map(digest);
17
+ if (new Set(hashes).size !== 3) throw new Error('三段试听素材不能重复');
18
+ const training = new Set(trainingFiles.filter(p => existsSync(p) && statSync(p).isFile()).map(digest));
19
+ if (hashes.some(h => training.has(h))) throw new Error('试听素材与训练素材内容重复,请换用未参与训练的干声');
20
+ return paths;
21
+ }
22
+
23
+ export function readSamplingReport(expDir: string): unknown {
24
+ try { return JSON.parse(readFileSync(join(expDir, 'sampling_report.json'), 'utf8')); }
25
+ catch { return null; }
26
+ }
9
27
 
10
28
  import type { WorkerClient } from './worker.ts';
11
29
 
@@ -63,6 +81,7 @@ export const DROP_LABEL: Record<string, string> = {
63
81
  too_quiet: '几乎没声音',
64
82
  clipped: '削波',
65
83
  f0_outlier: '音高异常(可能不是人声)',
84
+ f0_analysis_failed: '音高分析失败(需复查)',
66
85
  };
67
86
 
68
87
  export const BAND_LABEL: Record<string, string> = {
@@ -173,6 +192,8 @@ export interface BandRow {
173
192
  /** 加权后的占比 */
174
193
  after: number;
175
194
  weight: number;
195
+ /** 40k / hop400 长度桶的样本数,供前端按桶重算估计值。 */
196
+ buckets: number[];
176
197
  }
177
198
 
178
199
  export const BAND_ORDER: BandId[] = ['low', 'mid', 'high', 'top'];
@@ -282,18 +303,39 @@ function bandOfSlice(s: SliceRecord, mode: BandMode): BandId | 'unknown' {
282
303
  return f0Band(s.f0_median);
283
304
  }
284
305
 
285
- /** 加权后的四档占比(只算时长 × 权重的相对比例)。 */
306
+ /** 按长度桶估计抽样片数占比;非增强、batch4 的预览,实际值见训练采样报告。 */
286
307
  export function weightedRows(m: Manifest, cfg: WeightConfig): BandRow[] {
287
308
  const st = bandStats(m, cfg.mode);
288
- const totalWeighted = BAND_ORDER.reduce((n, id) => n + st[id].seconds * (cfg.bands[id] ?? 1), 0) || 1;
309
+ const buckets = Object.fromEntries(BAND_ORDER.map(id => [id, Array(8).fill(0)])) as Record<BandId, number[]>;
310
+ for (const s of m.slices.filter(s => s.kept)) {
311
+ const band = bandOfSlice(s, cfg.mode);
312
+ const length = Math.floor(s.dur * 100);
313
+ const bucket = Math.ceil(length / 100) - 2;
314
+ if (band !== 'unknown' && bucket >= 0 && bucket < 8) buckets[band][bucket]++;
315
+ }
316
+ const expected = (weighted: boolean) => {
317
+ const counts = Object.fromEntries(BAND_ORDER.map(id => [id, 0])) as Record<BandId, number>;
318
+ let total = 0;
319
+ for (let b = 0; b < 8; b++) {
320
+ const n = BAND_ORDER.reduce((v, id) => v + buckets[id][b], 0);
321
+ if (!n) continue;
322
+ const draws = Math.ceil(n / 4) * 4;
323
+ const denom = BAND_ORDER.reduce((v, id) => v + buckets[id][b] * (weighted ? cfg.bands[id] : 1), 0);
324
+ for (const id of BAND_ORDER) counts[id] += draws * buckets[id][b] * (weighted ? cfg.bands[id] : 1) / denom;
325
+ total += draws;
326
+ }
327
+ return Object.fromEntries(BAND_ORDER.map(id => [id, counts[id] / (total || 1)])) as Record<BandId, number>;
328
+ };
329
+ const before = expected(false), after = expected(true);
289
330
  return BAND_ORDER.map((id) => ({
290
331
  id,
291
332
  label: BAND_LABEL[id] ?? id,
292
333
  n: st[id].n,
293
334
  seconds: Math.round(st[id].seconds),
294
- share: st[id].share,
295
- after: (st[id].seconds * (cfg.bands[id] ?? 1)) / totalWeighted,
335
+ share: before[id],
336
+ after: after[id],
296
337
  weight: cfg.bands[id] ?? 1,
338
+ buckets: buckets[id],
297
339
  }));
298
340
  }
299
341
 
@@ -338,12 +380,12 @@ function clampWeight(v: unknown): number {
338
380
  }
339
381
 
340
382
  /** 供训练阶段用:每片的采样权重数组(顺序与 manifest.slices 中 kept 的一致)。 */
341
- export function sliceWeights(m: Manifest, cfg: WeightConfig): Array<{ file: string; weight: number }> {
383
+ export function sliceWeights(m: Manifest, cfg: WeightConfig): Array<{ file: string; weight: number; band: string }> {
342
384
  return m.slices
343
385
  .filter((s) => s.kept)
344
386
  .map((s) => {
345
387
  const id = bandOfSlice(s, cfg.mode);
346
- return { file: s.file, weight: id === 'unknown' ? 1 : (cfg.bands[id] ?? 1) };
388
+ return { file: s.file, weight: id === 'unknown' ? 1 : (cfg.bands[id] ?? 1), band: id };
347
389
  });
348
390
  }
349
391
 
@@ -548,7 +590,7 @@ export function readTrainLog(expDir: string, maxLines = 400): TrainLog {
548
590
  for (const line of lines) {
549
591
  const m = /====>\s*轮次:(\d+).*?\((\d+):(\d+):([\d.]+)\)/.exec(line);
550
592
  if (m) {
551
- done = Number(m[1]) + 1;
593
+ done = Number(m[1]);
552
594
  secs.push(Number(m[2]) * 3600 + Number(m[3]) * 60 + Number(m[4]));
553
595
  continue;
554
596
  }
@@ -592,10 +634,8 @@ export function readTrainLog(expDir: string, maxLines = 400): TrainLog {
592
634
  /** 训练建议参数:批大小按显存给,轮次按数据量给。 */
593
635
  export function suggestTrainParams(seconds: number): { epochs: number; batch: number; note: string } {
594
636
  const minutes = seconds / 60;
595
- if (minutes < 10) return { epochs: 300, batch: 4, note: '数据不到 10 分钟,轮次要更多才学得动' };
596
- if (minutes < 20) return { epochs: 250, batch: 4, note: '数据偏少,250 轮左右' };
597
- if (minutes < 45) return { epochs: 200, batch: 4, note: '33 分钟左右用 200 轮,之前 dfy2 就是这个配置' };
598
- return { epochs: 160, batch: 4, note: '数据超过 45 分钟,每轮变慢,160 轮通常够了' };
637
+ if (minutes < 10) return { epochs: 40, batch: 4, note: '数据不足 10 分钟,先补素材;40 轮仅作基线试听,增加轮次不能替代数据' };
638
+ return { epochs: 70, batch: 4, note: '先跑 40~70 轮,每 10 轮存档,用独立试听素材选模;loss 下降不代表泛化一定变好' };
599
639
  }
600
640
 
601
641
  // ---------------------------------------------------------------- 中间档清理