Closed joncitoai closed 1 month ago
please post complete logs.
please post complete logs.
Traceback (most recent call last):
File "C:/Veronica/proj/python_api__examples_speech_recognition_from_microphone.py", line 67, in
I'm only a beginner with Python. I can get nothing to work, not SR or Decode files. I have python 3.9 and 3.12 on Windows 10. What are the sherpa:onnx *.exe files for? I was really excited when I first saw all the modules you have. Please help and I promise I'll give feedback.
And another thing:
Traceback (most recent call last):
File "C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_ncnn\recognizer.py", line 65, in
Please describe how you installed sherpa-onnx and list the steps to reproduce your issue.
Also, please run the following python script and post the output
import sherpa_ncnn
print(sherpa_ncnn.__file__)
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sherpa_ncnn print(sherpa_ncnn.file) C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpancnn_ init__.py
pip install sherpa-onnx Using the examples in Python api examples folder. I've tried SR with mic and decode files and the only thing to give me any output is this: import sherpa_onnx from sherpa_onnx import OfflineRecognizer import wave import numpy as np
tokens="C:/Veronica/models/en/sherpa-onnx-paraformer-en-2024-03-09/tokens.txt"
paraformer="C:/Veronica/models/en/sherpa-onnx-paraformer-en-2024-03-09/model.int8.onnx"
config="C:/Veronica/models/en/sherpa-onnx-paraformer-en-2024-03-09/config.yaml"
model = (r'C:/Veronica/models/en/sherpa-onnx-paraformer-en-2024-03-09/model.int8.onnx')
recognizer = sherpa_onnx.offline_recognizer.OfflineRecognizer.from_paraformer(paraformer, tokens)
audio_path = (r'C:/Users/Jonathan/Documents/voice recordings/03.wav')
sample_rate = 16000
wf = wave.open(audio_path, "rb")
stream = recognizer.create_stream()
recognized_text = stream.result print("Recognized Text:", recognized_text)
And I got this:
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.
= RESTART: C:\Veronica\proj\sherpa rec aud file naked.py Recognized Text: {"lang": "", "emotion": "", "event": "", "text": "", "timestamps": [], "tokens":[], "words": []}
If I can't use stream.accept_waveform(sample_rate, audio_path) there's nothing to recognize, is there?
I give English classes in Venezuela and on-line. I built SR and TTS projects in Visual Basic 6 which are still being used by some of the poorer educational establishments. I gave them away. With the offline versions of your SR and TTS I could really build something for them to be happy about! And in different languages, not just English.
Sorry, please describe how you install sherpa-ncnn
.
And please see https://github.com/k2-fsa/sherpa-ncnn/issues/363#issuecomment-2412791365
pip install sherpa_ncnn
Also, please run the following python script and post the output
import sherpa_ncnn print(sherpa_ncnn.__file__)
Could you have a look at this comment? Thanks!
pip install sherpa_ncnn
Please also show the installation logs.
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sherpa_ncnn print(sherpa_ncnn.file) C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_ncnn init.py
I posted this.
pip install sherpa_ncnn
Please also show the installation logs.
Sorry, but where do I find the installation logs?
File "C:/Veronica/proj/python_api__examples_speech_recognition_from_microphone.py", line 28, in create_recognizer
recognizer = sherpa_ncnn.Recognizer(
TypeError: Recognizer() takes no arguments
please show the output of
print(help(sherpa_ncnn.Recognizer))
I put the command in line 2 of recognizer..py: Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.
= RESTART: C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_ncnn\recognizer.py
Traceback (most recent call last):
File "C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_ncnn\recognizer.py", line 2, in
make sure you have run
import sherpa_ncnn
import sherpa_ncnn
line 1 to 11 recognizer.py
from pathlib import Path print(help(sherpa_ncnn.Recognizer)) import numpy as np from _sherpa_ncnn import ( DecoderConfig, EndpointConfig, FeatureExtractorConfig, ModelConfig, ) from _sherpa_ncnn import Recognizer as _Recognizer from _sherpa_ncnn import RecognizerConfig
Also, please run the following python script and post the output
import sherpa_ncnn print(sherpa_ncnn.__file__)
Could you have a look at this comment? Thanks!
If you know how to run these two, I assume you know
import sherpa_ncnn
print(help(sherpa_ncnn.Recognizer))
import sherpa_ncnn print(help(sherpa_ncnn.Recognizer))
C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_ncnn>py
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sherpa_ncnn print(help(sherpa_ncnn.Recognizer)) Help on class Recognizer in module sherpa_ncnn.recognizer:
class Recognizer(builtins.object) | A class for streaming speech recognition. |
---|---|
Please refer to | |
<https://k2-fsa.github.io/sherpa/ncnn/pretrained_models/index.html> _ |
|
to download pre-trained models for different languages, e.g., Chinese, | |
English, etc. | |
Usage example | |
.. code-block:: python3 | |
Data descriptors defined here: | |
dict | |
dictionary for instance variables | |
weakref | |
list of weak references to the object |
None
I only downloaded ncnn this morning but I've been working with onnx and the same issues.
The same test: import sherpa_onnx print(help(sherpa_onnx.Recognizer)) yielded the following: C:\Users\Jonathan\AppData\Local\Programs\Python\Python312\Lib\site-packages\sherpa_onnx>py
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sherpa_onnx print(help(sherpa_onnx.Recognizer)) Traceback (most recent call last): File "
", line 1, in AttributeError: module 'sherpa_onnx' has no attribute 'Recognizer'
but then I tried print(help(sherpa_onnx.OfflineRecognizer)) and got this: Help on class OfflineRecognizer in module sherpa_onnx.offline_recognizer:
class OfflineRecognizer(builtins.object) | A class for offline speech recognition. |
---|---|
Please refer to the following files for usages | |
- https://github.com/k2-fsa/sherpa-onnx/blob/master/sherpa-onnx/python/tests/test_off |
line_recognizer.py | - https://github.com/k2-fsa/sherpa-onnx/blob/master/python-api-examples/offline-decod e-files.py |
---|---|
Methods defined here: | |
create_stream(self, hotwords: Optional[str] = None) | |
decode_stream(self, s: _sherpa_onnx.OfflineStream) | |
decode_streams(self, ss: List[_sherpa_onnx.OfflineStream]) | |
---------------------------------------------------------------------- | |
Class methods defined here: | |
from_nemo_ctc(model: str, tokens: str, num_threads: int = 1, sample_rate: int = 16000, |
feature_dim: int = 80, decoding_method: str = 'greedy_search', debug: bool = False, provi der: str = 'cpu', rule_fsts: str = '', rule_fars: str = '') | Please refer to | <https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/nemo/index.ht ml> _ |
to download pre-trained models for different languages, e.g., Chinese, | English, etc. |
---|---|---|---|---|
Args: | ||||
model: |
-- More --
please describe step.by step what you have done.
Please post screenshots like the above ones.
File "C:/Veronica/proj/python_api__examples_speech_recognition_from_microphone.py", line 67, in
By the way, please don't rename any files.
Please download files directly from https://github.com/k2-fsa/sherpa-ncnn/tree/master/python-api-examples
By the way, please pay attention to the difference between sherpa-onnx
and sherpa-ncnn
.
One is for ncnn
, the other is for onnx
.
I am asking for sherpa-ncnn
and the topic of the issue is also about sherpa-ncnn
.
Please repost your result for sherpa-ncnn
.
I suggest that you just copy and paste the commands I posted in my screenshots.
Also, please switch to another directory to run your command, e.g., C:\
or D:\
.
Thanks for you time.
Have you fixed the issue? If so, could you tell us how you fixed it?
No, I haven’t fixed it.
I uninstalled Sherpa_onnx and Sherpa_ncnn.
I reinstalled both with pip install.
I opened IDLE Python 3.12 and opened recognizer.py, first onnx and then ncnn; the same.
I blocked out the lower part of the code, that which wasn’t part of the example.
I moved the import numpy as np, import Sherpa_onnx and import wave to BEFORE the Class definition.
Ran the code... Error: Recognizer takes no arguments
Changed the code to ... recognizer() ... no arguments.
Ran the code... Error:. Recognizer has no attribute accept waveform.
Tried with OfflineStream... same thing.
I’ve given up. The basic recognizer, straight out of the box with no modifications, doesn’t run,
Sorry but I’m going to use Vosk.
Thank you for your time. When you get it sorted let me know and I’ll take it for a road test.
.
From: Fangjun Kuang @.*** Sent: 15 October 2024 08:04 To: k2-fsa/sherpa-ncnn Cc: joncitoai; State change Subject: Re: [k2-fsa/sherpa-ncnn] TypeError: Recognizer() takes no arguments (Issue #363)
Have you fixed the issue? If so, could you tell us how you fixed it?
— Reply to this email directly, view it on GitHub https://github.com/k2-fsa/sherpa-ncnn/issues/363#issuecomment-2413725753 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BLA6D4QZ4L6ZYZAOP4KUUV3Z3UACZAVCNFSM6AAAAABP6BNCFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJTG4ZDKNZVGM . You are receiving this because you modified the open/close state.Image removed by sender.Message ID: @.***>
The examples should work out of the box without any changes.
You are the first one having such issues.
Well it’s very possible of course I’m doing something wrong., but out of the box into IDLE and ...zilch.
I had to make changes to get it to run at all.
Have a good one.
From: Fangjun Kuang @.*** Sent: 15 October 2024 10:00 To: k2-fsa/sherpa-ncnn Cc: joncitoai; State change Subject: Re: [k2-fsa/sherpa-ncnn] TypeError: Recognizer() takes no arguments (Issue #363)
The examples should work out of the box without any changes.
You are the first one having such issues.
— Reply to this email directly, view it on GitHub https://github.com/k2-fsa/sherpa-ncnn/issues/363#issuecomment-2414003097 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BLA6D4UMUAT2DNZPKPH353DZ3UNUNAVCNFSM6AAAAABP6BNCFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJUGAYDGMBZG4 . You are receiving this because you modified the open/close state.Image removed by sender.Message ID: @.***>
https://github.com/k2-fsa/sherpa-ncnn/blame/5503f8d036620338799c1d22913f739885152238/python-api-examples/speech-recognition-from-microphone.py#L28C6-L28C6