Can a PyStan 3 model be compiled without data?

I had implemented some analysis a while ago with PyStan 2 where I would compile the Stan model (e.g. model = pystan.StanModel(model_code=code, model_name="name") ) and would use the compiled model with different data provided to the sample method at run time (e.g. looping over an array with different data vectors). However, it seems that PyStan 3 requires the data for compilation – that would mean that instead of compiling the model once and running it several times it may require both running and compiling each time.

My question is: is it possible to compile the model without the data in PyStan 3, and provide (potentially different) data at run time?

EDIT: Restricting the question to the straightforward yes/no question in the topic title.

The model is not compiled the second time, provided that it wasnt changed. Pystan3 caches models to avoid unnecessary recompiling.

And to answer the question, AFAIK its not possible to compile without the data.

So you can call .build command in a loop (with different data each time) and it should not be slow.

Thanks. And by changed you mean the model, not the data (that’s what @ahartikainen reply implies, so I’m going to assume yes). So the best approach is probably to compile it once with any piece of data, and only then run in parallel, otherwise it will compile it several times (in parallel) until the next “round” when it would be able to find the compiled model and .build would just add new data without compiling the C++ program again.

This will be used to run thousands of runs of the same model with different data, so even having to compile one batch of parallel runs could mean tens or hundreds of unnecessary tasks. Thanks again.