You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because cmdstanr will use the R session temporary directory for the sampling outputs by default, when you re-render the temporary directory may have changed and so the sampling results are no longer there.
If you want to reuse the fit object across multiple runs then I'd suggest using the output_dir argument of $sample() so that the sampling results are always in an expected location:
@jgabry any chance you're familiar with quarto and caching? I wonder if there's a specific change we need to make to enable CmdStanFit objects to be cached with the draws (maybe some R6 trickery?)
@jgabry any chance you're familiar with quarto and caching? I wonder if there's a specific change we need to make to enable CmdStanFit objects to be cached with the draws (maybe some R6 trickery?)
So the issue is that the draws aren't in memory when the object is cached, right?
I think quarto relies on knitr to do the caching, and if I'm looking in the right place in knitr's source code it looks like knitr just uses base R's save function:
That's unfortunate because I was hoping we could just define a custom method for whatever function knitr was using to do the caching. But save isn't a generic function with methods so I don't think that's possible. Internally save calls functions like gzfile, xzfile, etc., and I don't think we can define custom methods for those either.
Maybe there's some other approach that I'm overlooking!
Describe the bug
Quarto fails to re-render to html following trivial changes to code chunks that use cmdstanr objects.
To Reproduce
Turn on Quarto cache in the header:
Read in a stan model from file using the chunk options:
Sample:
Write some code to summarise the model output or whatever.
Render to html.
Make a small change to anything that calls the model fit object
fit01
. In my case it will happen if I just add an empty line after an unedited chunk.Try to render to html again.
Error occurs.
Expected behavior
The document is rendered after making small changes without the need to clear the cache and refit all models etc,
Operating system
MacOs 14.0
CmdStanR version number
0.7.1
Additional context
None
The text was updated successfully, but these errors were encountered: