FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

SeacoParaformer的generate_hotwords_list函数有问题,导致hotword无法使用

Open darcyOly999 opened this issue 7 months ago • 0 comments

以下代码中: ` elif not hotword_list_or_file.endswith(".txt"):

        logging.info("Attempting to parse hotwords as str...")

        hotword_list = []

        hotword_str_list = []

        for hw in hotword_list_or_file.strip().split():

            hotword_str_list.append(hw)

            hw_list = hw.strip().split()

            if seg_dict is not None:

                hw_list = seg_tokenize(hw_list, seg_dict)

            hotword_list.append(tokenizer.tokens2ids(hw_list))

        hotword_list.append([self.sos])

        hotword_str_list.append("<s>")

        logging.info("Hotword list: {}.".format(hotword_str_list))

`

hw_list = hw.strip().split()导致hw转为list后,tokens2ids只能获取错误的token,shape也成了(1,) 需要改为 hotword_list.append(tokenizer.tokens2ids(hw_list[0]))

darcyOly999 avatar Mar 20 '25 06:03 darcyOly999