Skip to content

val: exact-index metric frames, pad-masked metrics with thirds, per-loader eval RNG - #712

Draft
RyanPCo wants to merge 3 commits into
ryanco/mecka-operator-scalingfrom
ryanco/val-exact-reads
Draft

RyanPCo wants to merge 3 commits into
ryanco/mecka-operator-scalingfrom
ryanco/val-exact-reads

Conversation

@RyanPCo

@RyanPCo RyanPCo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

val: read the selected metric frames exactly

EvenStrideDataset went through MultiDataset.getitem, whose bounds check
swaps an out-of-quantile frame for an unseeded random frame of the same
episode. The val cohort drifted between passes and lost exactly the hard
frames.

With preserve_indices the wrapper reads base.datasets[episode][frame] (through
nested MultiDatasets, from the pose-glitch-masked index map), checks the leaf's
new frame_idx matches (a JPEG retry inside ZarrDataset moves it), fails on
non-finite tracked keys, then normalizes with the base's stats.
replace_invalid swaps a failing frame for another allowed start frame of the
same episode, seeded per (episode, frame) and logged.

The metric heads use both by default (data.exact_val_reads,
data.replace_invalid_val_frames). Pinned video loaders are unchanged.

Ported from PR #710 (EvenStrideDataset preserve_indices / replace_invalid,
ZarrDataset frame_idx); its random_seed sampling is not ported.

Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF

eval: drop padded steps from the layout metrics, add per-third MSE

Past an episode's end the action chunk repeats its last frame, which the model
predicts trivially, so tail samples deflated every in-training metric. The
layout and keypoint metrics now take the dataset's action_pad_mask: means are
per trajectory over real steps, then over the batch, and *_final reads each
trajectory's last real step. DTW / Frechet still see the whole chunk.

New *paired_mse{early,mid,late}_third for cartesian xyz / rot6d and the
keypoint wrist_xyz (the kp metric of record). A trajectory with no real step
in a third does not vote there; a third no trajectory reaches is omitted.

HPT and PI keep action_pad_mask in the processed batch (when it matches the
action horizon) so the evaluators can pass it; the loss masking is unchanged
and still gated by use_pad_mask.

Ported from PR #710's trajectory_mse / trajectory_mse_thirds; its
SampledTrajectoryMSE evaluator is not ported.

Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF

pl_model: restart the eval RNG at the first batch of every val loader

The pass counter was only rewound in on_validation_start, so a val set's
prompts and sampling noise depended on how many batches the loaders before
it had run: a change in another head's size, or a viz epoch running the
video loaders, shifted it. validation_step now rewinds it at batch_idx == 0
of each loader. The EMA swap stays in on_validation_start / end.

Also gives the on_validation_start test the ema attributes it needs since
the EMA change.

Ported from PR #710's per-cohort reset in validation_step.

Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF

Ported from ideas in #710 (no IDs taken). Combined stack: ruff clean; 562 targeted unit tests pass on CPU; no GPU smoke run yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF

RyanPCo and others added 3 commits October 12, 2026 21:55
EvenStrideDataset went through MultiDataset.__getitem__, whose bounds check
swaps an out-of-quantile frame for an unseeded random frame of the same
episode. The val cohort drifted between passes and lost exactly the hard
frames.

With preserve_indices the wrapper reads base.datasets[episode][frame] (through
nested MultiDatasets, from the pose-glitch-masked index map), checks the leaf's
new frame_idx matches (a JPEG retry inside ZarrDataset moves it), fails on
non-finite tracked keys, then normalizes with the base's stats.
replace_invalid swaps a failing frame for another allowed start frame of the
same episode, seeded per (episode, frame) and logged.

The metric heads use both by default (data.exact_val_reads,
data.replace_invalid_val_frames). Pinned video loaders are unchanged.

Ported from PR #710 (EvenStrideDataset preserve_indices / replace_invalid,
ZarrDataset frame_idx); its random_seed sampling is not ported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF
Past an episode's end the action chunk repeats its last frame, which the model
predicts trivially, so tail samples deflated every in-training metric. The
layout and keypoint metrics now take the dataset's action_pad_mask: means are
per trajectory over real steps, then over the batch, and *_final reads each
trajectory's last real step. DTW / Frechet still see the whole chunk.

New *_paired_mse_{early,mid,late}_third for cartesian xyz / rot6d and the
keypoint wrist_xyz (the kp metric of record). A trajectory with no real step
in a third does not vote there; a third no trajectory reaches is omitted.

HPT and PI keep action_pad_mask in the processed batch (when it matches the
action horizon) so the evaluators can pass it; the loss masking is unchanged
and still gated by use_pad_mask.

Ported from PR #710's trajectory_mse / trajectory_mse_thirds; its
SampledTrajectoryMSE evaluator is not ported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF
The pass counter was only rewound in on_validation_start, so a val set's
prompts and sampling noise depended on how many batches the loaders before
it had run: a change in another head's size, or a viz epoch running the
video loaders, shifted it. validation_step now rewinds it at batch_idx == 0
of each loader. The EMA swap stays in on_validation_start / end.

Also gives the on_validation_start test the ema attributes it needs since
the EMA change.

Ported from PR #710's per-cohort reset in validation_step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X86xQuci4asKUkiCwqMiKF

RyanPCo commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant