transformers
911076cc - 🚨 Molmo2: sample video frames like the Hub processor's `sample_frames` (#51325)

Commit
2 days ago
🚨 Molmo2: sample video frames like the Hub processor's `sample_frames` (#51325) * 🚨 Molmo2: sample video frames like the Hub processor's `sample_frames` With `do_sample_frames`, Molmo2VideoProcessor never took a video's last frame when it dropped frames, and above `max_fps` it took `int(duration * max_fps)` of them, while the allenai Hub processor (the checkpoints' remote code) takes every `fps / max_fps`-th frame plus the last, or `num_frames` from first to last for a video too long for that. A 9.72s video at 25 fps got 19 frames instead of the Hub's 21. * Molmo2: leave the `fps` path of `sample_frames` as on main Only the default path (no `fps`) changes: the Hub processor's spacing and last frame. The `fps` path keeps its code and the shared clamp. * Molmo2: single-exit `sample_frames`, all numpy Replace the early returns with one if/elif/else. `max_fps=None` falls back to `num_frames` spread from first to last instead of raising. The `fps` path now computes indices with integer arithmetic like the base class. The previous `torch.arange(0, total, total / n).int()` could return `n + 1` indices with the last one equal to `total`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Author
Parents
Loading