mirror of
https://github.com/modelscope/FunASR.git
synced 2026-10-12 02:19:18 +00:00
SeACo-Paraformer and Contextual Paraformer turn every line of a hotword .txt file into a hotword. A blank line (e.g. an extra newline at the end of the file) became an empty hotword, and its zero length made pack_padded_sequence raise "Length of all samples has to be greater than 0" in the bias encoder, so inference failed. The file was also opened with codecs.open() without an encoding, i.e. the locale encoding. On Windows a UTF-8 Chinese hotword file decoded into mojibake, so every hotword became <unk> (or reading raised UnicodeDecodeError on GBK locales). Read the local and downloaded hotword files as UTF-8 and skip blank lines, matching parse_hotword_file() in funasr/utils/postprocess_hotwords.py.