chaosparrot / parrot.py

Computer interaction using audio and speechrecognition
MIT License
139 stars 36 forks source link

learning phase: torch failed to initialise numpy #8

Closed elichad closed 2 years ago

elichad commented 2 years ago

Setting up Parrot for the first time and trying to train a model that I can use with Talon. I'm using Git Bash in Windows 10 and got the following ~error~ warning:

Use the current audio settings for this model? Y/N ( Empty is yes )

-------------------------
Insert the model name ( empty is '' ) test
Type the algorithm that you wish to use for recognition ( Default is random forest )
- [R] Random Forest ( SKLEARN )
- [M] Multi Layer Perceptron ( Neural net in SKLEARN )
- [A] Audio Net ( Neural net in Pytorch - Can be used by TalonVoice )
- [X] Exit the learning
a
Selected Audio Net!
How many nets do you wish to train at the same time? ( Default is 3 )
3
C:\Users\elich\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_masked\__init__.py:223:
UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of num
py is 0xe (Triggered internally at  ..\torch\csrc\utils\tensor_numpy.cpp:68.)
  example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])

This SO question suggests it's a version issue, but if I try to upgrade to numpy 1.22 that warns me about numba instead:

numba 0.55.1 requires numpy<1.22,>=1.18, but you have numpy 1.22.3 which is incompatible.

If you can advise what combination of dependencies will work that'd be helpful (and update requirements files accordingly).

The training does seem to run but iterated for a really long time without indication that it would stop at some point. I don't know if anything is working incorrectly internally because of this.

Later edit: I see the model is stored, but it can't be loaded because of the numpy issue.

chaosparrot commented 2 years ago

I'm currently testing the dependencies from a fresh install to see if I need to update them or lock them in a specific version.

chaosparrot commented 2 years ago

I updated the requirements-windows.txt file to lock down some of the versions that work on my local machine. Tested it with a clean python install with a random forest model and a pytorch model.

I didn't update the requirements-posix.txt file yet as I haven't tested it on Linux so far, but on my Windows 10 system there doesn't seem to be a problem now :)