nutpie
nutpie copied to clipboard
Slow initialization running PyMC model
I am trying to run a PyMC model with the nutpie sampler, but initialization seems to be very slow and sampling does not start with these Warning statements:
C:\Users\TsubasaTakaya\miniconda3\envs\pymc_env\Lib\site-packages\pytensor\link\numba\dispatch\basic.py:379: UserWarning: Numba will use object mode to run AdvancedSetSubtensor's perform method
warnings.warn(
C:\Users\TsubasaTakaya\miniconda3\envs\pymc_env\Lib\site-packages\pytensor\link\numba\dispatch\basic.py:379: UserWarning: Numba will use object mode to run AdvancedSetSubtensor's perform method
warnings.warn(
C:\Users\TsubasaTakaya\miniconda3\envs\pymc_env\Lib\site-packages\nutpie\compile_pymc.py:416: NumbaWarning: Cannot cache compiled function "numba_funcified_fgraph" as it uses dynamic globals (such as ctypes pointers and large global arrays)
return inner(x)
C:\Users\TsubasaTakaya\miniconda3\envs\pymc_env\Lib\site-packages\nutpie\compile_pymc.py:416: NumbaWarning: Cannot cache compiled function "numba_funcified_fgraph" as it uses dynamic globals (such as ctypes pointers and large global arrays)
return inner(x)
How can I fix this issue? I am using nutpie==0.10.0, numba==0.59.1, pymc==5.13.0.
Yeah if it's using objmode it'll be very slow. Here seems to be the relevant issue: https://github.com/pymc-devs/pytensor/issues/772 Pull requests are welcome, we're happy to help :).
Just to understand the problem, is nopython mode for Numba not used for some operations (e.g. AdvancedSetSubtensor) of PyMC?
Yes.
The slow starting is probably just known compilation times in Numba. Should get better with https://github.com/pymc-devs/pytensor/pull/765 which is part of PyTensor 2.21.0. The next PyMC release should be compatible with it
Since I don't think we can do much about the numba compilation times in nutpie, I'll close this here.