FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[DeepCompile] Fix staticmethod handling on Python 3.9 by baremetaldevx86 · Pull Request #8240 · deepspeedai/DeepSpeed · GitHub

[DeepCompile] Fix staticmethod handling on Python 3.9 - #8240

Merged
tohtana merged 1 commit into
deepspeedai:masterfrom
baremetaldevx86:fix/7433-staticmethod-descriptor
Aug 12, 2026
Merged

[DeepCompile] Fix staticmethod handling on Python 3.9#8240
tohtana merged 1 commit into
deepspeedai:masterfrom
baremetaldevx86:fix/7433-staticmethod-descriptor

Conversation

baremetaldevx86 commented Aug 9, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Description

DeepCompile retrieves PyTorch's compiled backward hooks directly from the class namespace. On Python 3.9, this returns a staticmethod descriptor that cannot be
called directly, resulting in:

TypeError: 'staticmethod' object is not callable

This change unwraps the underlying function before DeepSpeed invokes it.

The fix covers both supported implementations:

  • PyTorch 2.6: _backward_prologue
  • PyTorch 2.7+: _backward_impl

A regression test emulates Python 3.9's non-callable staticmethod behavior so the failure remains covered when CI runs on newer Python versions.

Testing

  • pytest -q tests/unit/compile/test_backend.py tests/unit/compile/test_zero3_grad_dtype.py
  • pre-commit run --files deepspeed/compile/patch_compiled_func.py tests/unit/compile/test_backend.py

Fixes #7433

Signed-off-by: Vedant Chauhan <staranonymous1011@gmail.com>

tohtana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@baremetaldevx86 Thank you for this PR! This looks good to me.

tohtana enabled auto-merge August 12, 2026 00:01
tohtana added this pull request to the merge queue Aug 12, 2026
Merged via the queue into deepspeedai:master with commit 1d580d6 Aug 12, 2026
13 of 15 checks passed
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] TypeError: 'staticmethod' object is not callable, in deepcompile (patch_compiled_func.py)

2 participants


Back | FazBrowse Home | New Git URL