Skip to content

ASR Inference Failure: Disallowed special<|no|>` causes single-sample transcription crash in batch processing #3110

Description

@14790897

🐛 Bug

ASR transcription failed with special token validation error during batch dataset inference, while most samples run normally with stable RTF performance.

To Reproduce

code: https://www.kaggle.com/code/liuweiq/funasr-recog-script?scriptVersionId=333049663

Code sample

    hotword = load_vocab(vocab_path)
    if hotword:
        print(f"已加载专业词汇:{hotword}")
    else:
        print("未找到词汇表文件,使用默认识别模式")
    
    print("\n正在加载模型...")
    model = AutoModel(
        model="FunAudioLLM/Fun-ASR-Nano-2512",
        hub="hf",
        trust_remote_code=True,
        vad_model="funasr/fsmn-vad",
        vad_kwargs={"max_single_segment_time": 30000},
        spk_model="funasr/campplus",
        device="cuda:0",
    )
    print("模型加载完成")
    
    audio_extensions = ('.mp3', '.wav', '.flac', '.ogg', '.m4a', '.MP3', '.WAV', '.FLAC')
    audio_files = [f for f in os.listdir(audio_dir) if f.endswith(audio_extensions)]
    
    if not audio_files:
        print("未找到音频文件")
        return
    
    print(f"\n找到 {len(audio_files)} 个音频文件")
    
    success_count = 0
    fail_count = 0
    
    for audio_file in audio_files:
        audio_path = os.path.join(audio_dir, audio_file)
        if transcribe_audio(audio_path, output_dir, hotword, model):
            success_count += 1
        else:
            fail_count += 1

Expected behavior

no error

Error logs

<html>
<body>
<!--StartFragment-->
2441.9s | 18781 |  
-- | -- | --
2441.9s | 18782 |  
2441.9s | 18783 | {'load_data': '0.000', 'extract_feat': '0.007', 'forward': '0.652', 'batch_size': '1', 'rtf': '0.247'}, :  55%\|�[34m█████▍    �[0m\| 56/102 [00:33<00:28,  1.64it/s]
2441.9s | 18784 | {'load_data': '0.000', 'extract_feat': '0.007', 'forward': '0.652', 'batch_size': '1', 'rtf': '0.247'}, :  55%\|�[34m█████▍    �[0m\| 56/102 [00:33<00:28,  1.64it/s]�[A
2442.6s | 18785 | �[A {'load_data': '0.000', 'extract_feat': '0.007', 'forward': '0.652', 'batch_size': '1', 'rtf': '0.247'}, :  55%\|�[34m█████▍    �[0m\| 56/102 [00:34<00:27,  1.65it/s]
2442.6s | 18786 | {'load_data': '0.000', 'extract_feat': '0.007', 'forward': '0.652', 'batch_size': '1', 'rtf': '0.247'}, :  55%\|�[34m█████▍    �[0m\| 56/102 [00:34<00:27,  1.65it/s]
2442.6s | 18787 | 0%\|�[31m          �[0m\| 0/1 [06:48<?, ?it/s]
2442.6s | 18788 |  
2442.7s | 18789 | 转录失败: Encountered text corresponding to disallowed special token '<\|no\|>'.
2442.7s | 18790 | If you want this text to be encoded as a special token, pass it to `allowed_special`, e.g. `allowed_special={'<\|no\|>', ...}`.
2442.7s | 18791 | If you want this text to be encoded as normal text, disable the check for this token by passing `disallowed_special=(enc.special_tokens_set - {'<\|no\|>'})`.
2442.7s | 18792 | To disable this check for all special tokens, pass `disallowed_special=()`.
2442.7s | 18793 |  

<br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>

Environment

  • OS: Linux 6.12.90+
  • Python version: 3.12.13
  • FunASR version: 1.3.14
  • ModelScope version: 1.38.0
  • PyTorch / torchaudio version: 2.10.0+cu128 / 2.10.0+cu128
  • Install method (pip, source, Docker): pip
  • Device (cuda, cpu, mps): cuda
  • GPU model: Tesla T4
  • CUDA/cuDNN version: 12.8 / 91002
  • Docker image tag, if used: gcr.io/kaggle-gpu-images/python@sha256:37c64f7dd9c54116ecd1bcc88817c5469b88387388fade02bfa8bf3fc647d461

Audio details

If the audio cannot be shared, please describe:

Duration 3h 13m 38s(11,617s)
Sample rate 16,000 Hz
Format MP3 (MPEG audio layer 3)
Bit rate 64 kbps
Channels 2 (stereo)
Sample format 32-bit float planar
File size 88.6 MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNeeds maintainer triage and routing

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions