-
|
c++ decoding already supports hot words,how to use fst howtwords in python pipline? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Sorry, we do not have this plan. |
Beta Was this translation helpful? Give feedback.
-
|
Update for current FunASR: the 2023 reply predates the current Python hotword API. There is one important distinction:
For the current Python pipeline: from funasr import AutoModel
model = AutoModel(
model="paraformer-zh",
vad_model="fsmn-vad",
punc_model="ct-punc",
device="cpu",
disable_update=True,
)
wav_file = f"{model.model_path}/example/asr_example.wav"
plain = model.generate(
input=wav_file,
batch_size_s=300,
)[0]
biased = model.generate(
input=wav_file,
batch_size_s=300,
hotword="魔搭",
)[0]
print(plain["text"])
print(biased["text"])Verified with FunASR 1.3.14 on CPU: Both results contained the same 14 timestamps; only the biased term changed. For multiple hotwords, use a whitespace-separated string: model.generate(input=wav_file, hotword="达摩院 魔搭")You can also pass a UTF-8 model.generate(input=wav_file, hotword="/path/to/hotwords.txt")The current parser for string, local-file, and URL inputs is here: For Fun-ASR-Nano, the API is different and uses the plural list argument: model.generate(input=wav_file, hotwords=["达摩院", "魔搭"])If you specifically require weighted WFST/FST decoding, use the C++/ONNX runtime or server and pass a weighted hotword file with That path is documented in the online runtime guide and offline runtime guide. A Python websocket client may call that runtime server, but that is different from loading an FST into the local Python For very large vocabularies, the tutorial also documents |
Beta Was this translation helpful? Give feedback.
Update for current FunASR: the 2023 reply predates the current Python hotword API.
There is one important distinction:
AutoModelpipeline does not load a compiled WFST/FST graph.paraformer-zhsupports SeACo neural hotword bias through the singularhotwordargument.For the current Python pipeline: