@icyfenix-dmla/cli 2026.5.2-1955 → 2026.5.2-1959
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/package.json +1 -1
- package/src/commands/data.js +49 -33
package/package.json
CHANGED
package/src/commands/data.js
CHANGED
|
@@ -419,54 +419,70 @@ async function downloadDatasets() {
|
|
|
419
419
|
return
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
//
|
|
423
|
-
|
|
424
|
-
|
|
422
|
+
// 检查 Git 环境
|
|
423
|
+
try {
|
|
424
|
+
execSync('git --version', { stdio: 'pipe' })
|
|
425
|
+
} catch {
|
|
426
|
+
console.log(chalk.red('❌ Git 未安装'))
|
|
427
|
+
console.log(chalk.yellow('下载数据集需要 Git,请先安装: https://git-scm.com/downloads'))
|
|
428
|
+
return
|
|
429
|
+
}
|
|
425
430
|
|
|
426
|
-
|
|
427
|
-
|
|
431
|
+
// 构建选项列表
|
|
432
|
+
const choices = DATASETS.map((dataset, index) => {
|
|
428
433
|
const downloaded = isDatasetDownloaded(dataPath, dataset.id)
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
434
|
+
return {
|
|
435
|
+
name: index.toString(),
|
|
436
|
+
message: `${dataset.name} (${dataset.size})${downloaded ? ' [已下载]' : ''}`,
|
|
437
|
+
disabled: downloaded || dataset.id === 'mnist'
|
|
438
|
+
}
|
|
439
|
+
})
|
|
433
440
|
|
|
434
|
-
|
|
435
|
-
console.log(chalk.gray('提示:
|
|
441
|
+
// MNIST 特殊提示
|
|
442
|
+
console.log(chalk.gray('提示: MNIST 数据集将在训练时通过 torchvision 自动下载'))
|
|
443
|
+
console.log(chalk.gray('操作: 上下键选择,空格勾选/取消,回车确认下载'))
|
|
436
444
|
console.log()
|
|
437
445
|
|
|
438
|
-
const {
|
|
439
|
-
type: '
|
|
440
|
-
name: '
|
|
441
|
-
message: '
|
|
446
|
+
const { selected } = await prompt({
|
|
447
|
+
type: 'multiselect',
|
|
448
|
+
name: 'selected',
|
|
449
|
+
message: '选择要下载的数据集',
|
|
450
|
+
choices,
|
|
451
|
+
hint: '空格选择,回车确认',
|
|
452
|
+
warn: '已下载或不可选'
|
|
442
453
|
})
|
|
443
454
|
|
|
444
|
-
if (
|
|
455
|
+
if (!selected || selected.length === 0) {
|
|
456
|
+
console.log(chalk.yellow('未选择任何数据集'))
|
|
445
457
|
return
|
|
446
458
|
}
|
|
447
459
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
460
|
+
// 下载选中的数据集
|
|
461
|
+
for (const indexStr of selected) {
|
|
462
|
+
const index = parseInt(indexStr)
|
|
463
|
+
const dataset = DATASETS[index]
|
|
453
464
|
|
|
454
|
-
|
|
465
|
+
console.log()
|
|
466
|
+
console.log(chalk.cyan(`────────────────────────────────────`))
|
|
455
467
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
468
|
+
// MNIST 特殊处理
|
|
469
|
+
if (dataset.id === 'mnist') {
|
|
470
|
+
console.log(chalk.yellow('MNIST 数据集将在训练时通过 torchvision 自动下载'))
|
|
471
|
+
continue
|
|
472
|
+
}
|
|
461
473
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
474
|
+
// 检查是否已下载
|
|
475
|
+
if (isDatasetDownloaded(dataPath, dataset.id)) {
|
|
476
|
+
console.log(chalk.yellow(`${dataset.name} 已下载,跳过`))
|
|
477
|
+
continue
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
await downloadDataset(dataPath, dataset)
|
|
466
481
|
}
|
|
467
482
|
|
|
468
|
-
|
|
469
|
-
|
|
483
|
+
console.log()
|
|
484
|
+
console.log(chalk.cyan(`────────────────────────────────────`))
|
|
485
|
+
console.log(chalk.green('所有选中的数据集已处理完成'))
|
|
470
486
|
}
|
|
471
487
|
|
|
472
488
|
/**
|