Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Model methods fail on a reloaded fit when the data was passed in memory

Chiusa
#1,331 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jgabry ci sta già lavorando.

Dal 16/10/2026.

  • #1332 di @jgabry — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
r
Ambito
backend

Direzione di ricerca

Start with the $save_object() and $init_model_methods() methods on the fit object, and with $save_data_file(), which the issue says is the only way the data survives. Reproduce by saving a fit whose data was passed as a list, reloading it in a new session, and calling $log_prob(). Done means the model methods compile on the reloaded fit when data is supplied to $init_model_methods(), and the existing save/reload tests still pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

A fit created with data = list(...), saved with $save_object() and reloaded in a new R session compiles the model methods and then errors:

# session 1
fit <- cmdstanr_example("logistic")
fit$save_object("fit.rds")

# session 2
fit <- readRDS("fit.rds")
fit$log_prob(rep(0, 4))
#> Error : Error in JSON parsing
#> at offset 0:
#> The document is empty.

The fitted model object only stores the path to the JSON file CmdStanR wrote in the first session's tempdir, and $save_object() reads in the draws and diagnostics but not the data (on purpose since data files can be very large). This means that in the new session the path points nowhere unless the user had previously called fit$save_data_file() before the end of the initial session.

Instead of storing the data in the fit (we want to avoid this), we can add a data argument to $init_model_methods() for the cases when it's needed.

Lingua principale
R
Stelle
164
Fork
69
Merge medio
1g 12h
PR unite (30g)
49

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stan-dev/cmdstanr

Tutte le issue di stan-dev/cmdstanr

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.