Commit Graph
5612 Commits
Author SHA1 Message Date
li-lizhe ae5c4ccdec Remove hard torchaudio dependency for inference; add kaldi-native-fbank fbank backend (#3526)
* Remove hard torchaudio dependency for inference; add kaldi-native-fbank fbank backend

Make torchaudio an optional dependency for the inference path so FunASR
can run on Ascend NPU (aarch64) servers, where no matching torchaudio
wheel exists (Huawei's Ascend torch is version-decoupled from the PyTorch
upstream release line).

- Add funasr/utils/fbank.py: an fbank shim that delegates to
  torchaudio.compliance.kaldi when torchaudio is installed, otherwise
  falls back to kaldi-native-fbank (a torch-free C++ library with aarch64
  wheels). Options and frame-shift API are mapped to torchaudio semantics
  so outputs are equivalent.
- Switch funasr/frontends/wav_frontend.py, funasr/utils/speaker_utils.py
  and funasr/models/campplus/utils.py to the shim.
- Make the torchaudio import optional in funasr/utils/load_utils.py
  (resampler falls back to librosa).

No device-specific branching is introduced — a pure backend fallback that
also benefits CPU-only and other accelerator platforms.

Verified end-to-end on Ascend 910B (npu:0) with torchaudio absent:
paraformer-large loads and infers correctly, RTF ~0.016 (~60x realtime).

* Make torchaudio import optional in paraformer_v2, fun_asr_nano and dataset preprocessors

Follow-up to the inference-path change: make the remaining top-level
torchaudio imports optional so these modules import cleanly when
torchaudio is not installed (e.g. on Ascend NPU servers).

- funasr/models/paraformer_v2_community/model.py
- funasr/models/fun_asr_nano/tools/utils.py
- funasr/datasets/audio_datasets/preprocessor.py
- funasr/datasets/llm_datasets/preprocessor.py

Functions that still require torchaudio (forced_align, Resample) degrade
to a clear error only when called, rather than a hard import failure.

* Address review: declare knf extra, harden fbank fallback and torchaudio guards

Respond to maintainer review feedback.

- Declare kaldi-native-fbank as an optional 'knf' extra in setup.py; the
  fbank module now raises an actionable ImportError only when fbank() is
  actually called with neither torchaudio nor kaldi-native-fbank installed
  (previously it failed at import time with a bare ModuleNotFoundError).
- Harden the fbank fallback contract: handle the channel argument explicitly
  and reject torchaudio-only options (subtract_mean, min_duration, VTLN
  warping, non-default blackman_coeff) with NotImplementedError instead of
  silently dropping them via **kwargs.
- Add a shared guard funasr/utils/torchaudio_compat.py and use it for
  resampling, forced alignment and speed perturbation so a missing torchaudio
  fails loudly instead of returning a silently wrong result (empty alignment).
- Add regression tests (tests/test_torchaudio_optional.py) that import the
  affected modules with torchaudio absent.
2026-08-27 00:23:11 +08:00
zhifu gao b2915020b2 chore(release): prepare 1.4.4 (#3530)
Prepare the FunASR 1.4.4 hotfix release with realtime WebSocket concurrency batching, PyTorch AMP compatibility, and correct runtime-binding exceptions.

Signed-off-by: LauraGPT <[email protected]>
v1.4.4
2026-08-26 23:36:15 +08:00
zhifu gao 55daa5a193 fix(realtime): batch concurrent websocket decoding (#3529)
Fix the realtime WebSocket concurrency regression by removing the process-wide session lock and batching compatible vLLM decode requests. Isolate per-session VAD runtime state while sharing encoder weights, keep batch failures contained, and document reproducible concurrency benchmarks.

Fixes #3528

Signed-off-by: LauraGPT <[email protected]>
2026-08-26 23:30:20 +08:00
谢翊凡 9413d7d768 fix: use torch.amp via compatibility shim (#3518)
Use the non-deprecated torch.amp APIs when available while preserving the torch.cuda.amp fallback and legacy autocast argument semantics on older PyTorch releases.
2026-08-26 20:10:53 +08:00
zhifu gao 8c60d27837 Raise real exceptions instead of strings in the runtime Python bindings (#3524)
Replace invalid string raises with real chained exceptions so runtime users keep the underlying import or download failure.

Local verification covered all seven changed files with `py_compile`, `git diff --check`, and an AST audit of all 30 changed exception paths.

Signed-off-by: LauraGPT <[email protected]>
2026-08-24 22:38:23 +08:00
Leonard Li 4999dc7632 Raise real exceptions instead of strings in the runtime Python bindings
`raise "some message"` is invalid in Python 3 — a str is not an exception — so
the interpreter discards the message and raises

    TypeError: exceptions must derive from BaseException

instead. Paired with a bare `except:`, the original cause is lost too, and the
user is told to install something they may already have.

Concretely: funasr was installed, but importing it failed on a missing
torchaudio. The message said 'please install funasr', the traceback said
TypeError, and the actual ModuleNotFoundError was nowhere to be seen.

This converts all 30 occurrences under runtime/python to real exceptions:

  - guarded imports        -> except ImportError as e: raise ImportError(...) from e
  - everything else        -> except Exception as e:  raise RuntimeError(...) from e

`from e` keeps the original traceback, so a missing transitive dependency stays
visible. Narrowing the bare `except:` also stops unrelated failures from being
reported as a missing package — the model_dir branch in particular fired for any
failure, so a mistyped path also surfaced as TypeError.

Messages are unchanged. No behaviour changes beyond the exception type.
2026-08-22 12:35:50 -04:00
zhifu gaoandLauraGPT 3c58cb56a5 docs: record v1.4.3 publication closeout (#3522)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-21 12:17:04 +08:00
zhifu gaoandLauraGPT 510a15ca3d docs: publish v1.4.3 release guide (#3520)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-21 12:09:46 +08:00
zhifu gao eedd4e22d1 chore(release): prepare 1.4.3 (#3519)
Release FunASR 1.4.3 with the optional Silero VAD adapter and scalable fixed-K diarization clustering.\n\nSigned-off-by: zhifu gao <[email protected]>
v1.4.3
2026-08-21 11:39:49 +08:00
zhifu gao 0d96c573f9 Merge pull request #3516 from tandede/fix/large-known-speaker-clustering
fix(diarization): scale known-speaker clustering for long audio
2026-08-20 13:07:52 +08:00
tandede 9dbf3e1c08 fix(diarization): scale clustering with known speaker counts 2026-08-20 01:15:55 +08:00
zhifu gao bff7039942 Merge pull request #3512 from modelscope/codex/site-ecosystem-integrations-20260817
docs(site): feature merged ecosystem integrations
2026-08-17 13:32:58 +08:00
LauraGPT a5d43be169 docs(site): feature merged ecosystem integrations
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 05:29:32 +00:00
zhifu gao afa5da63f0 docs(deploy): verify realtime v1.4.2 quickstart (#3511)
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 10:34:05 +08:00
zhifu gaoandLauraGPT 16c31c0109 ops(growth): track SGLang Fun-ASR CI gate (#3510)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-17 09:44:30 +08:00
zhifu gaoandLauraGPT 4a58b27293 docs(growth): record four-repo homepage routing (#3509)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-17 09:28:47 +08:00
zhifu gaoandLauraGPT 2cb615c429 docs(site): route homepage traffic to all four repositories (#3508)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-17 09:22:22 +08:00
zhifu gaoandLauraGPT 73c1ccd43d docs: record OpenMAIC launch announcement (#3507)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-17 08:57:39 +08:00
zhifu gao 40346ff5ac Merge pull request #3505 from modelscope/codex/growth-ledger-openmaic-20260817
docs: record OpenMAIC distribution launch
2026-08-17 08:50:02 +08:00
LauraGPT 676d8976e4 docs: record OpenMAIC distribution launch
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 00:49:23 +00:00
zhifu gao 0d663c6d7f Merge pull request #3504 from modelscope/codex/website-contract-runtime-v020-20260817
test: track current llama.cpp runtime contract
2026-08-17 08:47:48 +08:00
LauraGPT b4018dacae test: track current llama.cpp runtime contract
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 00:46:25 +00:00
zhifu gao 7825bbbe09 Merge pull request #3503 from modelscope/codex/openmaic-ecosystem-20260817
docs: feature OpenMAIC local FunASR integration
2026-08-17 08:36:50 +08:00
LauraGPT fa2bb1c28e docs: feature OpenMAIC local FunASR integration
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 00:32:51 +00:00
zhifu gao 2e8873a2a1 Merge pull request #3502 from modelscope/codex/growth-ledger-vision-3496-20260817
docs: refresh ecosystem growth operations
2026-08-17 08:11:50 +08:00
LauraGPT 2c44e898a2 docs: refresh ecosystem growth operations
Signed-off-by: LauraGPT <[email protected]>
2026-08-17 00:10:26 +00:00
zhifu gao 9c6df1784c Merge pull request #3501 from modelscope/codex/docs-mlx-ecosystem-20260817
docs: publish MLX Audio Fun-ASR integration
2026-08-17 06:09:18 +08:00
LauraGPT 89a761ed67 docs: publish MLX Audio Fun-ASR integration
Signed-off-by: LauraGPT <[email protected]>
2026-08-16 22:05:25 +00:00
zhifu gaoandLauraGPT d7178079e0 docs: correct product site capability claims (#3500)
Signed-off-by: LauraGPT <[email protected]>
Co-authored-by: LauraGPT <[email protected]>
2026-08-17 05:44:58 +08:00
zhifu gao 4df55195b3 Merge pull request #3499 from modelscope/codex/site-official-repo-footer-20260817
docs(site): surface official repositories in footer
2026-08-17 04:55:50 +08:00
LauraGPT 7db30d2e95 docs(site): surface official repositories in footer
Signed-off-by: LauraGPT <[email protected]>
2026-08-16 20:51:49 +00:00
zhifu gao 74ca876864 Merge pull request #3498 from modelscope/codex/product-site-discovery-metadata-20260817
fix(site): publish accurate deployment discovery metadata
2026-08-17 01:49:36 +08:00
LauraGPT fe92e3a4d1 fix(site): publish deployment discovery metadata
Signed-off-by: LauraGPT <[email protected]>
2026-08-16 17:45:54 +00:00
zhifu gao 2e4914e7f9 Merge pull request #3497 from modelscope/codex/site-llamacpp-blog-v020-20260815
docs: refresh llama.cpp deployment blog
2026-08-15 03:23:23 +08:00
zhifu gao 534f83ce04 docs: refresh llama.cpp deployment blog
Signed-off-by: zhifu gao <[email protected]>
2026-08-14 19:19:11 +00:00
zhifu gao 9041074856 Merge pull request #3494 from wuhongsheng/silero_vad
feat(vad): add Silero VAD adapter
2026-08-14 15:39:48 +08:00
LauraGPT e8ea59a02c fix(vad): preserve Silero ONNX CPU inputs 2026-08-14 07:35:21 +00:00
LauraGPT 419674e544 fix(vad): keep Silero inputs on the model device 2026-08-14 07:32:23 +00:00
wuhongsheng 22920822a2 feat(vad): add Silero VAD adapter 2026-08-14 11:13:32 +08:00
zhifu gao 79a0ed22e1 Merge pull request #3491 from modelscope/docs/llamacpp-campplus-boundary-20260813
docs: clarify llama.cpp speaker diarization support
v1.4.2
2026-08-13 17:43:32 +08:00
zhifu gao 6394ae915e Merge current main into docs/llamacpp-campplus-boundary-20260813
Signed-off-by: zhifu gao <[email protected]>
2026-08-13 09:42:45 +00:00
zhifu gao 3861be24a1 Merge pull request #3492 from modelscope/codex/product-site-vllm-native-20260813
docs: validate native FunASR on vLLM 0.27.1
2026-08-13 17:30:07 +08:00
LauraGPT d1b22baf37 docs: validate native FunASR on vLLM 0.27.1
Signed-off-by: LauraGPT <[email protected]>
2026-08-13 09:26:23 +00:00
zhifu gao 65bbd29f60 docs: clarify llama.cpp speaker diarization support
Signed-off-by: zhifu gao <[email protected]>
2026-08-13 02:15:55 +00:00
zhifu gao 1dbc9b3ef1 Merge pull request #3490 from modelscope/codex/site-audio-cpp-mainline-20260813
docs(site): mark audio.cpp SenseVoice as merged to main
2026-08-13 04:38:46 +08:00
LauraGPT d1e320c0ca docs(site): mark audio.cpp SenseVoice as merged to main
Signed-off-by: LauraGPT <[email protected]>
2026-08-12 20:34:35 +00:00
zhifu gao 5104ae64fe Merge pull request #3489 from modelscope/codex/site-sensevoice-native-server-20260813
docs(site): add SenseVoice native server deployment
2026-08-13 04:00:22 +08:00
LauraGPT 2469fb73e7 docs(site): add SenseVoice native server deployment
Signed-off-by: LauraGPT <[email protected]>
2026-08-12 19:54:57 +00:00
zhifu gao 5c1db4feec Merge pull request #3488 from modelscope/codex/fix-site-evidence-mobile-overflow-20260813
fix(site): prevent mobile evidence overflow
2026-08-13 02:54:32 +08:00
LauraGPT 7c6075a5b8 fix(site): prevent mobile evidence overflow 2026-08-12 18:50:20 +00:00