Describe the issue:
I encountered low-level BLAS error in latest PyMC v5.26.1:
_fblas.error: (len(y)-offy>(n-1)*abs(incy)) failed for 1st keyword n: daxpy:n=921
That wasn't present in v5.23.0
Reproduceable code example:
See for the full reproducible notebook:
https://github.com/minireference/noBSstats/blob/main/notebooks/explorations/BLAS_bug_PyMC_Bamabi.ipynb
import pandas as pd
radon = pd.read_csv("https://raw.githubusercontent.com/minireference/noBSstats/refs/heads/main/datasets/radon.csv")
import bambi as bmb
priors1 = {
"Intercept": bmb.Prior("Normal", mu=1, sigma=2),
"floor": bmb.Prior("Normal", mu=0, sigma=5),
"sigma": bmb.Prior("HalfStudentT", nu=4, sigma=1),
}
mod1 = bmb.Model(formula="log_radon ~ 1 + floor",
family="gaussian",
link="identity",
priors=priors1,
data=radon)
mod1
idata1 = mod1.fit(random_seed=42)
PyMC version information:
Running Bambi v0.16.0
Running on PyMC v5.26.1
Running on PyTensor v2.35.1
Running NymPy v2.3.5
Context for the issue:
I had build this model this summer and it worked fine.
Today I was upgrading to latest PyMC and Bambi and it stopped working.
Reverting back to older versions bambi v0.15.0 and pymc v5.23.0 using %pip install --quiet bambi==0.15.0 pymc==5.23.0 as the first line in the notebook, and both models run fine.
Interestingly, the second model runs fine (see Example 2 lower in the notebook).
Error message:
```
Traceback (most recent call last):
Process worker_chain_3:
Traceback (most recent call last):
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 153, in run
self._start_loop()
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 153, in run
self._start_loop()
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 153, in run
self._start_loop()
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 210, in _start_loop
point, stats = self._step_method.step(self._point)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Traceback (most recent call last):
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 210, in _start_loop
point, stats = self._step_method.step(self._point)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 210, in _start_loop
point, stats = self._step_method.step(self._point)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/arraystep.py", line 116, in step
apoint, stats = self.astep(q)
^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/arraystep.py", line 116, in step
apoint, stats = self.astep(q)
^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/arraystep.py", line 116, in step
apoint, stats = self.astep(q)
^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 153, in run
self._start_loop()
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/base_hmc.py", line 233, in astep
hmc_step = self._hamiltonian_step(start, p0, step_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/base_hmc.py", line 233, in astep
hmc_step = self._hamiltonian_step(start, p0, step_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/base_hmc.py", line 233, in astep
hmc_step = self._hamiltonian_step(start, p0, step_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/sampling/parallel.py", line 210, in _start_loop
point, stats = self._step_method.step(self._point)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 217, in _hamiltonian_step
divergence_info, turning = tree.extend(direction)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 217, in _hamiltonian_step
divergence_info, turning = tree.extend(direction)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 217, in _hamiltonian_step
divergence_info, turning = tree.extend(direction)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/arraystep.py", line 116, in step
apoint, stats = self.astep(q)
^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 348, in extend
tree, diverging, turning = self._build_subtree(
^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 357, in extend
tree, diverging, turning = self._build_subtree(
^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/base_hmc.py", line 233, in astep
hmc_step = self._hamiltonian_step(start, p0, step_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 357, in extend
tree, diverging, turning = self._build_subtree(
^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 445, in _build_subtree
return self._single_step(left, epsilon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 217, in _hamiltonian_step
divergence_info, turning = tree.extend(direction)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 445, in _build_subtree
return self._single_step(left, epsilon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 445, in _build_subtree
return self._single_step(left, epsilon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 401, in _single_step
right = self.integrator.step(epsilon, left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 357, in extend
tree, diverging, turning = self._build_subtree(
^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 401, in _single_step
right = self.integrator.step(epsilon, left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 401, in _single_step
right = self.integrator.step(epsilon, left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 94, in step
return self._step(epsilon, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 445, in _build_subtree
return self._single_step(left, epsilon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 94, in step
return self._step(epsilon, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 94, in step
return self._step(epsilon, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 120, in _step
axpy(state.q_grad, p_new, a=dt)
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 120, in _step
axpy(state.q_grad, p_new, a=dt)
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 120, in _step
axpy(state.q_grad, p_new, a=dt)
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/nuts.py", line 401, in _single_step
right = self.integrator.step(epsilon, left)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_fblas.error: (len(y)-offy>(n-1)*abs(incy)) failed for 1st keyword n: daxpy:n=921
_fblas.error: (len(y)-offy>(n-1)*abs(incy)) failed for 1st keyword n: daxpy:n=921
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 94, in step
return self._step(epsilon, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^
During handling of the above exception, another exception occurred:
_fblas.error: (len(y)-offy>(n-1)*abs(incy)) failed for 1st keyword n: daxpy:n=921
During handling of the above exception, another exception occurred:
File "/Users/ivan/Projects/Minireference/STATSbook/noBSstats/venv/lib/python3.12/site-packages/pymc/step_methods/hmc/integration.py", line 120, in _step
axpy(state.q_grad, p_new, a=dt)
Traceback (most recent call last):
During handling of the above exception, another exception occurred:
(repeats)