[DYNAMO] fix: guard lazy_load_kernel compat patch#2444
Draft
AmeenP wants to merge 1 commit into
Draft
Conversation
…have hub_kernels but not lazy_load_kernel transformers 4.57.6 has the hub_kernels module but doesn't yet expose lazy_load_kernel, causing an AttributeError at import time that breaks the prime_rl vLLM plugin. The existing ImportError guard only covers the case where the module is absent entirely. Add a hasattr check so the patch is only applied when lazy_load_kernel actually exists (transformers >= 5.5). Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
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
Ports the small transformer compatibility fix from Biswa's tested
biswapanda/prime-rl@bis/prime-rl-mergedbranch.hub_kernelsimport guardhub_kernels.lazy_load_kernelwhen the attribute actually existsAttributeErroron transformer builds that exposehub_kernelswithoutlazy_load_kernelContext
This is independent of the stacked Dynamo PRs and can target
maindirectly.Validation
python -m py_compile src/prime_rl/_compat.pyCould not run the targeted pytest command on this macOS checkout because
uv run pytest tests/unit/utils/test_client.pystopped before pytest with a Linux-only lockfile platform error.uv run --no-sync pytest tests/unit/utils/test_client.pyexited 139 locally.