Skip to content

fix: move comments before @torch.jit.script decorator for Python 3.13 compatibility#44856

Closed
hkc5 wants to merge 1 commit intohuggingface:mainfrom
hkc5:fix/issue-44855
Closed

fix: move comments before @torch.jit.script decorator for Python 3.13 compatibility#44856
hkc5 wants to merge 1 commit intohuggingface:mainfrom
hkc5:fix/issue-44855

Conversation

@hkc5
Copy link
Copy Markdown

@hkc5 hkc5 commented Mar 19, 2026

Summary

Python 3.13's stricter parser fails when there's a comment between the @torch.jit.script decorator and the function definition, causing an IndentationError when importing DebertaV2Model.

Changes

  • Moved comments before the @torch.jit.script decorator for three functions in modeling_deberta_v2.py:
    • c2p_dynamic_expand
    • p2c_dynamic_expand
    • pos_dynamic_expand

Testing

  • Verified Python AST parsing succeeds
  • Syntax check passed
  • All functions with @torch.jit.script decorator are parseable

Fixes #44855

… compatibility

Python 3.13's stricter parser fails when there's a comment between the
@torch.jit.script decorator and the function definition. This fix moves
the comments before the decorator for the three affected functions in
the DebertaV2 model.

Fixes huggingface#44855
@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: deberta_v2

@Rocketknight1
Copy link
Copy Markdown
Member

No drive-by code agent PRs on other people's issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndentationError when importing DebertaV2Model on Python 3.13 - @torch.jit.script fails to parse function with comment between decorator and def

2 participants