Runtime Exception with NUTS

Description

Running NUTS on a regression model runs into RuntimeError during sampling

Is this expected? Is it due to some issue in my program or is this a bug?

Program:

import numpy as np
import pymc3 as pm
import theano

import numpy as np

np.random.seed(211944424)

data = dict()
data['x'] =theano.shared(np.array([[0.3127,0.7185,0.9494,0.5597,0.7358,0.1210,0.6191,0.5667,0.4503,0.5986],[0.0269,0.7518,0.9182,0.6499,0.4869,0.3073,0.8153,0.6999,0.0878,0.1670],[0.7447,0.5607,0.0876,0.7848,0.5527,0.6284,0.2125,0.6352,0.8686,0.7983],[0.1576,0.0972,0.6508,0.7716,0.6274,0.1363,0.7613,0.2494,0.3428,0.9261],[0.7717,0.4577,0.0172,0.8652,0.8721,0.1606,0.9938,0.0563,0.5016,0.5695],[0.1718,0.2058,0.9203,0.6626,0.5851,0.1158,0.4355,0.0705,0.7436,0.2993],[0.3664,0.5945,0.0679,0.5061,0.9727,0.2606,0.8866,0.7922,0.8299,0.4857],[0.1521,0.6116,0.8895,0.8145,0.8965,0.3734,0.5860,0.2676,0.9310,0.6909],[0.6845,0.6834,0.3010,0.4828,0.8348,0.3919,0.4748,0.6864,0.1595,0.2750],[0.1263,0.8909,0.6362,0.1842,0.4666,0.9637,0.3681,0.4188,0.3020,0.7719]]).astype("float64"))
data['weight'] =theano.shared(np.array([3.9238,3.1421,6.5905,2.8718,1.7819,1.4975,0.1834,7.6811,5.0964,2.7595]).astype("float64"))
data['y'] =theano.shared(np.array([14.3773,22.0280,21.5997,24.4789,25.8981,15.0056,20.0997,17.3859,20.7086,22.1846]).astype("float64"))


with pm.Model() as model:
    w=pm.Normal('w',1.0,10.0, shape=(10,))
    b=pm.Weibull('b',93.19563293457031,46.43210220336914)
    obs1=pm.Logistic('obs1',data['x']*w+b,1.0, observed=data['y'])
    

    with model:
        samples = pm.sample(1000, chains=4, tune=1000, step=None)

Output:

pymc3file.py:30: FutureWarning: In v4.0, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.
  samples = pm.sample(1000, chains=4, tune=1000, step=None)
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [b, w]
???
projects/pymc/pymc3/step_methods/hmc/quadpotential.py:237: RuntimeWarning: divide by zero encountered in true_divide
  np.divide(1, self._stds, out=self._inv_stds)
projects/pymc/pymc3/step_methods/hmc/quadpotential.py:210: RuntimeWarning: invalid value encountered in multiply
  return np.multiply(self._var, x, out=out)
pymc3.parallel_sampling.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "projects/pymc/pymc3/parallel_sampling.py", line 140, in run
    self._start_loop()
  File "projects/pymc/pymc3/parallel_sampling.py", line 194, in _start_loop
    point, stats = self._compute_point()
  File "projects/pymc/pymc3/parallel_sampling.py", line 219, in _compute_point
    point, stats = self._step_method.step(self._point)
  File "projects/pymc/pymc3/step_methods/arraystep.py", line 283, in step
    apoint, stats = self.astep(array)
  File "projects/pymc/pymc3/step_methods/hmc/base_hmc.py", line 152, in astep
    self.potential.raise_ok(self._logp_dlogp_func._ordering.vmap)
  File "projects/pymc/pymc3/step_methods/hmc/quadpotential.py", line 290, in raise_ok
    raise ValueError("\n".join(errmsg))
ValueError: Mass matrix contains zeros on the diagonal. 
The derivative of RV `b_log__`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[1] is zero.
The derivative of RV `w`.ravel()[2] is zero.
The derivative of RV `w`.ravel()[3] is zero.
The derivative of RV `w`.ravel()[4] is zero.
The derivative of RV `w`.ravel()[5] is zero.
The derivative of RV `w`.ravel()[6] is zero.
The derivative of RV `w`.ravel()[7] is zero.
The derivative of RV `w`.ravel()[8] is zero.
The derivative of RV `w`.ravel()[9] is zero.
"""

The above exception was the direct cause of the following exception:

ValueError: Mass matrix contains zeros on the diagonal. 
The derivative of RV `b_log__`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[1] is zero.
The derivative of RV `w`.ravel()[2] is zero.
The derivative of RV `w`.ravel()[3] is zero.
The derivative of RV `w`.ravel()[4] is zero.
The derivative of RV `w`.ravel()[5] is zero.
The derivative of RV `w`.ravel()[6] is zero.
The derivative of RV `w`.ravel()[7] is zero.
The derivative of RV `w`.ravel()[8] is zero.
The derivative of RV `w`.ravel()[9] is zero.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pymc3file.py", line 30, in <module>
    samples = pm.sample(1000, chains=4, tune=1000, step=None)
  File "projects/pymc/pymc3/sampling.py", line 582, in sample
    trace = _mp_sample(**sample_args, **parallel_args)
  File "projects/pymc/pymc3/sampling.py", line 1538, in _mp_sample
    for draw in sampler:
  File "projects/pymc/pymc3/parallel_sampling.py", line 501, in __iter__
    draw = ProcessAdapter.recv_draw(self._active)
  File "projects/pymc/pymc3/parallel_sampling.py", line 368, in recv_draw
    raise error from old_error
RuntimeError: Chain 2 failed.

Versions and main components

  • PyMC/PyMC3 Version: v3.11.4
  • Theano Version: 1.1.2
  • Python Version: 3.7.11
  • Operating system: Ubuntu 18.04
  • How did you install PyMC/PyMC3: pip install git+https://github.com/pymc-devs/pymc@v3.11.4
1 Like

Can you try sampling using 2 chains instead 4? I am curious.

Yes, it fails with both 1 and 2 chains. Although a different seed may be needed. Maybe initialization is not working properly?

1 Like

Yes, it was probably the random seed that was causing the weird behavior. Thanks.

My guess is that the problem is with the Weibull-distributed prior on b. The prior of Weibull('b',93,46) is extremely tight and I suspect that the sampler is quickly finding its way to parts of the parameter space where the the prior is yielding logp values of essentially zero.

Ok, but why should the sampler crash in this case?

I tried stan with the same model and it gave good results for NUTS.

1 Like

You can increase the precision of the underlying numeric representation by setting theano’s floatX configuration:

theano.config.floatX = 'float64'
# or 
# theano.config.floatX = 'float32'

That improves, but does not completely avoid the issues with your particular model. I will let someone who understand the plumbing of aesara/theano/stan better chime into the hows and whys, but at some point the [log] posterior of your data your is going to be close enough to zero [negative infinity] that the vagaries of numeric representations become and issue and then data may be functionally impossible conditional on your model.

Hi any leads on what could be the potential issue here?

Any suggestions @junpenglao @ricardoV94 ?

Are you sure they were identical model? Often PyMC and STAN have different parametrizations for the same distributions. Feel free to post your STAN code here.

1 Like

I checked the parameters of the distributions in this program in Stan vs PyMC3. I think they have the same meaning. Please let me know if you know otherwise.

Below are the code snippets and results for Stan

data{
matrix[10,10] x;
real weight[10];
vector[10] y;
}
parameters{
vector[10] w;
real b;
}
model{
w~normal(1.0,10.0);
b~weibull(93.19563293457031,46.43210220336914);
y~logistic(x*w+b,1.0);
}

Result with NUTS:

                 Mean     MCSE   StdDev     5%    50%    95%    N_Eff  N_Eff/s    R_hat
lp__              325  6.6e-02  2.6e+00    320    325    328  1.5e+03  2.2e+03  1.0e+00
accept_stat__    0.94  1.3e-03  8.3e-02   0.77   0.98   1.00  4.1e+03  5.9e+03  1.0e+00
stepsize__      0.074  3.5e-03  4.9e-03  0.071  0.071  0.083  2.0e+00  2.8e+00  9.3e+13
treedepth__       5.4  3.8e-02  6.0e-01    4.0    5.0    6.0  2.5e+02  3.6e+02  1.0e+00
n_leapfrog__       56  7.7e-01  2.2e+01     31     63     95  8.5e+02  1.2e+03  1.0e+00
divergent__      0.00     -nan  0.0e+00   0.00   0.00   0.00     -nan     -nan     -nan
energy__         -319  9.3e-02  3.5e+00   -324   -320   -313  1.4e+03  2.0e+03  1.0e+00
w[1]              -13  1.2e-01  4.8e+00    -21    -13   -5.0  1.5e+03  2.2e+03  1.0e+00
w[2]              2.6  1.2e-01  5.1e+00   -5.8    2.7     11  1.9e+03  2.7e+03  1.0e+00
w[3]              -17  8.1e-02  3.1e+00    -22    -17    -12  1.5e+03  2.1e+03  1.0e+00
w[4]              4.4  1.3e-01  4.8e+00   -3.4    4.5     12  1.5e+03  2.1e+03  1.0e+00
w[5]             -6.7  1.0e-01  5.1e+00    -15   -6.7    1.6  2.4e+03  3.4e+03  1.0e+00
w[6]             -4.2  7.6e-02  3.9e+00    -11   -4.2    2.2  2.7e+03  3.8e+03  1.0e+00
w[7]             -4.1  1.0e-01  4.2e+00    -11   -4.2    2.9  1.6e+03  2.2e+03  1.0e+00
w[8]             -6.5  5.6e-02  3.0e+00    -11   -6.5   -1.5  2.8e+03  4.0e+03  1.0e+00
w[9]             -8.6  6.9e-02  3.1e+00    -14   -8.6   -3.3  2.0e+03  2.9e+03  1.0e+00
w[10]            0.71  5.9e-02  3.1e+00   -4.4   0.74    5.7  2.7e+03  3.9e+03  1.0e+00
b                  46  1.8e-02  7.5e-01     45     46     47  1.7e+03  2.4e+03  1.0e+00

Sounds like our derivatives may be more unstable than those in STAN… or its due to different starting points.

Can you try to start sampling at the posterior mean found in Stan (using the start kwarg in pm.sample) to see if the problem is due to a bad initialization point?

1 Like

It’s the starting point. This seems to work:

with model:
    idata = pm.sample(init='adapt_diag',
                      chains=4,
                      return_inferencedata=True)

Not sure why I didn’t think about that earlier.

Yes, looks like specifying start={'b': 46} works. Although the results are not close to Stan.

So it seems the default starting point chosen by pymc3 does not work in this case. Is there a way to fix that? i.e., change how pymc3 chooses the starting sampling point?

I ran into a similar issue with another model. However, in this case there are some additional errors in quadpotential.py. Seems like its missing some checks for cases where variance/std is 0? Maybe the performance can be improved in such cases if such checks are added (in addition to better initialization)?

import numpy as np
import pymc3 as pm
import theano
import arviz as az
import matplotlib.pyplot as plt
import os
import json
import random

import numpy as np

random.seed(1529142490)
np.random.seed(609648513)

data = dict()
data['y'] =theano.shared(np.array([4.9404,45.0399,14.6792,23.7890,71.7504,29.2036,28.7251,93.7642,28.0774,61.6389,98.5535,94.8738,83.8054,18.4976,39.6836,33.0162,82.1149,35.1902,14.2033,98.9948,35.8724,93.4728,41.8081,26.0160,65.8950,70.1028,8.3385,67.9659,53.5864,6.1922,60.9839,53.0324,98.1783,54.2960,42.7421,9.4019,92.7252,14.3490,20.7931,14.3781,14.2424,14.4019,18.9951,9.3322,99.9797,58.6983,56.7166,87.7854,32.8781,37.4594,11.4034,10.1829,54.8241,82.5061,73.8340,9.3964,57.3845,42.7835,42.0501,97.5864,38.4374,78.7779,50.2264,96.9873,43.3109,80.6796,19.5773,45.3275,29.6839,32.6994,14.0248,10.8371,51.0026,66.8986,102.5188,31.3158,15.1756,46.1974,10.2855,16.6008,51.0629,38.4128,78.3385,85.1597,102.4138,41.2770,98.2303,69.1497,76.7434,84.8919,9.8933,57.5845,8.5367,78.2816,70.9734,6.6665,101.7066,42.4600,47.0682,60.1959]).astype("float64"))


with pm.Model() as model:
    x=pm.Lognormal('x',76.4615478515625,93.7094955444336, shape=(100,))
    w=pm.Normal('w',10,1)
    b=pm.Normal('b',1,1)
    sigma=pm.Gamma('sigma',1,2)
    obs1=pm.Normal('obs1',w*x+b,sigma, observed=data['y'])
    

    with model:
        step = pm.step_methods.hmc.nuts.NUTS(max_treedepth=10,target_accept=0.8,step_scale=0.25)
        samples = pm.sample(draws=1000, chains=4, tune=1000, step=step, init="auto", jitter_max_retries=10)

Output:

WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
pymc3file.py:31: FutureWarning: In v4.0, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.
  samples = pm.sample(draws=1000, chains=4, tune=1000, step=step, init="auto", jitter_max_retries=10)
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [sigma, b, w, x]
█
pymc/pymc3/step_methods/hmc/quadpotential.py:224: RuntimeWarning: divide by zero encountered in true_divide
  np.divide(1, self._stds, out=self._inv_stds)
pymc/pymc3/step_methods/hmc/quadpotential.py:203: RuntimeWarning: invalid value encountered in multiply
  return np.multiply(self._var, x, out=out)
pymc/pymc3/step_methods/hmc/quadpotential.py:224: RuntimeWarning: divide by zero encountered in true_divide
  np.divide(1, self._stds, out=self._inv_stds)
pymc/pymc3/step_methods/hmc/quadpotential.py:203: RuntimeWarning: invalid value encountered in multiply
  return np.multiply(self._var, x, out=out)
pymc/pymc3/step_methods/hmc/quadpotential.py:224: RuntimeWarning: divide by zero encountered in true_divide
  np.divide(1, self._stds, out=self._inv_stds)
pymc/pymc3/step_methods/hmc/quadpotential.py:203: RuntimeWarning: invalid value encountered in multiply
  return np.multiply(self._var, x, out=out)
pymc/pymc3/step_methods/hmc/quadpotential.py:224: RuntimeWarning: divide by zero encountered in true_divide
  np.divide(1, self._stds, out=self._inv_stds)
pymc/pymc3/step_methods/hmc/quadpotential.py:203: RuntimeWarning: invalid value encountered in multiply
  return np.multiply(self._var, x, out=out)
pymc3.parallel_sampling.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "pymc/pymc3/parallel_sampling.py", line 137, in run
    self._start_loop()
  File "pymc/pymc3/parallel_sampling.py", line 191, in _start_loop
    point, stats = self._compute_point()
  File "pymc/pymc3/parallel_sampling.py", line 216, in _compute_point
    point, stats = self._step_method.step(self._point)
  File "pymc/pymc3/step_methods/arraystep.py", line 276, in step
    apoint, stats = self.astep(array)
  File "pymc/pymc3/step_methods/hmc/base_hmc.py", line 147, in astep
    self.potential.raise_ok(self._logp_dlogp_func._ordering.vmap)
  File "pymc/pymc3/step_methods/hmc/quadpotential.py", line 272, in raise_ok
    raise ValueError("\n".join(errmsg))
ValueError: Mass matrix contains zeros on the diagonal. 
The derivative of RV `sigma_log__`.ravel()[0] is zero.
The derivative of RV `b`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[0] is zero.
The derivative of RV `x_log__`.ravel()[0] is zero.
The derivative of RV `x_log__`.ravel()[1] is zero.
The derivative of RV `x_log__`.ravel()[2] is zero.
The derivative of RV `x_log__`.ravel()[3] is zero.
The derivative of RV `x_log__`.ravel()[4] is zero.
The derivative of RV `x_log__`.ravel()[5] is zero.
The derivative of RV `x_log__`.ravel()[6] is zero.
The derivative of RV `x_log__`.ravel()[7] is zero.
The derivative of RV `x_log__`.ravel()[8] is zero.
The derivative of RV `x_log__`.ravel()[9] is zero.
The derivative of RV `x_log__`.ravel()[10] is zero.
The derivative of RV `x_log__`.ravel()[11] is zero.
The derivative of RV `x_log__`.ravel()[12] is zero.
The derivative of RV `x_log__`.ravel()[13] is zero.
The derivative of RV `x_log__`.ravel()[14] is zero.
The derivative of RV `x_log__`.ravel()[15] is zero.
The derivative of RV `x_log__`.ravel()[16] is zero.
The derivative of RV `x_log__`.ravel()[17] is zero.
The derivative of RV `x_log__`.ravel()[18] is zero.
The derivative of RV `x_log__`.ravel()[19] is zero.
The derivative of RV `x_log__`.ravel()[20] is zero.
The derivative of RV `x_log__`.ravel()[21] is zero.
The derivative of RV `x_log__`.ravel()[22] is zero.
The derivative of RV `x_log__`.ravel()[23] is zero.
The derivative of RV `x_log__`.ravel()[24] is zero.
The derivative of RV `x_log__`.ravel()[25] is zero.
The derivative of RV `x_log__`.ravel()[26] is zero.
The derivative of RV `x_log__`.ravel()[27] is zero.
The derivative of RV `x_log__`.ravel()[28] is zero.
The derivative of RV `x_log__`.ravel()[29] is zero.
The derivative of RV `x_log__`.ravel()[30] is zero.
The derivative of RV `x_log__`.ravel()[31] is zero.
The derivative of RV `x_log__`.ravel()[32] is zero.
The derivative of RV `x_log__`.ravel()[33] is zero.
The derivative of RV `x_log__`.ravel()[34] is zero.
The derivative of RV `x_log__`.ravel()[35] is zero.
The derivative of RV `x_log__`.ravel()[36] is zero.
The derivative of RV `x_log__`.ravel()[37] is zero.
The derivative of RV `x_log__`.ravel()[38] is zero.
The derivative of RV `x_log__`.ravel()[39] is zero.
The derivative of RV `x_log__`.ravel()[40] is zero.
The derivative of RV `x_log__`.ravel()[41] is zero.
The derivative of RV `x_log__`.ravel()[42] is zero.
The derivative of RV `x_log__`.ravel()[43] is zero.
The derivative of RV `x_log__`.ravel()[44] is zero.
The derivative of RV `x_log__`.ravel()[45] is zero.
The derivative of RV `x_log__`.ravel()[46] is zero.
The derivative of RV `x_log__`.ravel()[47] is zero.
The derivative of RV `x_log__`.ravel()[48] is zero.
The derivative of RV `x_log__`.ravel()[49] is zero.
The derivative of RV `x_log__`.ravel()[50] is zero.
The derivative of RV `x_log__`.ravel()[51] is zero.
The derivative of RV `x_log__`.ravel()[52] is zero.
The derivative of RV `x_log__`.ravel()[53] is zero.
The derivative of RV `x_log__`.ravel()[54] is zero.
The derivative of RV `x_log__`.ravel()[55] is zero.
The derivative of RV `x_log__`.ravel()[56] is zero.
The derivative of RV `x_log__`.ravel()[57] is zero.
The derivative of RV `x_log__`.ravel()[58] is zero.
The derivative of RV `x_log__`.ravel()[59] is zero.
The derivative of RV `x_log__`.ravel()[60] is zero.
The derivative of RV `x_log__`.ravel()[61] is zero.
The derivative of RV `x_log__`.ravel()[62] is zero.
The derivative of RV `x_log__`.ravel()[63] is zero.
The derivative of RV `x_log__`.ravel()[64] is zero.
The derivative of RV `x_log__`.ravel()[65] is zero.
The derivative of RV `x_log__`.ravel()[66] is zero.
The derivative of RV `x_log__`.ravel()[67] is zero.
The derivative of RV `x_log__`.ravel()[68] is zero.
The derivative of RV `x_log__`.ravel()[69] is zero.
The derivative of RV `x_log__`.ravel()[70] is zero.
The derivative of RV `x_log__`.ravel()[71] is zero.
The derivative of RV `x_log__`.ravel()[72] is zero.
The derivative of RV `x_log__`.ravel()[73] is zero.
The derivative of RV `x_log__`.ravel()[74] is zero.
The derivative of RV `x_log__`.ravel()[75] is zero.
The derivative of RV `x_log__`.ravel()[76] is zero.
The derivative of RV `x_log__`.ravel()[77] is zero.
The derivative of RV `x_log__`.ravel()[78] is zero.
The derivative of RV `x_log__`.ravel()[79] is zero.
The derivative of RV `x_log__`.ravel()[80] is zero.
The derivative of RV `x_log__`.ravel()[81] is zero.
The derivative of RV `x_log__`.ravel()[82] is zero.
The derivative of RV `x_log__`.ravel()[83] is zero.
The derivative of RV `x_log__`.ravel()[84] is zero.
The derivative of RV `x_log__`.ravel()[85] is zero.
The derivative of RV `x_log__`.ravel()[86] is zero.
The derivative of RV `x_log__`.ravel()[87] is zero.
The derivative of RV `x_log__`.ravel()[88] is zero.
The derivative of RV `x_log__`.ravel()[89] is zero.
The derivative of RV `x_log__`.ravel()[90] is zero.
The derivative of RV `x_log__`.ravel()[91] is zero.
The derivative of RV `x_log__`.ravel()[92] is zero.
The derivative of RV `x_log__`.ravel()[93] is zero.
The derivative of RV `x_log__`.ravel()[94] is zero.
The derivative of RV `x_log__`.ravel()[95] is zero.
The derivative of RV `x_log__`.ravel()[96] is zero.
The derivative of RV `x_log__`.ravel()[97] is zero.
The derivative of RV `x_log__`.ravel()[98] is zero.
The derivative of RV `x_log__`.ravel()[99] is zero.
"""

The above exception was the direct cause of the following exception:

ValueError: Mass matrix contains zeros on the diagonal. 
The derivative of RV `sigma_log__`.ravel()[0] is zero.
The derivative of RV `b`.ravel()[0] is zero.
The derivative of RV `w`.ravel()[0] is zero.
The derivative of RV `x_log__`.ravel()[0] is zero.
The derivative of RV `x_log__`.ravel()[1] is zero.
The derivative of RV `x_log__`.ravel()[2] is zero.
The derivative of RV `x_log__`.ravel()[3] is zero.
The derivative of RV `x_log__`.ravel()[4] is zero.
The derivative of RV `x_log__`.ravel()[5] is zero.
The derivative of RV `x_log__`.ravel()[6] is zero.
The derivative of RV `x_log__`.ravel()[7] is zero.
The derivative of RV `x_log__`.ravel()[8] is zero.
The derivative of RV `x_log__`.ravel()[9] is zero.
The derivative of RV `x_log__`.ravel()[10] is zero.
The derivative of RV `x_log__`.ravel()[11] is zero.
The derivative of RV `x_log__`.ravel()[12] is zero.
The derivative of RV `x_log__`.ravel()[13] is zero.
The derivative of RV `x_log__`.ravel()[14] is zero.
The derivative of RV `x_log__`.ravel()[15] is zero.
The derivative of RV `x_log__`.ravel()[16] is zero.
The derivative of RV `x_log__`.ravel()[17] is zero.
The derivative of RV `x_log__`.ravel()[18] is zero.
The derivative of RV `x_log__`.ravel()[19] is zero.
The derivative of RV `x_log__`.ravel()[20] is zero.
The derivative of RV `x_log__`.ravel()[21] is zero.
The derivative of RV `x_log__`.ravel()[22] is zero.
The derivative of RV `x_log__`.ravel()[23] is zero.
The derivative of RV `x_log__`.ravel()[24] is zero.
The derivative of RV `x_log__`.ravel()[25] is zero.
The derivative of RV `x_log__`.ravel()[26] is zero.
The derivative of RV `x_log__`.ravel()[27] is zero.
The derivative of RV `x_log__`.ravel()[28] is zero.
The derivative of RV `x_log__`.ravel()[29] is zero.
The derivative of RV `x_log__`.ravel()[30] is zero.
The derivative of RV `x_log__`.ravel()[31] is zero.
The derivative of RV `x_log__`.ravel()[32] is zero.
The derivative of RV `x_log__`.ravel()[33] is zero.
The derivative of RV `x_log__`.ravel()[34] is zero.
The derivative of RV `x_log__`.ravel()[35] is zero.
The derivative of RV `x_log__`.ravel()[36] is zero.
The derivative of RV `x_log__`.ravel()[37] is zero.
The derivative of RV `x_log__`.ravel()[38] is zero.
The derivative of RV `x_log__`.ravel()[39] is zero.
The derivative of RV `x_log__`.ravel()[40] is zero.
The derivative of RV `x_log__`.ravel()[41] is zero.
The derivative of RV `x_log__`.ravel()[42] is zero.
The derivative of RV `x_log__`.ravel()[43] is zero.
The derivative of RV `x_log__`.ravel()[44] is zero.
The derivative of RV `x_log__`.ravel()[45] is zero.
The derivative of RV `x_log__`.ravel()[46] is zero.
The derivative of RV `x_log__`.ravel()[47] is zero.
The derivative of RV `x_log__`.ravel()[48] is zero.
The derivative of RV `x_log__`.ravel()[49] is zero.
The derivative of RV `x_log__`.ravel()[50] is zero.
The derivative of RV `x_log__`.ravel()[51] is zero.
The derivative of RV `x_log__`.ravel()[52] is zero.
The derivative of RV `x_log__`.ravel()[53] is zero.
The derivative of RV `x_log__`.ravel()[54] is zero.
The derivative of RV `x_log__`.ravel()[55] is zero.
The derivative of RV `x_log__`.ravel()[56] is zero.
The derivative of RV `x_log__`.ravel()[57] is zero.
The derivative of RV `x_log__`.ravel()[58] is zero.
The derivative of RV `x_log__`.ravel()[59] is zero.
The derivative of RV `x_log__`.ravel()[60] is zero.
The derivative of RV `x_log__`.ravel()[61] is zero.
The derivative of RV `x_log__`.ravel()[62] is zero.
The derivative of RV `x_log__`.ravel()[63] is zero.
The derivative of RV `x_log__`.ravel()[64] is zero.
The derivative of RV `x_log__`.ravel()[65] is zero.
The derivative of RV `x_log__`.ravel()[66] is zero.
The derivative of RV `x_log__`.ravel()[67] is zero.
The derivative of RV `x_log__`.ravel()[68] is zero.
The derivative of RV `x_log__`.ravel()[69] is zero.
The derivative of RV `x_log__`.ravel()[70] is zero.
The derivative of RV `x_log__`.ravel()[71] is zero.
The derivative of RV `x_log__`.ravel()[72] is zero.
The derivative of RV `x_log__`.ravel()[73] is zero.
The derivative of RV `x_log__`.ravel()[74] is zero.
The derivative of RV `x_log__`.ravel()[75] is zero.
The derivative of RV `x_log__`.ravel()[76] is zero.
The derivative of RV `x_log__`.ravel()[77] is zero.
The derivative of RV `x_log__`.ravel()[78] is zero.
The derivative of RV `x_log__`.ravel()[79] is zero.
The derivative of RV `x_log__`.ravel()[80] is zero.
The derivative of RV `x_log__`.ravel()[81] is zero.
The derivative of RV `x_log__`.ravel()[82] is zero.
The derivative of RV `x_log__`.ravel()[83] is zero.
The derivative of RV `x_log__`.ravel()[84] is zero.
The derivative of RV `x_log__`.ravel()[85] is zero.
The derivative of RV `x_log__`.ravel()[86] is zero.
The derivative of RV `x_log__`.ravel()[87] is zero.
The derivative of RV `x_log__`.ravel()[88] is zero.
The derivative of RV `x_log__`.ravel()[89] is zero.
The derivative of RV `x_log__`.ravel()[90] is zero.
The derivative of RV `x_log__`.ravel()[91] is zero.
The derivative of RV `x_log__`.ravel()[92] is zero.
The derivative of RV `x_log__`.ravel()[93] is zero.
The derivative of RV `x_log__`.ravel()[94] is zero.
The derivative of RV `x_log__`.ravel()[95] is zero.
The derivative of RV `x_log__`.ravel()[96] is zero.
The derivative of RV `x_log__`.ravel()[97] is zero.
The derivative of RV `x_log__`.ravel()[98] is zero.
The derivative of RV `x_log__`.ravel()[99] is zero.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pymc3file.py", line 31, in <module>
    samples = pm.sample(draws=1000, chains=4, tune=1000, step=step, init="auto", jitter_max_retries=10)
  File "pymc/pymc3/sampling.py", line 559, in sample
    trace = _mp_sample(**sample_args, **parallel_args)
  File "pymc/pymc3/sampling.py", line 1477, in _mp_sample
    for draw in sampler:
  File "pymc/pymc3/parallel_sampling.py", line 479, in __iter__
    draw = ProcessAdapter.recv_draw(self._active)
  File "pymc/pymc3/parallel_sampling.py", line 359, in recv_draw
    raise error from old_error
RuntimeError: Chain 1 failed.

Hi @cluhmann @ricardoV94 any ideas about the second model?

That model seems to have the opposite problem in that the log normal prior on x is super wide. The mean of that distribution is something like 10^{50}?

Yes, I think I am seeing a problem when using Lognormal with high variance in particular. The variance is high. So I run into either not being able to initialize properly or non-convergence issues.