Skip to content

chore: drop dead hub-kernels workarounds - #3550

Open
samsja wants to merge 1 commit into
mainfrom
chore/drop-dead-hub-kernels-workarounds
Open

samsja wants to merge 1 commit into
mainfrom
chore/drop-dead-hub-kernels-workarounds

Conversation

@samsja

@samsja samsja commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #3424 (native GPT-OSS implementation) and #3549 (Dockerfile --extra gpt-oss cleanup).

#3424 removed the gpt-oss extras group, whose only dependency was the HF hub kernels package. The package no longer appears in pyproject.toml or uv.lock — verified with uv lock --check (lock is current, no stale entry, so no lock update is needed). Without the package installed, transformers' is_kernels_available() is always False, so its hub-kernel integration can never engage.

This drops the two leftovers from that path:

  • src/prime_rl/_compat.py — the lazy_load_kernel monkeypatch. The OfflineModeIsEnabled offline regression it worked around only triggers inside transformers' is_kernels_available() and _kernels_enabled guard (get_kernel()HfApi), which is unreachable without the package. The ring_flash_attn shim stays; it is unrelated.
  • src/prime_rl/trainer/model.py — the USE_HUB_KERNELS=NO env guard, which only mattered when installed hub kernels could intercept model modules.

Validation

  • uv lock --check — passes, lock unchanged (no dependency change).
  • ruff check / ruff format --check on both files — clean.
  • grep confirms no remaining references to kernels hub package, lazy_load_kernel, USE_HUB_KERNELS, or OfflineModeIsEnabled in src/ or tests/.
  • Note: also confirmed there is no any-depth/anydepth dependency anywhere in the repo or lockfile.

Note

Low Risk
Dead-code removal only; hub-kernel integration was already unreachable without the removed dependency.

Overview
Removes leftover Hugging Face hub-kernels compatibility code now that the kernels package is no longer a dependency (after the native GPT-OSS path and extras cleanup).

_compat.py: Deletes the lazy_load_kernel monkeypatch that caught OfflineModeIsEnabled for offline SLURM nodes. The ring_flash_attn shim for transformers ≥ 5.4 is unchanged.

trainer/model.py: Drops setting USE_HUB_KERNELS=NO at import time, which previously blocked hub-kernel module interception when the package was installed.

Behavior should be unchanged in current installs because transformers’ hub-kernel path never activates without the kernels package.

Reviewed by Cursor Bugbot for commit e52d13b. Bugbot is set up for automated code reviews on this repo. Configure here.

The gpt-oss extra (HF hub `kernels` package) was removed in #3424, which
replaced the Transformers/hub-kernel GPT-OSS path with the native
implementation. The `kernels` package no longer appears in pyproject.toml
or uv.lock, so transformers' `is_kernels_available()` is always False and
its hub-kernel integration can never engage.

Two leftovers from that path are now dead code:

- _compat.py's `lazy_load_kernel` monkeypatch: the OfflineModeIsEnabled
  regression it worked around only triggers inside the
  `is_kernels_available() and _kernels_enabled` guard, which is never
  reached without the package installed.
- trainer/model.py's `USE_HUB_KERNELS=NO` env guard, which only mattered
  when installed hub kernels could intercept modules.

Verified with `uv lock --check` (lock is current, no stale kernels entry)
and ruff check/format.
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