diagnose: the error argument is sent as epsilon; the output directory is never removed
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 62/100
Direzione di ricerca
Il bug è in cmdstanpy/model.py, in CmdStanModel.diagnose: il ramo error aggiunge epsilon= invece di error=, e la directory di output creata da tempfile.mkdtemp sotto _TMPDIR non viene mai rimossa. Inizia leggendo i test di log_prob, che verificano il comando registrato e fanno da modello per un nuovo test. Il lavoro è completato quando il comando contiene error= e il numero di voci sotto _TMPDIR non cambia dopo le chiamate sia nel percorso di successo sia in quello di errore. Controlla prima #869, perché la issue dice che l'approccio alla pulizia è stato concordato lì.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
CmdStanModel.diagnose (cmdstanpy develop at the time of writing, also 1.3.0) has two bugs:
- The
errorargument is sent asepsilon. CmdStan never receiveserror=, and when both arguments are given,epsilonappears twice on the command line. - Each call leaves a temporary output directory under
_TMPDIR, removed only at interpreter exit. This is the same pattern as #867, which is being fixed forlog_probin #869.
Where
cmdstanpy/model.py, CmdStanModel.diagnose, on develop:
if epsilon is not None:
cmd.append(f"epsilon={epsilon}")
if error is not None:
cmd.append(f"epsilon={error}") # should be f"error={error}"
...
output_dir = tempfile.mkdtemp(prefix=self.name, dir=_TMPDIR) # never removed
CmdStan 2.40.0's argument tree accepts both sub-arguments under diagnose test=gradient (output of <model> diagnose help-all):
gradient
Valid subarguments: epsilon, error
epsilon=<double> Finite difference step size Defaults to 1e-6
error=<double> Error threshold Defaults to 1e-6
Effect
diagnose(error=x)silently sets the finite-difference step to x, and the error threshold stays at its default 1e-6. The gradient check then judges against a threshold the caller did not ask for, using a step size the caller did not ask for.diagnose(epsilon=a, error=b)passesepsilon=a epsilon=b.- The output directory accumulates in long-running processes, as described in #867.
Suggested fix
- Send
f"error={error}". - Scope the output directory with
tempfile.TemporaryDirectory(prefix=self.name, dir=_TMPDIR), the approach agreed on #869. - Add a test asserting that the command carries
error=(the logged command, as thelog_probtests do) and that_TMPDIR's entry count is unchanged after calls on both the success path and the failure path.
We can fold this into #869, or open a separate PR, whichever you prefer.
Versions
cmdstanpy develop (also 1.3.0), CmdStan 2.40.0, Python 3.12, Linux x86_64.
- Lingua principale
- Python
- Stelle
- 198
- Fork
- 81
- Merge medio
- 6g 15h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stan-dev/cmdstanpy
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
laplace_sample: expose CmdStan's diagnostic_file (the Hessian at the mode)Forse già presa @atarutin l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
-
log_prob leaves a temporary output directory per call until interpreter exitForse già presa @atarutin l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 22/100
-
Release 2.0Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di stan-dev/cmdstanpy
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
UKGovernmentBEIS/inspect_ai#5802 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
no-human-ai/no_human#660 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
documentation need help question
Difficoltà 1/5 1-3 ore Idoneità per principianti 66/100
phonology024/babelscribe#26 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100