Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input format of SherpaOnnxCreateOnlineStreamWithHotwords #2 #1697

Open
EvanParallax opened this issue Jan 9, 2025 · 1 comment
Open

Input format of SherpaOnnxCreateOnlineStreamWithHotwords #2 #1697

EvanParallax opened this issue Jan 9, 2025 · 1 comment

Comments

@EvanParallax
Copy link

#1647

Hello again.

I tried to reproduce the example with hotwords for std::unique_ptr CreateStream(const std::string &hotwords) const;
* @param The hotwords for this string, it might contain several hotwords,
* the hotwords are separated by "/". In each of the hotwords, there
* are cjkchars or bpes, the bpe/cjkchar are separated by space (" ").
* For example, hotwords I LOVE YOU and HELLO WORLD, looks like:
*
* "▁I ▁LOVE ▁YOU/▁HE LL O ▁WORLD"

with those parameters:

Encoder : encoder-epoch-99-avg-1.onnx
Decoder : decoder-epoch-99-avg-1.onnx
Joiner : joiner-epoch-99-avg-1.onnx
from https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-en-20M-2023-02-17.tar.bz2
-Vocab : *converted to .vocab bpe.model
Tokens : tokens.txt
from https://huggingface.co/desh2608/icefall-asr-librispeech-pruned-transducer-stateless7-streaming-small/tree/main/data/lang_bpe_500
Provider : "cpu"
DecodingMethod : "modified_beam_search"
EnableEndpoint : 1
Rule1MinTrailingSilence : 2.4f
Rule2MinTrailingSilence : 0.8f
Rule3MinUtteranceLength : 20f
ModelingUnit : "bpe"
HotwordsScore : 4.0f;
ModelType : "zipformer"
other model config parameters are default.
hotwords string - "▁I ▁LOVE ▁YOU/▁HE LL O ▁WORLD" .
First question is how can i detect that it working with hotwords? It recognizes phares "I LOVE YOU" and "HELLO WORLD" with or without setting hotwords. Dunno, maybe it's a matter of accent or pronunciation, english is not my native language.

Second question is what am i doing wrong if i want to pass an abbreviation when creating online stream like "▁K F C", tokens for each separate characters is in tokens file.

Third question is are you going to simplify the api for SherpaOnnxCreateOnlineStreamWithHotwords? I would assume that OnlineRecognizer does the same transformation with the hotwords file to bring it to the form "▁I ▁LOVE ▁YOU/▁HE LL O ▁WORLD" using passed vocab or tokens file. Is it possible to encapsulate this logic inside SherpaOnnxCreateOnlineStreamWithHotwords?

thank you.

@csukuangfj
Copy link
Collaborator

First question is how can i detect that it working with hotwords?

If you can reproduce the example in the doc, then it works.


Please follow the doc for how to convert words to tokens. Don't write it by hand, use tools instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants