k2-fsa / sherpa

Speech-to-text server framework with next-gen Kaldi
https://k2-fsa.github.io/sherpa
Apache License 2.0
518 stars 104 forks source link

Does there any pure python inference code for a single mode? #133

Open lucasjinreal opened 1 year ago

lucasjinreal commented 1 year ago

Hi, for a newbie in asr, it's really hard to understand what c++ doing step by step, does there any pure python script can inference lstm transducer model? (by reading a wav file then output text)

csukuangfj commented 1 year ago

Yes, I just added one via https://github.com/k2-fsa/sherpa/pull/134

Please see https://github.com/k2-fsa/sherpa/blob/master/sherpa/bin/lstm_transducer_stateless/offline_asr.py

You can find the usage in https://github.com/k2-fsa/sherpa/blob/21f829ce5816ce1ef1b00c7e7f194b69386f1dca/sherpa/bin/lstm_transducer_stateless/offline_asr.py#L17-L75