Skip to content

[DYNAMO] fix: guard lazy_load_kernel compat patch#2444

Draft
AmeenP wants to merge 1 commit into
mainfrom
codex/dynamo-lazy-load-kernel-guard
Draft

[DYNAMO] fix: guard lazy_load_kernel compat patch#2444
AmeenP wants to merge 1 commit into
mainfrom
codex/dynamo-lazy-load-kernel-guard

Conversation

@AmeenP
Copy link
Copy Markdown
Contributor

@AmeenP AmeenP commented May 8, 2026

Summary

Ports the small transformer compatibility fix from Biswa's tested biswapanda/prime-rl@bis/prime-rl-merged branch.

  • keeps the existing hub_kernels import guard
  • only patches hub_kernels.lazy_load_kernel when the attribute actually exists
  • avoids import-time AttributeError on transformer builds that expose hub_kernels without lazy_load_kernel

Context

This is independent of the stacked Dynamo PRs and can target main directly.

Validation

  • python -m py_compile src/prime_rl/_compat.py

Could not run the targeted pytest command on this macOS checkout because uv run pytest tests/unit/utils/test_client.py stopped before pytest with a Linux-only lockfile platform error. uv run --no-sync pytest tests/unit/utils/test_client.py exited 139 locally.

…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>
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.

2 participants