Repository navigation
Conversation
The collector judges comparability on protocol and hardware fields, but the runner never wrote the hardware half: every pair of real runs came out UNVERIFIABLE. metrics.json now carries a hardware object with the GPU model (torch device name, "cpu" on a CPU run), the GPU count the run used (1, not the number visible), thread pinning (OMP_NUM_THREADS, or "unset"), and the CUDA allocated/reserved peaks in MB (null on CPU). Peaks come from the torch.cuda counters, never nvidia-smi: the run's --device reaches max_memory_allocated, max_memory_reserved and reset_peak_memory_stats, so --device cuda:2 records that GPU's peaks (None keeps the current device). At the start of run(), gc.collect() then torch.cuda.empty_cache() clear the allocator's carried-over cache before the reset, because driver arms share one process and the reserved peak would otherwise be inherited. An unset --drop-modality is recorded as [] (matching the driver full arm), not null, so collected rows can compare on it. Sources: the missing-field half of the collector comparability review. Tests: doctest in _collect_hardware (CPU branch), the updated demo metrics key pin (metrics.json gains hardware), and mock-patch tests (the run device reaches all three calls; empty_cache runs before the reset); GPU branch and collector end covered by the cluster run. Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
Collects one standard-schema row per run directory (CSV + Markdown), leaves absent fields missing, and flags pairs that fail the comparability rules. Reads the runner's run_config.json, test_metrics.json, CPU seconds/util fields, and the hardware object (GPU model/count, thread pinning, VRAM peaks) when present. The row and the compare fields also carry drop_modality, lr, adam_eps, max_grad_norm, dev, split_mode, eval_split, and cache_frozen_text, so an --lr change (or any other protocol change) compares non-comparable by name instead of silently passing. Code identity is run_config.json's source_sha256 (the pyhealth package only, not examples/), which is written on git and archive trees alike, so it replaces tree_sha in the compare fields and the pair verdicts run on every tree. Covered against two real demo-fixture run directories (same config compares; --lr differs and names lr) as well as synthetic ones. Tests: tests/core/test_collect_run_stats.py (7 passed: 5 synthetic, 2 real-run, CPU, seconds; verdicts run on every tree now). Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
A real run still left nine fields missing for the run-stats collector. Record each where tools/collect_run_stats.py reads it: - cache_bytes: tensor storage of the frozen [CLS] cache, in frozen_text_cache.bytes. - peak_rss_mb: ru_maxrss of the trainer process, in MiB (bytes on macOS, KiB on Linux, both converted). - peak_pss_mb: peak PSS of the process tree, sampled every 0.2 s. Linux only; null where psutil has no PSS (macOS). - note_length and text_encoder: max_length and tokenizer_model of the admission-note processor. Null for labs-only tasks. - positive_rate: positives over every sample the run built, before the train/val/test split, to 4 decimals. - val_pr_auc_best: the trainer's best monitored validation score, from the new Trainer.best_score. Null when no epoch ran. - tree_sha and dirty: already written by write_run_config from git. They are null outside a git checkout, as the _git_revision docstring now says. Sources: prs/analysis/X4_stats_standard.md sections 1, 2 and 4. Tests: tests/core/test_run_stats_fields.py, tests/core/test_unified_e2e_runner.py. Claude-Session: https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95
rianfyi
force-pushed
the
tranche1_final-stats
branch
from
November 27, 2026 22:18
50a5604 to
26190ba
Compare
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 run-stats layer for Tranche 1, in 3 small commits, stacked on the experiment-driver PR #58 (
tranche1_final-demos). This diff holds only these 3 commits. Upstream master has since moved to0181aa2f; this layer stays on59890580for review.Items 1 and 2 record GPU identity and peak VRAM in run metrics, and add the collector. Item 3 records the remaining run-stats fields the collector reported as missing. Please use the Commits tab: each commit makes one change and has its own tests.
Commits
metrics.jsongains a hardware objectrun_config.jsonand metrics gain the remaining fields (null where not applicable)Please read before reviewing
positive_rateadds one pass over the dataset, outside the timed sections.peak_pss_mbis null on macOS by design.tree_shaanddirtyare null outside a git checkout.dirtyis true whengit status --porcelainreports any change, including untracked files.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;50a56042: 13 failed, 4372 passed.50a56042is this tip before one test fix for CI, and differs from it only in that test. The failing-test diff has no new failures. The only differences are the three upstreamtests/core/test_lime.pyfailures (TestLimeExplainerStageNet), which pass on this tip. LIME is randomized and flaky in both directions (see Tranche 1: 29 commits for commit-by-commit review #56).test_empty_cache_runs_before_reset(item 1) now runs with--epochs 0. Withtorch.cuda.is_availablemocked to True, newer CUDA-build torch makes a real CUDA call in the optimizer step. That failed on CI, which has no GPU driver. Reproduced on a CUDA build with no visible GPU before the fix; after it, the test passes andtests/core/test_unified_e2e_runner.pypasses in full (16 tests).Not in this PR
https://claude.ai/code/session_011iPyPDjj4ktrHDkPbEkk95