Repository navigation
fix(gym): preserve cached video timing from JSONL metadata - #4309
goelarushi wants to merge 1 commit into
Conversation
Signed-off-by: arushig <[email protected]>
|
Hi @goelarushi , thanks for sharing this fix. Correction: The problem described below is not from this PR, but exists in other places (Both NeMo-RL and vLLM truncate the frame duration before multiplication). I'm just sharing the finding. Codex suggests there is a precision problem that will cause cumulative timestamp drift. Timestamp rendering truncates each source frame’s duration to integer milliseconds before multiplying by the source frame index: frame_duration_ms = int(1000.0 / fps)
timestamp = frame_index * frame_duration_ms / 1000.0The discarded fraction accumulates across source frames, causing timestamps to underestimate elapsed time:
The last row comes from our actual caption dataset. The images remain correct, but inaccurate timestamp text could affect temporal localization or duration reasoning. This issue occurs regardless of the sampling FPS (e.g., 1 or 2) or sampled frame count (e.g., 64), because timestamps use original source-frame indices and the video’s native FPS, so truncation error accumulates over source frames rather than sampled frames. |
Cached video rows can include source
_video_frame_indexand_video_fps, but preprocessing overwrites them with sequential indices at 1 FPS. The outbound vLLM manifest also discards that timing, so timestamp text describes cache positions rather than the sampled video times.Preserve JSONL timing in both policy preprocessing and the lossless cached-video manifest. For example, source indices
[0, 6]at approximately 23.976 FPS now render timestamps0.00and0.25seconds instead of0.00and1.00. Caches with no timing retain the legacy 1 FPS fallback; partial, invalid, inconsistent, or decreasing timing is rejected. Repeated indices remain supported. Since JSONL frames do not record the original duration or frame count, manifest duration/frame count are derived as lower bounds from the last sampled source index.Regression coverage includes timing preservation in extraction and outbound manifests, legacy fallback, invalid metadata, and repeated frames.
Validation:
git diff --checkpasses.This PR contains code and regression tests only; datasets and unrelated launcher/configuration changes are excluded.