Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #3424 (native GPT-OSS implementation) and #3549 (Dockerfile
--extra gpt-osscleanup).#3424 removed the
gpt-ossextras group, whose only dependency was the HF hubkernelspackage. The package no longer appears inpyproject.tomloruv.lock— verified withuv 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— thelazy_load_kernelmonkeypatch. TheOfflineModeIsEnabledoffline regression it worked around only triggers inside transformers'is_kernels_available() and _kernels_enabledguard (get_kernel()→HfApi), which is unreachable without the package. The ring_flash_attn shim stays; it is unrelated.src/prime_rl/trainer/model.py— theUSE_HUB_KERNELS=NOenv 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 --checkon both files — clean.grepconfirms no remaining references tokernelshub package,lazy_load_kernel,USE_HUB_KERNELS, orOfflineModeIsEnabledinsrc/ortests/.any-depth/anydepthdependency 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
kernelspackage is no longer a dependency (after the native GPT-OSS path and extras cleanup)._compat.py: Deletes thelazy_load_kernelmonkeypatch that caughtOfflineModeIsEnabledfor offline SLURM nodes. The ring_flash_attn shim for transformers ≥ 5.4 is unchanged.trainer/model.py: Drops settingUSE_HUB_KERNELS=NOat 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
kernelspackage.Reviewed by Cursor Bugbot for commit e52d13b. Bugbot is set up for automated code reviews on this repo. Configure here.