Commit Graph
12 Commits
Author SHA1 Message Date
游雁 4967c8bd8e feat: add Qwen3-ASR speaker diarization; remove unnecessary punc_model from SPK examples
- Qwen3-ASR: support spk_model with forced_aligner for speaker diarization
- Qwen3-ASR: fix list input handling (numpy/tensor to tuple format)
- Qwen3-ASR: output timestamp as [start_ms, end_ms] for pipeline compatibility
- Qwen3-ASR: graceful fallback when forced_aligner not configured
- Remove punc_model from Fun-ASR-Nano/SenseVoice/Qwen3-ASR SPK demos and tests
  (these models output punctuation natively)
- Fix test scripts to handle both text/sentence keys in sentence_info
- auto_model: set return_time_stamps=True when spk_model present
2026-05-21 04:38:21 +00:00
游雁 106cbb69a3 feat: add ERes2NetV2 speaker model with full AutoModel integration
Integrates ERes2NetV2 from 3D-Speaker into FunASR as a speaker
verification/diarization model. Can be used standalone or as spk_model
combined with VAD + ASR for speaker-attributed transcription.

Usage (standalone speaker embedding):
    model = AutoModel(model="iic/speech_eres2netv2_sv_zh-cn_16k-common")
    res = model.generate(input="audio.wav")
    embedding = res[0]["spk_embedding"]  # shape: [1, 192]

Usage (with ASR + speaker diarization):
    model = AutoModel(
        model="paraformer-zh",
        vad_model="fsmn-vad",
        spk_model="iic/speech_eres2netv2_sv_zh-cn_16k-common",
    )
    res = model.generate(input="audio.wav")

Tested end-to-end: ModelScope download + embedding extraction verified.

New files:
- funasr/models/eres2net/eres2netv2.py (network architecture)
- funasr/models/eres2net/model.py (FunASR wrapper with inference)
- tests_models/test_eres2netv2.py
- examples/industrial_data_pretraining/eres2netv2_sv/demo.py
- examples/industrial_data_pretraining/eres2netv2_sv/demo_sv.py
2026-05-20 05:27:53 +00:00
游雁 8ee8ad63b9 test: add Qwen3-ASR and GLM-ASR to run_all_tests.py 2026-05-20 05:08:04 +00:00
游雁 8a0c727051 feat: add GLM-ASR-Nano model support
Add GLMASR wrapper class integrating GLM-ASR-Nano-2512 (1.5B) into
FunASR. Uses HuggingFace transformers AutoModel + AutoProcessor with
trust_remote_code. Supports 17 languages with dialect and low-volume
speech optimization.

Usage:
    from funasr import AutoModel
    model = AutoModel(model="zai-org/GLM-ASR-Nano-2512", hub="hf", device="cuda:0")
    res = model.generate(input="audio.wav")

    # ModelScope (Chinese users)
    model = AutoModel(model="ZhipuAI/GLM-ASR-Nano-2512", hub="ms", device="cuda:0")

Tested end-to-end on CPU with Chinese and English audio.

New files:
- funasr/models/glm_asr/model.py
- funasr/models/glm_asr/__init__.py
- tests_models/test_glm_asr.py
- examples/industrial_data_pretraining/glm_asr/demo.py
- examples/industrial_data_pretraining/glm_asr/demo_ms.py

Note: requires transformers>=5.0.0 (pip install git+https://github.com/huggingface/transformers)
2026-05-20 04:15:11 +00:00
游雁 06e03d7bab refactor: Qwen3ASR follows standard AutoModel hub download convention
Usage now follows FunASR convention:

    from funasr import AutoModel
    model = AutoModel(model="Qwen/Qwen3-ASR-1.7B", hub="hf", device="cuda:0")
    res = model.generate(input="audio.wav", language="Chinese")

Changes:
- Register model class under hub paths ("Qwen/Qwen3-ASR-1.7B",
  "Qwen/Qwen3-ASR-0.6B") so AutoModel can resolve them after
  download_from_hf finds no configuration.json
- model_path defaults to kwargs["model"] for hub path compatibility
- Update test to use standard AutoModel(model=..., hub="hf") pattern

Tested end-to-end: AutoModel downloads from HuggingFace and runs
inference correctly.
2026-05-20 02:23:06 +00:00
游雁 8d3e77a6b9 feat: add Qwen3-ASR model support via AutoModel
Add Qwen3ASR wrapper class that integrates the qwen-asr package into
FunASR's registry system, following standard AutoModel usage pattern:

    from funasr import AutoModel
    model = AutoModel(
        model="Qwen3ASR",
        model_conf={"model_path": "Qwen/Qwen3-ASR-1.7B", "dtype": "bf16"},
        device="cuda:0",
    )
    res = model.generate(input="audio.wav", language="Chinese")

Supports:
- Multi-language ASR (52 languages)
- Auto language detection
- Forced language mode
- Timestamp output via forced aligner
- HuggingFace/ModelScope model loading

Tested end-to-end with Chinese and English audio on CPU (0.6B model).

New files:
- funasr/models/qwen3_asr/model.py
- funasr/models/qwen3_asr/__init__.py
- tests_models/test_qwen3_asr.py
2026-05-20 02:18:13 +00:00
游雁 378f022d87 feat: add Qwen3-ASR model support
Add Qwen3ASR wrapper class that integrates the qwen-asr package into
FunASR's registry system. Supports:
- Multi-language ASR (52 languages)
- Auto language detection
- Forced language mode
- Timestamp output via forced aligner
- Both HuggingFace and ModelScope model loading

New files:
- funasr/models/qwen3_asr/model.py
- funasr/models/qwen3_asr/__init__.py
- tests_models/test_qwen3_asr.py
2026-05-19 18:16:26 +00:00
游雁 bff79be1a2 fix: add super().__init__() to SinusoidalPositionEncoder classes; add VAD streaming test
- Fix SinusoidalPositionEncoder and StreamSinusoidalPositionEncoder in transformer/embedding.py
- Fix SinusoidalPositionEncoder in sense_voice/model.py
- Missing super().__init__() caused state_dict() crash with newer PyTorch versions
- Add test_fsmn_vad_streaming.py: chunk-by-chunk VAD test with consistency check
2026-05-19 16:46:37 +00:00
游雁 4bb33425a8 perf: optimize _reset_runtime_configs to skip deepcopy of immutable objects
- Skip deepcopy for large immutable objects (token_list, tokenizer, frontend, etc.)
- Only deepcopy mutable dict/list values that may be modified during inference
- Reduces per-call overhead from 352ms to 0.1ms (3459x improvement)
- Rewrite streaming test to use proper chunk-by-chunk input
- Verified: 5 consecutive streaming sessions produce identical output
2026-05-19 16:31:15 +00:00
游雁 7649fe2217 test: add SenseVoice + speaker diarization integration test 2026-05-19 14:57:24 +00:00
游雁 a424f4c6b6 feat: support speaker diarization for Fun-ASR-Nano (#2844)
- Convert dict-format timestamps to list-format for downstream compatibility
- Fix spk_embedding to concatenate all chunk embeddings from sv_chunk
- Handle timestamps/timestamp key difference in vad_segment mode
- Auto fallback to vad_segment mode when punc_model is missing
- Add demo_spk.py example and test script
- Update README/README_zh with news and usage demo
2026-05-19 13:35:16 +00:00
zhifu.gzf 266b8a24ae Add model integration tests for major models (VAD, Paraformer, SenseVoice, CAM++, CT-Transformer, Streaming) 2026-05-19 11:27:29 +00:00