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
Need to add Numba JIT support to work with librosa #2652
Comments
I think I had some uses of librosa working, but numba is a problem, since we don't have the bytecode in compiled functions for obvious reasons. We recently added module decisions to disable Torch JIT by user choice, and I am looking at doing something similar, such that these functions if they are compiled, are maybe just ignored in that decorator. I am not sure how new it is, never saw if before in numba code, but I didn't look too deep, but there is |
So, librosa is its newest incarnation will not work without numba at all, and does not support disabling the JIT at all. It has a |
While regular Numba JIT is now in fact something you can disable, it seems for librosa, we would have to have bytecode for at least this function, and maybe then it won't even be able to run in standalone fashion. This will take us to support retaining the bytecode of functions for compilation, or the time to devise a workaround, but it's not clear that it is even possible to do one for librosa there. |
For Tensorflow we are currently implementing JIT from source code, and it will be working for 2.2, and for Numba, I expect, we can do the same, having bytecode won't be a limitation there as well anymore. It will probably be a while until the new found ability makes it way to fully work with Numba, but it's going to come I guess. |
compile command
nuitka3 --standalone --onefile tests/test.py
compile message
Nuitka-Options:INFO: Used command line options: --standalone --onefile tests/test.py
Nuitka:INFO: Starting Python compilation with Nuitka '1.9.7' on Python '3.11' commercial grade 'not installed'.
Nuitka-Plugins:WARNING: anti-bloat: Undesirable import of 'numba' (intending to avoid 'numba') in 'librosa.core.spectrum' (at
Nuitka-Plugins:WARNING: '/home/me/miniconda3/lib/python3.11/site-packages/librosa/core/spectrum.py:12') encountered. It may slow down
Nuitka-Plugins:WARNING: compilation.
Nuitka-Plugins:WARNING: Complex topic! More information can be found at https://nuitka.net/info/unwanted-module.html
Nuitka-Plugins:WARNING: options-nanny: Using module 'numba' (version 0.58.1) with incomplete support due untrue condition 'not use_numba and
Nuitka-Plugins:WARNING: standalone': Numba is not yet working with Nuitka standalone, try to use '--noinclude-numba-mode', but it may fail.
Nuitka-Plugins:INFO: anti-bloat: Not including '_bisect' automatically in order to avoid bloat, but this may cause: may slow down by using fallback implementation.
Nuitka-Plugins:INFO: anti-bloat: Not including '_json' automatically in order to avoid bloat, but this may cause: may slow down by using fallback implementation.
Nuitka-Plugins:INFO: anti-bloat: Not including 'matplotlib' automatically in order to avoid bloat, but this may cause: plotting will lack matplotlib.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc 11).
Nuitka-Scons:INFO: Backend linking program with 907 files (no progress information available for this stage).
Nuitka-Scons:WARNING: You are not using ccache, re-compilation of identical code will be slower than necessary. Use your OS package manager to
Nuitka-Scons:WARNING: install it.
Nuitka-Plugins:INFO: data-files: Included data file 'librosa/core/intervals.msgpack' due to package data for 'librosa.core.intervals'.
Nuitka-Plugins:INFO: dll-files: Found 1 file DLLs from llvmlite.binding.ffi installation.
Nuitka-Postprocessing:INFO: Creating single file from dist folder, this may take a while.
Nuitka-Onefile:INFO: Running bootstrap binary compilation via Scons.
Nuitka-Scons:INFO: Onefile C compiler: gcc (gcc 11).
Nuitka-Scons:INFO: Onefile linking program with 1 files (no progress information available for this stage).
Nuitka-Scons:WARNING: You are not using ccache, re-compilation of identical code will be slower than necessary. Use your OS package manager to
Nuitka-Scons:WARNING: install it.
Nuitka-Onefile:INFO: Using compression for onefile payload.
Nuitka-Onefile:INFO: Onefile payload compression ratio (20.99%) size 413489570 to 86787222.
Nuitka-Onefile:INFO: Keeping onefile build directory 'test.onefile-build'.
Nuitka:INFO: Keeping dist folder 'test.dist' for inspection, no need to use it.
Nuitka:INFO: Keeping build directory 'test.build'.
Nuitka:INFO: Successfully created 'test.bin'.
tests/test.py
ran test.bin ----> error message:
process audio file tests/4sec.wav
Traceback (most recent call last):
File "/tmp/onefile_285719_1705472870_807632/test.py", line 20, in
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "/tmp/onefile_285719_1705472870_807632/librosa/core/audio.py", line 1135, in
File "/tmp/onefile_285719_1705472870_807632/numba/stencils/stencil.py", line 816, in stencil
File "/tmp/onefile_285719_1705472870_807632/numba/stencils/stencil.py", line 825, in decorated
File "/tmp/onefile_285719_1705472870_807632/numba/core/compiler.py", line 334, in run_frontend
File "/tmp/onefile_285719_1705472870_807632/numba/core/interpreter.py", line 1363, in interpret
File "/tmp/onefile_285719_1705472870_807632/numba/core/byteflow.py", line 118, in run
File "/tmp/onefile_285719_1705472870_807632/numba/core/byteflow.py", line 281, in _is_implicit_new_block
File "/tmp/onefile_285719_1705472870_807632/numba/core/byteflow.py", line 1571, in get_inst
File "/tmp/onefile_285719_1705472870_807632/numba/core/bytecode.py", line 269, in getitem
KeyError: 2
Originally posted by @wl-junlin in #2418 (comment)
The text was updated successfully, but these errors were encountered: