-
Notifications
You must be signed in to change notification settings - Fork 588
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
Hi! is there any example implementation of streaming for this model: https://huggingface.co/marcoyang/icefall-libri-giga-pruned-transducer-stateless7-streaming-2023-04-04 #178
Comments
Please see k2-fsa/icefall#984 If you want to use it in sherpa-onnx, please follow |
Thanks a lot! Can this be used for streaming purpose by using a microphone in real time like sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 model. I had previously tried the icefall-asr-multidataset-pruned_transducer_stateless7-2023-05-04 for streaming but its output is not real time streaming and requires input to start and stop the recording, the output is really good however. Please let me know if I am approaching this in the right way, thanks in advance! |
Yes, you can. The URL name contains |
Okay, I had a used the icefall-asr-multidataset-pruned_transducer_stateless7-2023-05-04 with the speech-recognition-from-microphone.py in sherpa-onnx for real time streaming transcription without the need for pressing enter to start/stop record. When I replace the encoder decoder and joiner with the miltidataset model I get the following error (base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % python3 ./python-api-examples/speech-recognition-from-microphone.py
Is this because the model was not made for real-time streaming inference? |
The reason is that you didn't export the model correctly. Could you describe how you exported the model in detail? |
I am using this model https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-transducer/zipformer-transducer-models.html#icefall-asr-multidataset-pruned-transducer-stateless7-2023-05-04-englis This is already exported to be used with ONNX right? I wanted to use it with speech-recognition-from-microphone.py python file so i replaced the code given in the example cd /path/to/sherpa-onnx python3 ./python-api-examples/speech-recognition-from-microphone.py with the icefall code (base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % python3 ./python-api-examples/speech-recognition-from-microphone.py I exported the model as described in the website GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/yfyeung/icefall-asr-multidataset-pruned_transducer_stateless7-2023-05-04 But I want to use the model with the speech-recognition-from-microphone.py file for real time ASR without having to press 'enter' key The icefall model is a Transducer model right, I wanted to use this with speech-recognition-from-microphone.py |
Previously, you were asking
so I thought you want to use it for streaming recognition. I replied with yes
But now you are switching to a different model:
The above model is not a streaming model (there is no streaming in the URL, so it is a non-streaming model); thus |
There is an |
Okay got it, sorry for the miscommunication. Thanks for clearing it up. I wanted a model for real time streaming ASR and the icefall-asr-multidataset model was very good hence I asked about that As you said that the icefall-libri-giga-pruned-transducer-stateless7-streaming model is for streaming I will use it for my purpose. But as the model hasn't been exported as onnx I wanted to know if the other icefall model could be used. I was looking at ways to export the icefall-libra-giga-pruned model in onnx but wanted a solution in the meantime hence I started looking at other models. My bad for not noticing the offline. Could you let me know any onnx model which is as good as the icefall model which I can use for real time streaming immediately. Thanks! |
Then please export it by yourself by following #178 (comment) If you have any issues during export, we can help you. |
Okay sure, thanks I will do that I wanted to know, do I need to install Icefall for exporting model to ONNX? |
Yes, please following icefall installation doc to setup the environment. |
Do I need to follow step (0) Install CUDA toolkit and cuDNN for running icefall on MacOS ARM chip. |
No, you don't have to. You can install a cpu version of PyTorch and k2 for exporting models from icefall. |
I followed the steps to install icefall, first I installed PyTorch CPU then k2 using requirements.txt and lhoste all in a virtual environment, but after installing icefall with requirements and trying to run test I get this error (test-icefall) (base) fawazahamedshaik@Fawazs-MacBook-Pro ASR % ./prepare.sh |
you are probably inside some virtual environment where icefall is not
installed?
anyway it is not really necessary to install, you can just do, in your case:
export PYTHONPATH=$PYTHONPATH:/Users/fawazahamedshaik/icefall
(or put it in your .bashrc or edit your virtual environment activate.sh or
whatever).
which is more convenient anyway in case you change the code or change the
branch,
no installation needed.
…On Mon, Jun 19, 2023 at 10:50 AM CaetLearn ***@***.***> wrote:
I followed the steps to install icefall, first I installed PyTorch CPU
then k2 using requirements.txt and lhoste all in a virtual environment, but
after installing icefall with requirements and trying to run test I get
this error
(test-icefall) (base) ***@***.*** ASR %
./prepare.sh
2023-06-19 13:47:01 (prepare.sh:27:main) dl_dir:
/Users/fawazahamedshaik/icefall/egs/yesno/ASR/download
2023-06-19 13:47:01 (prepare.sh:30:main) Stage 0: Download data
/Users/fawazahamedshaik/icefall/egs/yesno/ASR/download/waves_yesno.tar.gz:
100%|██████████████████████████████████████████████| 4.70M/4.70M
[00:01<00:00, 2.42MB/s]
2023-06-19 13:47:13 (prepare.sh:39:main) Stage 1: Prepare yesno manifest
2023-06-19 13:47:14 (prepare.sh:45:main) Stage 2: Compute fbank for yesno
Traceback (most recent call last):
File
"/Users/fawazahamedshaik/icefall/egs/yesno/ASR/./local/compute_fbank_yesno.py",
line 18, in
from icefall.utils import get_executor
ModuleNotFoundError: No module named 'icefall'
—
Reply to this email directly, view it on GitHub
<#178 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO4C32FHQOM53MX2UB3XMCGQDANCNFSM6AAAAAAZKV4FWM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hello, I did the export PYTHONPATH=$PYTHONPATH:/Users/fawazahamedshaik/icefall and this solved the not installed issue but I am getting a new issue when running ./prepare.sh logs: Is this related to PyTorch? |
What is the output of python3 -m torch.utils.collect_env |
This is the output (test-icefall) (base) fawazahamedshaik@Fawazs-MacBook-Pro ASR % python -m torch.utils.collect_env OS: macOS 13.3.1 (x86_64) Python version: 3.9.13 (main, Aug 25 2022, 18:29:29) [Clang 12.0.0 ] (64-bit runtime) CPU: Versions of relevant libraries: |
Please read the output carefully. You have installed two versions of k2, each of which is compiled with a different version of PyTorch, i.e., torch 1.13.1 and torch 2.0.1. Please don't do that. Please make sure there is only one version of k2 in your current environment. |
I suggest that if you're not familiar with conda, please switch to pip install and don't use conda install. Most if not all users who are having issues are using conda. |
Okay, I will uninstall the one installed in conda, I cannot see icefall in the installed libraries is that fine? |
I followed installation guide in Icefall website and only used pip, I also deactivated the conda base env (test-icefall) fawazahamedshaik@Fawazs-MacBook-Pro ASR % ./prepare.sh One thing I noticed is, when installing k2 with I notice this in the logs: (test-icefall) fawazahamedshaik@Fawazs-MacBook-Pro k2 % export K2_MAKE_ARGS="-j6" CMake Warning (dev) at /Users/fawazahamedshaik/opt/anaconda3/lib/python3.9/site-packages/torch/share/cmake/Caffe2/public/mkl.cmake:1 (find_package): CMake variable MKL_ROOT is set to:
For compatibility, CMake is ignoring the variable. I assume the problem is with CMake when I run python -m torch.utils.collect_env I get: OS: macOS 13.3.1 (x86_64) Python version: 3.9.13 (main, Aug 25 2022, 18:29:29) [Clang 12.0.0 ] (64-bit runtime) CPU: Versions of relevant libraries: Here I notice that mkl and mcl-service is both installed in conda, is it because of this that I am getting error? Sorry for the repeated error, I want to know what I am doing wrong in install process |
Please make sure you have deactivated conda completely. There are multiple versions of PyTorch in your current environment, i.e.,
Please don't do that. Please see #178 (comment)
Make sure you only have one version of PyTorch in your current environment. |
Hello, I was able to export the model in the demo https://k2-fsa.github.io/icefall/model-export/export-onnx.html#export-the-model-to-onnx finally it says that the exported files are in: encoder-epoch-99-avg-1.onnx but I cannot find this directory nor the files. |
Could you post the last few lines of the export log or post the export command you are using? The exported files are in the exp directory you specified. |
Okay, I followed the guide and exported as per the lines in the guide It will generate the following 3 files in $repo/exp this is my code: So it must be in $repo/exp when I use my directory I get this error Can you also guide me on how to use this in sherpa-onyx, like how I should modify the code to run it in sherpa-onnx |
What is the value of
Could you please post the link to the guide you are following? Make sure you don't miss any command in the guide. |
I followed the guide in documentation, link: https://k2-fsa.github.io/icefall/model-export/export-onnx.html#export-the-model-to-onnx $repo gives me I found the files in the cloned repo in exp in this folder icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29 But there are 6 files generated here is the photo ![]() Which files should I use, and can you explain how I can use them in sherpa-onnx |
Please show the output of
|
So you have managed to find the generated files, congratulations! |
Do I need to move these files to sherpa-onnx directory? the generated files are currently in the icefall directory and I am planning to export the https://huggingface.co/marcoyang/icefall-libri-giga-pruned-transducer-stateless7-streaming-2023-04-04 next, will the output be the same? I wanted to know the syntax of the code I need to create with the generated files, as I can see the encoder, decoder and joiner are present in the syntax, do I need to replace them with the generated onnx files? |
Yes, please use absolute path names if you are not sure.
No, you don't need to do that. You can place it anywhere as long as you pass the correct path to |
Yes, it should be the same. |
I have exported the model to ONNX. Please see |
Thank you so much! I was also looking forward to use my exported model so I will try that as well...I have a problem when running the model it says file not found but the files are in the directory code for microphone air: logs with error: checking if files are present in the dir: as you can see tokens.txt is present in the given dir but it says missing. |
What does it output? |
This is the output (my_env) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % ls -lh ./icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/exp/tokens.txt |
I got this tokens.txt file in icefall-asr-librispeech-pruned-transducer-stateless7-streaming-2022-12-29/data/lang-bpe-500 and I moved it to the main directory along with the decoder encoder and joiner files |
I see. Please run
and read the output carefully. You don't need to use |
This worked Thanks a lot!!! And thank you so much for exporting the giga libri pruned transducer model! I was planning to do that next. I am planning to use other models, namely Nvidia NeMo streaming models (I'm not sure if they have those but ill look) for streaming by converting them to ONNX next Hopefully that goes well. Thanks again! |
Is there a link to the NeMo streaming model? Is it trained by CTC or transducer loss? |
I am checking but so far I see models which only decode audio files (wav files) |
It appears to be that they are using conformer models for cache aware streaming as per this link they also have Buffered ASR/Chunked Inference for both conformer and rnnt models in this link but I do not think this is streaming https://github.com/NVIDIA/NeMo/tree/main/examples/asr/asr_chunked_inference |
After some digging I found that QuartzNet15x5Base-En model which is a EncDecCTCModel can be implemented for streaming ASR with mic as per their demo notebook: https://github.com/NVIDIA/NeMo/blob/stable/tutorials/asr/Online_ASR_Microphone_Demo.ipynb Model details are in: https://catalog.ngc.nvidia.com/orgs/nvidia/models/nemospeechmodels I think other NeMo EncDecCTCModels can be used for streaming ASR, do you think these can be exporting ed to ONNX and used in sherpa-onnx? |
If you can find a way to export it to ONNX, we can change sherpa-onnx to support that. Support for streaming ctc models is on the plan. |
Hi I saw this model trained for streaming https://huggingface.co/marcoyang/icefall-libri-giga-pruned-transducer-stateless7-streaming-2023-04-04 is there any example implementation or is it the same as implementing the sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 model.
Are the steps used for this reproducible for the icefall libra giga model
The text was updated successfully, but these errors were encountered: