sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

What type of LM can be used in Sherpa-Onnx for offline/online recognizer for ASR? it is a query rather than an issue

Open programindz opened this issue 1 month ago • 3 comments

I want to know what format and what type of language model (lm) we can use for the online and offline recognizer, I am using a transducer model. I want to use a kenlm model for better inference, is it possible to use and do i have to train the kenlm token-wise or word wise?.

Also I'm confused for the parameter lodr_fst. Can anyone explain what that is.

Attached is the Python based implementation from the Sherpa-onnx:

class OfflineRecognizer(object):
    """A class for offline speech recognition.

    Please refer to the following files for usages
     - https://github.com/k2-fsa/sherpa-onnx/blob/master/sherpa-onnx/python/tests/test_offline_recognizer.py
     - https://github.com/k2-fsa/sherpa-onnx/blob/master/python-api-examples/offline-decode-files.py
    """

    @classmethod
    def from_transducer(
        cls,
        encoder: str,
        decoder: str,
        joiner: str,
        tokens: str,
        num_threads: int = 1,
        sample_rate: int = 16000,
        feature_dim: int = 80,
        dither: float = 0.0,
        decoding_method: str = "greedy_search",
        max_active_paths: int = 4,
        hotwords_file: str = "",
        hotwords_score: float = 1.5,
        blank_penalty: float = 0.0,
        modeling_unit: str = "cjkchar",
        bpe_vocab: str = "",
        debug: bool = False,
        provider: str = "cpu",
        model_type: str = "transducer",
        rule_fsts: str = "",
        rule_fars: str = "",
        lm: str = "",
        lm_scale: float = 0.1,
        hr_dict_dir: str = "",
        hr_rule_fsts: str = "",
        hr_lexicon: str = "",
        lodr_fst: str = "",
        lodr_scale: float = 0.0,
    ):

programindz avatar Oct 29 '25 13:10 programindz