Hi,
I am using HMC to sample parameters for my model. However, I got a very strange error as follows.
Traceback (most recent call last):
File "run.py", line 159, in <module>
trace = m.sample(n=args.n_sample, tune=args.n_tune, step='HamiltonianMC', target_accept=args.target_accept)
File "/scratch/cs/emom_gdm/emom/model.py", line 104, in sample
return pm.sample(n, tune=tune, step=s, cores=2)
File "/home/zhangg1/.local/lib/python3.6/site-packages/pymc3/sampling.py", line 449, in sample
trace = _mp_sample(**sample_args)
File "/home/zhangg1/.local/lib/python3.6/site-packages/pymc3/sampling.py", line 1002, in _mp_sample
trace.record(draw.point, draw.stats)
File "/home/zhangg1/.local/lib/python3.6/site-packages/pymc3/backends/ndarray.py", line 240, in record
data[key][self.draw_idx] = val
OverflowError: Python int too large to convert to C long
I added a print statement print(key, val)
before the line that causes this error, and found that it is due to the unusually large step size.
...
accept 0.0
energy_error -inf
energy 5308.407877548653
accepted False
step_size 5.504611954890628e-20
step_size_bar 2.097985346224451e-14
tune True
diverging True
path_length 0.5927896879687209
n_steps 10768964149090490368
Could you give me some advice about this? I have checked the document for HMC and haven’t seen any argument to limit the size of the steps.
Thanks for your help.