Skip to content

Pre commit#9

Closed
HsingjuiKu wants to merge 13 commits into
mainfrom
pre-commit
Closed

Pre commit#9
HsingjuiKu wants to merge 13 commits into
mainfrom
pre-commit

Conversation

@HsingjuiKu
Copy link
Copy Markdown

What this does

Explain what this PR does. Feel free to tag your PR with the appropriate label(s).

Examples:

Title Label
Fixes #[issue] (🐛 Bug)
Adds new dataset (🗃️ Dataset)
Optimizes something (⚡️ Performance)

How it was tested

Explain/show how you tested your changes.

Examples:

  • Added test_something in tests/test_stuff.py.
  • Added new_feature and checked that training converges with policy X on dataset/environment Y.
  • Optimized some_function, it now runs X times faster than previously.

How to checkout & try? (for the reviewer)

Provide a simple way for the reviewer to try out your changes.

Examples:

pytest -sx tests/test_stuff.py::test_something
python lerobot/scripts/train.py --some.option=true

SECTION TO REMOVE BEFORE SUBMITTING YOUR PR

Note: Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR. Try to avoid tagging more than 3 people.

Note: Before submitting this PR, please read the contributor guideline.

@WilliamYue37 WilliamYue37 deleted the pre-commit branch January 7, 2026 23:44
shuheng-liu added a commit that referenced this pull request May 24, 2026
Resolves the four new concerns surfaced by the review on f05e60e:

- Per-call warning flood (#9): the explicit-`backend="torchcodec"`
  fallback warning used to fire on every `decode_video_frames` call
  (~96k copies over a 2k-step run with batch_size=8, 3 video keys).
  Move it behind `_warn_explicit_torchcodec_unloadable()`, a
  `@functools.cache`'d sentinel that emits exactly once per process.

- Redundant `@functools.cache` on `get_safe_default_codec` (#11): the
  inner `_load_torchcodec_videodecoder` is already cached, and caching
  the str-translating wrapper additionally violates `default_factory`'s
  fresh-instance-per-call contract if the return type ever broadens
  past `str`. Dropped.

- Fragile "see prior warning" raise (#12): the probe's logged exception
  could be silently dropped (probe fires before init_logging) or rotated
  out. Probe now returns `(VideoDecoder, exc) | (None, exc)`, and
  `decode_video_frames_torchcodec` raises with the cached exception's
  repr and chains it via `raise ... from probe_exc`. Failure mode is
  now self-contained.

- Silent explicit-backend downgrade undocumented (#10): added a
  paragraph to `decode_video_frames`'s docstring naming the fallback,
  pointing out that pyav and torchcodec pick frames via non-equivalent
  logic, and telling strict callers to consult
  `_load_torchcodec_videodecoder()` before dispatch.
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.

5 participants