Repository navigation
Fix kernelize() crash for gpt_oss: missing @use_kernel_func_from_hub on apply_rotary_pos_emb - #45799
Conversation
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
|
Hi @vasqu . Would you please review this PR? Thanks! |
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
vasqu
left a comment
There was a problem hiding this comment.
Can you add a regression test for gpt oss that runs with kernels --> just that it does not crash
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
|
Hi @vasqu . I have fixed the comment and added the test, please review it. Thanks! |
|
The failed CI is not related to my changes. |
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gpt_oss, openai_privacy_filter |
vasqu
left a comment
There was a problem hiding this comment.
Thanks, I just changed it to raise an ValueError at the end instead. Having a broken registry shouldn't be the case and silently warning will be ignored so I'd rather be more strict here
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
…ub` on `apply_rotary_pos_emb` (huggingface#45799) * fix gpt-oss Signed-off-by: jiqing-feng <jiqing.feng@intel.com> * fix format Signed-off-by: jiqing-feng <jiqing.feng@intel.com> * fix copy Signed-off-by: jiqing-feng <jiqing.feng@intel.com> * fix consistency Signed-off-by: jiqing-feng <jiqing.feng@intel.com> * fix comment Signed-off-by: jiqing-feng <jiqing.feng@intel.com> * change to error instead of warning * fixup deregister on failure mode (as before) + more comments --------- Signed-off-by: jiqing-feng <jiqing.feng@intel.com> Co-authored-by: vasqu <antonprogamer@gmail.com> Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Problem
PR #45420 refactored kernel function registration to use a hidden
_hidden_kernelsdict + temporaryregister_moduleattach/detach cycle. This works correctly when the target function is decorated with@use_kernel_func_from_hub(which wraps it into annn.Moduleinstance via_create_func_module).However,
gpt_ossuses@use_kernelized_func(apply_rotary_pos_emb)whereapply_rotary_pos_embis a plain function — missing the@use_kernel_func_from_hub("rotary_pos_emb")decorator that other models (deepseek_v3, gemma3, etc.) have. This causes:register_moduleraisesTypeError: ... is not a Module subclassfinallyblock,delattrraisesAttributeErrorsince attach never succeededFix
modeling_gpt_oss.py: Add@use_kernel_func_from_hub("rotary_pos_emb")decorator toapply_rotary_pos_emb, consistent with all other models.modeling_utils.py: Makeattach_hidden_kernelsdefensive — skip non-nn.Moduleentries with a warning instead of crashing. Use safe_modulesdict access for detach.Reproduce
error:
Regression
Introduced in #45420 (commit 253809c).