ARM-software / armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
https://developer.arm.com/products/processors/machine-learning/arm-nn
MIT License
1.14k stars 307 forks source link

Automatic speech recognition with wav2latter using pyarmnn #648

Closed StuartIanNaylor closed 1 year ago

StuartIanNaylor commented 2 years ago

https://developer.arm.com/documentation/102470/0100?lang=en

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal
python3 run_audio_file.py --audio_file_path tests/testdata/quick_brown_fox_16000khz.wav --model_file_path tflite_int8/wav2letter_int8.tflite 
Your ArmNN library instance does not support Onnx models parser functionality.  Skipped IOnnxParser import.
Traceback (most recent call last):
  File "run_audio_file.py", line 99, in <module>
    main(args)
  File "run_audio_file.py", line 60, in main
    network = ArmnnNetworkExecutor(args.model_file_path, args.preferred_backends)
  File "/home/pi/workspace/armnn/python/pyarmnn/examples/speech_recognition/../common/network_executor.py", line 22, in __init__
    self.network_id, self.runtime, self.input_binding_info, self.output_binding_info = self.create_network()
  File "/home/pi/workspace/armnn/python/pyarmnn/examples/speech_recognition/../common/network_executor.py", line 70, in create_network
    opt_network, messages = ann.Optimize(network, preferred_backends, runtime.GetDeviceSpec(),
  File "/usr/lib/python3/dist-packages/pyarmnn/_generated/pyarmnn.py", line 3950, in Optimize
    return _pyarmnn.Optimize(*args)
RuntimeError: None of the preferred backends [CpuAcc CpuRef ] are supported. Current platform provides []

I have now gone through the majority of your armnn examples figured out much of the incorrect paths and typo's that all have in relative abundance to be quite bemused at the impression you set with me thinking this is Arm surely this would be better. I have given up totally as obviously not is all well with your team on this as it just doesn't bode well. Your repo's don't work, your binaries only work with a singular very basic example, your compiles fail and you can not write a single tutorial where a copy and paste doesn't fail and the user has to try and work out what is really needed.

Seriously I am really really surprised but never used any of the Arm software services before, but you guys are the worst experience by quite a long margin. So much so I had to question a few prominent AI Pi based bloggers just to confirm its not just me and unfortunately its a common consensus you are managing to build.

FrancisMurtagh-arm commented 1 year ago

Hi @StuartIanNaylor,

Was the above issue resolved by using armnn-latest-all as mentioned in this ticket? https://github.com/ARM-software/armnn/issues/704

It looks like from the above that none of the backend packages were installed. Perhaps libarmnnX (X being ABI version) was installed on its own?

FWIW there is more info on our Packages here: https://github.com/ARM-software/armnn/blob/branches/armnn_22_11/InstallationViaAptRepository.md

I'm going to raise a ticket with docs team about this command that incorrectly uses libarmnn-latest-all instead of armnn-latest-all: https://developer.arm.com/documentation/102603/2108/Device-specific-installation/Install-on-Odroid-N2-Plus

sudo apt-get install -y python3-pyarmnn libarmnn-latest-all

Regards, Francis.

StuartIanNaylor commented 1 year ago

Great stuff Francis as apols for the critique but hope it has been constructive.

Is there also any way to quantise a LM (Language model) as without apart from load the results can be slightly underwhelming :) I am only giving feedback on this but when I 1st saw it it made me think its probably not useful, but then I didn't know about adding a LM or KenLM n-gram

https://huggingface.co/blog/wav2vec2-with-ngram

As just in discussion as an example raw wav2vec is pretty ropey if you know what I mean?

Happy new year all and thanks for listening.

FrancisMurtagh-arm commented 1 year ago

Hi @StuartIanNaylor,

Is the model PyTorch or TfLite? There is Post training quantization for TfLite but I'm not sure about PyTorch: https://www.tensorflow.org/lite/performance/post_training_quantization

Quick search for PyTorch found this but I haven't dealt with it. https://pytorch.org/docs/stable/quantization.html

Best of luck, Francis.

FrancisMurtagh-arm commented 1 year ago

https://developer.arm.com/documentation/102603/2211/Device-specific-installation/Install-on-Odroid-N2-Plus

Docs now updated and published.

Thanks, Francis.