自动化批量处理全流程指南
LiberSonora的批量处理功能可实现端到端的流水线作业:
- 准备工作
1. 创建规范目录结构:
├── input/
│ ├── book1/
│ │ ├── chapter1.mp3
│ │ └── chapter2.mp3
│ └── book2/
└── output/
2. 准备batch_config.json定义处理步骤 - 配置文件示例
{
"pipeline": [
{"step": "subtitles", "params": {"model": "large-v2"}},
{"step": "translate", "params": {"target_lang": ["zh","es"]}},
{"step": "title", "params": {"style": "novel"}}
],
"concurrency": 2
}
- 启动批量处理
执行命令:
python batch_processor.py --config batch_config.json --input_dir ./input --output_dir ./output
系统会自动:
1. 遍历所有子目录
2. 按配置顺序执行处理步骤
3. 生成结构化输出(保留原始目录树) - 监控与优化
1. 查看progress.log实时进度
2. 失败任务会自动重试(max_retries=3)
3. 支持断点续传(–resume参数)
4. 资源监控(–monitor参数显示GPU/CPU使用率) - 高级技巧
1. 使用–priority给紧急任务插队
2. 通过exclude_regex跳过测试文件
3. 结合crontab实现定时批量处理
本答案来源于文章《LiberSonora:有声书字幕提取与多语言翻译,有声小说转录为多语言》