Initial commit: audio2text 双语字幕生成服务

- 音频/视频转双语(英/中)SRT 字幕,Docker 容器化,CPU 开发/GPU 生产同一份代码
- faster-whisper ASR(词级时间戳) + 断句时间戳重算 + NLLB 翻译(模型不共驻)
- 分片上传(断点续传) + SQLite 持久化 + 主页/历史/日志页面
- 历史页文件名搜索;缓存定时清理(默认保留7天,可配置)
- 双 Dockerfile(cpu/gpu) + setup/start/stop 脚本
This commit is contained in:
2026-07-06 06:54:19 +00:00
commit 00e2a95fb7
44 changed files with 4110 additions and 0 deletions

56
config.gpu.yaml Normal file
View File

@@ -0,0 +1,56 @@
# audio2text — GPU 生产配置NVIDIA 3090 24G
# 模型按之前指定选型,质量优先:
# ASR = whisper large-v3-turbo8x 速度,质量接近 large-v3
# 翻译 = NLLB-200-distilled-1.3B(质量最好)
# ASR 与翻译不共驻:翻译时卸载 Whisper 独占显存跑大 batch。
server:
host: 0.0.0.0
port: 8000
workers: 1
storage:
upload_dir: /data/uploads
work_dir: /data/.work
output_dir: /data/outputs
chunk_bytes: 1048576
chunk_session_ttl_seconds: 300
cache_retention_days: 7 # 任务产物保留天数,超期清理(字幕/中间音频/保留的原始视频+DB记录
cache_cleanup_interval_hours: 24 # 定时清理间隔(启动时跑一次,之后循环)
processing:
delete_original_after_extract: true
keep_audio: false
asr:
model: large-v3-turbo # 8x 速度,质量接近 large-v3
device: cuda
compute_type: float16 # 3090 FP16速度与显存兼顾
language: en
word_timestamps: true
vad_filter: true
translation:
model: facebook/nllb-200-distilled-1.3B # 质量最好
device: cuda
src_lang: eng_Latn
tgt_lang: zho_Hans
batch_size: 16 # 不共驻时显存独占,大 batch
max_length: 256
segmentation:
max_words_per_line: 14
max_duration_seconds: 7.0
min_duration_seconds: 1.0
max_chars_per_line: 42
logging:
level: info # debug=详细子步骤, info=仅阶段转换, error=完整 traceback
buffer_size: 2000
docs:
enabled: true
username: admin
password: "CHANGE_ME"
realm: "audio2text docs"