Brms supporting expose_functions from models fit using cmdstanr backend?

Hi,
Can we now expose_functions when running cmdstanr v2.25 as backend?

Unfortunately not yet. It needs to be worked into either cmdstanr or another package wrapping cmdstanr.
I have a prototype for exposing a Stan function for cmdstanr https://gist.github.com/rok-cesnovar/c91d631b66c1124ae7f221155f87516f
but honestly have not worked on that since.

Thanks for the prompt reply.

One workaround that might work in brms:

  • Run a version of the model (including the exact functions you want to expose), sampling only from the priors, using the rstan backend. This should go very quickly.

  • Expose the functions from that model output, with vectorize = TRUE; they should now be in your R environment.

  • Fit the model using the cmdstanr backend (latest version of brms on github) and proceed.

This seems to be working for me, but if this raises red flags with anyone would like to know.