Repository navigation
Conversation
metrics.json stores the score but not the conditions, so a frozen-encoder run and a fine-tuned run were indistinguishable after the job log was gone. write_run_config records the resolved settings plus git revision and a source-tree digest, which keeps code identity answerable from an unpacked cluster tarball. The runner calls it before training so the config lands even when training crashes. Fork-only for now, per the review discussion: it lives in pyhealth/utils.py but is not proposed upstream. Sources: 224e7f4 (utils part verbatim); provenance half matches the utils part of fork #53 d45e3cc; runner call is new wiring for this series. Tests: tests/core/test_run_config.py (new); demo-data runner test now asserts run_config.json and its keys. Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
The run directory was {model}_seed{seed}, so --task labs and --task
notes_labs at one seed resolved to one path and the second run destroyed
the first. Predictions came from "test or val or train" with nothing
saying which, and the patient-split fallback was silent. The task is now
in the directory name, a nonzero --dev adds a _dev<N> suffix to the same
name, the split that predictions come from is named and warned about when
it is not test, and both the split mode and the eval split are recorded
in run_config.json next to the metrics. The predictions CSV carries the
eval split as a constant column, so collected files say which split they
hold.
Sources: 5def4ea (paired-run dirs, leaky-split warning, eval split; MLP,
lab-standardizer, loader and default changes left out -- the series
already carries them or they belong to Later); the eval-split naming
matches the runner half of fork #53 d45e3cc.
Tests: tests/core/test_paired_runs_eval_split.py (new; all 6 fail without
this commit).
Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
metrics.json carries validation only, so the test numbers worth reporting live nowhere on disk: only in stdout and W&B, recoverable afterwards only by re-scoring predictions by hand. test_metrics.json now lands next to the metrics with the eval split named. The series already evaluates test without W&B (its logger no-ops when disabled), so only the persist step was missing. create_directory uses exist_ok: the prior exists()-then-makedirs lost a race between concurrent first imports. Sources: fork #54 f4b3707 (test-metrics half verbatim; ungating already satisfied by this series; wandb group/job_type rides with the window-identity commit). Tests: tests/core/test_persist_test_metrics.py (new; the write test fails without this commit -- the makedirs-race half is not deterministically testable and rides along); demo-data runner test now asserts test_metrics.json and its eval split. Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
Self-only CPU time badly understates a data-loading-bound run, since workers are separate processes, so the clock counts the process tree (psutil, resource fallback). metrics.json gains epoch_train_cpu_seconds plus train_cpu_seconds and train_cpu_util_pct next to epoch_train_seconds. Adapted to this series: its Trainer returns None and epoch wall time is measured by the runners loader, so CPU rides the same epoch boundaries instead of a trainer epoch record. Sources: fork #54 f4b3707 (_cpu_seconds verbatim; the per-epoch record half reworked onto this series loader timing). Tests: tests/core/test_trainer_cpu.py (new; both fail without this commit); demo-data runner test asserts the new metrics.json keys. Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
An observation-window arm is a different experiment from the full-stay run at the same task/model/seed; without the window in the name the two share an output directory and collide in W&B. The directory and default W&B run name gain a _wN suffix when the window is nonzero, and runs set the W&B group (arm) and job_type (backbone) so a many-cell sweep stays navigable. Sources: fork #54 f4b3707 (window half, adapted: this series logger and naming differ; group/job_type stored on the logger for tests). Tests: tests/core/test_run_identity_window.py (new; all 3 fail without this commit). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
Summing RSS over forked workers counts every shared page once per process; PSS divides it among the mappers, so the total stays additive. peak_pss_bytes lands next to peak_rss_bytes in all 16 harnesses. Where PSS is unavailable for any process in the tree, that sample is None, so the column is left empty for the run rather than holding RSS. A denied process drops the sample instead of undercounting it, while an exited one is skipped. The peak_pss reset runs inside the sampler lock. Additive: peak_rss_bytes keeps its meaning, so numbers already collected stay interpretable. Based on fork PR #55 (07355ae), not a verbatim copy. The PR falls back to RSS when PSS is unavailable, resets the PSS peak outside the lock, and undercounts denied processes. This commit does none of those. Sources: fork #55 07355ae (adapted; see above). Tests: tests/core/test_benchmark_pss.py (new; fails without this commit -- tracker exercised where importable, structural markers elsewhere since meds_reader is unavailable here, plus fake-process cases: denied drops the sample, exited is skipped). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
A per-model branch gave bottleneck_transformer max_grad_norm=0.5 and Adam eps=1e-6 while every other backbone got 1.0 and 1e-8, so a six-backbone table that read as compute-matched was not, and the recorded config stored the raw flag (null) instead of the value the optimizer used. Defaults are now lr=1e-4, eps=1e-8, clip=1.0 for every model; a backbone that needs different settings must be passed them. Behaviour change in the runner: bottleneck_transformer loses its 0.5 clip / 1e-6 eps hardcode (it scored slightly lower in a single-seed rerun); restore it with --max-grad-norm 0.5 --adam-eps 1e-6. Sources: the per-model branch was found by comparing the runner against the reference launcher configurations. Tests: tests/core/test_optimizer_cli_only.py (new; all 3 fail without this commit). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
The flag list says --amp-dtype "bf16" and never mentions --use-amp, so following it literally ran fp32 while the recorded config claimed bf16. A bare --amp-dtype is now a parse error; omitting it resolves to bf16 for the run that does pass --use-amp. Sources: the flag/config mismatch was found against the reference launcher configurations. Tests: tests/core/test_amp_dtype_flag.py (new; the error case fails without this commit, the other two pin the default). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
The fallback puts a patient with several admissions in both train and test, inflating every metric, and used to happen with no warning at all. A run that cannot be split correctly now stops instead of quietly producing numbers nobody can use; smoke tests opt in explicitly. The opt-in is marked in the run directory (_allow_leaky): it records the config, not whether the fallback fired. Silence was the last way a run could disagree with its own split config. Sources: the silent patient-split fallback was found against the reference launcher configurations. Tests: the paired-run split tests now pin refuse-by-default plus the allowed fallback path (both fail without this commit), and the opt-in run directory gains _allow_leaky (fails without this commit). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
A launcher could appear to set something that never reached the model: MLP has no dropout parameter and swallows it in **kwargs, JambaEHR ignores --num-layers, and transformer/bottleneck/ehrmamba/jamba ignore --hidden-dim. An ignored flag the user set to a non-default value is now logged at startup (compared against the parser defaults, so a run at defaults stays silent); the full ignored list is still stored as inert_flags in run_config.json, so a table cannot misread the set flags as settings that took effect. Sources: map derived from this series' runner wiring; ignored flags are recorded in run_config.json next to the metrics. Tests: tests/core/test_inert_arch_flags.py (new; the warn and record tests fail without this commit, and the at-defaults silence test fails on the old always-warn code). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
window_hours=0 (the default) keeps the full stay through discharge, so
mortality features can include data up to discharge or death and the
label can leak into the inputs. A run that starts with an effective
observation window of 0 on a mortality task now logs one warning naming
--observation-window-hours; a positive window and non-mortality tasks
stay silent. Warning only: no refusal, no new flags, and no new
run_config field.
Sources: mortality --task values derived from the task classes'
output_schema (pyhealth/tasks/multimodal_mimic4.py:457 and :606, both
{"mortality": "binary"}); window semantics from the shared base task.
Tests: tests/core/test_mortality_full_stay_warning.py (new; all four
fail without this commit).
Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
rianfyi
force-pushed
the
tranche1_final-commits
branch
from
November 27, 2026 21:18
68b598d to
ffe267d
Compare
rianfyi
force-pushed
the
tranche1_final-systems
branch
from
November 27, 2026 21:18
e759be1 to
4edd18b
Compare
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. The systems commits for Tranche 1, in 11 small commits, stacked on #56. The base is
tranche1_final-commits, which is rebased onto upstream59890580(earlier base2c9dfacf). Upstream master has since moved to0181aa2f; this series stays on59890580for review. This diff holds only these 11 commits, and #56 should land first. The rebased branch tip is4edd18ba. Please use the Commits tab: each commit makes one change and has its own tests.Nothing here goes upstream yet. Items 1 to 6 come from earlier fork branches; item 6 is adapted from fork PR #55 and is not a verbatim copy. Each commit's
Sources:line says which. Items 7 to 11 are new. Item 1 stays fork-only for now; the other ten are upstream candidates.Commits
_dev<N>for a nonzero--devtest_metrics.jsonmetrics.jsonkeys_w<N>for a nonzero windowpeak_pss_bytescolumn;peak_rss_bytesunchanged--amp-dtypeis now a parse errorPlease read before reviewing
bottleneck_transformerloses its hardcoded clip of 0.5 and Adam eps of 1e-6, and now gets 1.0 and 1e-8 like every other backbone. That makes the backbones comparable, but it scored slightly lower in a single-seed rerun. To restore the old values, pass--max-grad-norm 0.5 --adam-eps 1e-6and say so in the results.Trainer.trainnow always clips.--devsmoke run whose patient split comes up empty now stops with aRuntimeError. It can opt in with--allow-leaky-split, which adds_allow_leakyto the run directory, and its metrics aren't comparable to patient-split runs.window_hours=0keeps the full stay through discharge (see item 28 in Tranche 1: 29 commits for commit-by-commit review #56), so a mortality run at the default now logs a warning naming--observation-window-hours. Nothing else changes..pyfiles in thepyhealthpackage. It doesn't coverexamples/, configs or launchers.Verification
tools/check_pr_rules.pypasses on each commit (exit 0, ruff 0.17.6), each run with that commit checked out.59890580: upstream 16 failed, 4165 passed. This tip4edd18ba: 13 failed, 4332 passed. The failing-test diff has no new failures. The only differences are three upstream failures intests/core/test_lime.py(TestLimeExplainerStageNet: initialization,target_classandvalues_finite) that pass on this tip. LIME is randomized and flaky in both directions (see Tranche 1: 29 commits for commit-by-commit review #56).Not in this PR
https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95