Generated quantities error code -6

I used CmdStanpy and I tried to get generated quantities. I first have the general code, compile it and fit it, and store the fitted object in “fit”. Then I added the generated quantities block to the stan code and compile it and store it in model_ppc. Now I want to get generated quantities through the code below.

new_quantities = model_ppc.generate_quantities(data=lg_data_stan, mcmc_sample=fit)

But I met error as: Error during generate_quantities, chain 0 returned error code -6, chain 1 returned error code -6.
Anyone has any idea about what the error is?

1 Like

Not sure, but it’ll be easy to check with a reproducible example. Can you reproduce this with a simple model, maybe:

parameters {
  real x;
model {
  x ~ normal(0, 1);
generated quantities {
  real y = normal_rng(x, 2.0);

And post the python code that it takes to run this in a way that produces the error?

in this case, the negative error code -6 is really Python error code 132 134 - Python processes return signed error code but the system process treats it as an unsigned short.

Python error 132 seems to be “illegal instruction”??? based on a bunch of reports of folks have reported for Keras and Tensorflow.
Python error code is 134 is out-of-memory.
how big is the sample you’re trying to run though generated quantities?

what’s your OS, machine, what version of Python, Pandas, and numpy?

I met another problem that is error code -11. Is it also out of memory?

I used google colab, python 3.7.1. , pandas 1.1.5, and numpy 1.19.5.

not sure - numeric error codes are system dependent. I’ll file an issue on CmdStanPy to try to get more info out of the error.

1 Like

Thank you so much!