diff --git a/FUNASR_README.md b/FUNASR_README.md index ad52b09..94e0dab 100644 --- a/FUNASR_README.md +++ b/FUNASR_README.md @@ -26,7 +26,7 @@ ~~~powershell python -m pip install -r requirements.txt if (-not (Test-Path .env)) { Copy-Item .env.example .env } -python scripts/download_models.py --funasr-runtime +python scripts/download_models.py ~~~ 在两个终端中分别启动后端和前端: diff --git a/README.md b/README.md index bd71b15..ea801f5 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ ~~~powershell python -m pip install -r requirements.txt if (-not (Test-Path .env)) { Copy-Item .env.example .env } -python scripts/download_models.py --funasr-runtime +python scripts/download_models.py ~~~ -`--funasr-runtime` 会下载流式 Paraformer、Contextual 热词模型、FSMN-VAD、CAM++ 和标点模型。若要下载 `model_manifest.json` 中列出的全部模型资源,请运行 `python scripts/download_models.py`。 +默认运行 `python scripts/download_models.py` 会下载当前 ASR 模型、热词定稿模型及清单中的辅助模型;已完整下载的模型会自动跳过。 ## 启动 diff --git a/backend/auxiliary_server.py b/backend/auxiliary_server.py index 9cc73bd..0346f81 100644 --- a/backend/auxiliary_server.py +++ b/backend/auxiliary_server.py @@ -212,7 +212,7 @@ class AuxiliaryRuntime: ) raise RuntimeError( "Auxiliary core model is missing or failed to load: " + details - + ". Run python scripts/download_models.py --funasr-runtime, " + + ". Run python scripts/download_models.py, " "or set MODEL_DIR/CAM_MODEL_PATH to the local CAM++ asset." ) diff --git a/scripts/download_models.py b/scripts/download_models.py index 6d89800..add92e4 100644 --- a/scripts/download_models.py +++ b/scripts/download_models.py @@ -181,11 +181,6 @@ def main() -> int: action="store_true", help="Only download/check configured auxiliary assets", ) - auxiliary_group.add_argument( - "--funasr-runtime", - action="store_true", - help="下载或检查流式 ASR、Contextual 热词 ASR、FSMN-VAD、CAM++ 和标点模型", - ) args = parser.parse_args() manifest = load_manifest() @@ -196,46 +191,18 @@ def main() -> int: cache_dir = args.cache_dir.resolve() if args.cache_dir else None selected_assets: list[tuple[str, dict[str, object]]] = [] hotword_model_id = str(manifest.get("hotword_model") or "").strip() - if args.funasr_runtime: - # 标点模型在运行时可选,但下载后可获得完整的本地输出。 - asr_id = resolve_model_id(args.model, manifest) - model_ids = [asr_id] + # 不带模型筛选参数时,默认下载当前 ASR、热词模型和清单中的辅助模型。 + if not args.auxiliary_only: + model_id = resolve_model_id(args.model, manifest) + model_ids = [model_id] if hotword_model_id: model_ids.append(resolve_model_id(hotword_model_id, manifest)) selected_assets.extend( - (model_id, manifest["models"][model_id]) - for model_id in dict.fromkeys(model_ids) + (selected_id, manifest["models"][selected_id]) + for selected_id in dict.fromkeys(model_ids) ) - assets = auxiliary_models(manifest) - vad_id = next( - model_id for model_id, config in assets.items() - if config.get("kind") == "vad" - ) - cam_id = next( - model_id for model_id, config in assets.items() - if config.get("kind") == "speaker_verification" - and model_id.startswith("iic/") - ) - punctuation_id = next( - model_id for model_id, config in assets.items() - if config.get("kind") == "punctuation" - ) - selected_assets.extend( - (model_id, assets[model_id]) - for model_id in (vad_id, cam_id, punctuation_id) - ) - else: - if not args.auxiliary_only: - model_id = resolve_model_id(args.model, manifest) - model_ids = [model_id] - if hotword_model_id: - model_ids.append(resolve_model_id(hotword_model_id, manifest)) - selected_assets.extend( - (selected_id, manifest["models"][selected_id]) - for selected_id in dict.fromkeys(model_ids) - ) - if not args.skip_auxiliary: - selected_assets.extend(auxiliary_models(manifest).items()) + if not args.skip_auxiliary: + selected_assets.extend(auxiliary_models(manifest).items()) missing: list[tuple[str, Path, dict[str, object]]] = [] for model_id, config in selected_assets: