Skip to content

runtime error for audio file in which there is actually no speech (blank voice) #1386

Closed

Description

@jianganghan

🐛 Bug

To Reproduce

from funasr import AutoModel

model = AutoModel(model="paraformer-zh", model_revision="v2.0.4",
vad_model="fsmn-vad", vad_model_revision="v2.0.4",
punc_model="ct-punc-c", punc_model_revision="v2.0.4",)

result = model.generate(input=common_voice_zh-CN_33658424.mp3.zip,
batch_size_s=300,)

Expected behavior

The above attached audio file is blank voice, so the reasonable output can be result = [{'key': 'xxx', 'text': '', 'timestamp': []}]. However, the above code run into the following RuntimeError:
RuntimeError: Expected tensor for argument #1 'indices' to have one of the following scalar types: Long, Int; but got torch.cuda.DoubleTensor instead (while checking arguments for embedding)

My guess is that asr model output empty text, which however can not be appropriately handled by the current code in the punc model.

Environment

  • OS: Linux
  • FunASR Version: 1.0.5
  • ModelScope Version: 1.12.0
  • PyTorch Version: 1.12.0
  • How you installed funasr: pip
  • Python version: 3.9
  • GPU: p40
  • CUDA/cuDNN version: 113

Activity

  1. R1ckShi commented on Feb 27, 2024

    @R1ckShi
    Collaborator

    thanks for feedback, bug has been fixed, please pull the latest code

  2. OoKyleoO commented on Mar 1, 2024

    @OoKyleoO

    Hi, I've pull the latest code and still having the same issue.
    Is there any mistake in my code?
    self.audio_model.generate(input=[audio], batch_size_s=300, is_final=True, sentence_timestamp=True, hotwords=' '.join(list(self.keywords))

  3. jianganghan commented on Mar 1, 2024

    @jianganghan
    ContributorAuthor

    It works for me. You may want to try the latest code with recent changes, eg changes in this pr.

  4. OoKyleoO commented on Mar 1, 2024

    @OoKyleoO

    It works for me. You may want to try the latest code with recent changes, eg changes in this pr.

    I'll try now. THX!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions