25acf9db6e
横向对比云端 gummy 与本地开源模型(faster-whisper/SenseVoice/Paraformer), 重点覆盖中英混说,产出准确率(CER/WER/MER)/速度(延迟/RTF)/资源(cpu/mem/模型大小) 对比报告。公共集(ASCEND/AISHELL/LibriSpeech)统一走 HF 适配器 + 自定义 JSONL manifest。 gummy 引擎对照 server/internal/asr/gummy.go 协议移植。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
726 B
Python
26 lines
726 B
Python
"""数据集注册表:config 的 type(hf|custom) 映射到适配器。
|
||
|
||
公共集(ASCEND/AISHELL/LibriSpeech)统一走 HFDataset,差异全在 config.yaml 里描述
|
||
(hf_id/split/text_field/lang),所以"广覆盖 + 自定义"只需改配置,不必加代码。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from .base import Dataset
|
||
|
||
|
||
def build_dataset(cfg: dict, audio_cache: str) -> Dataset:
|
||
dtype = cfg["type"]
|
||
if dtype == "hf":
|
||
from .hf import HFDataset
|
||
|
||
return HFDataset(cfg, audio_cache)
|
||
if dtype == "custom":
|
||
from .custom import CustomDataset
|
||
|
||
return CustomDataset(cfg)
|
||
raise ValueError(f"未知数据集类型: {dtype}")
|
||
|
||
|
||
__all__ = ["Dataset", "build_dataset"]
|