Skip to content

refactor: prepare deepspeed for ejection - #292

Open
jandom wants to merge 8 commits into
mainfrom
jandom/2026-07/refactor/change-default-inference-kernel
Open

refactor: prepare deepspeed for ejection#292
jandom wants to merge 8 commits into
mainfrom
jandom/2026-07/refactor/change-default-inference-kernel

Conversation

@jandom

@jandom jandom commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Slowly moving away from deepspeed, keeping it as dep for now but making a couple of changes

  • ~~changing the default inference kernel ~~ already done by @jnwei
  • moving into more lazy-import territory, rather than global imports

Changes

Related Issues

Testing

pixi run -e openfold3-cuda12       pytest openfold3/tests/test_kernels.py -v [passed]
pixi run -e openfold3-cuda12-pypi       pytest openfold3/tests/test_kernels.py -v [passed]
pixi run -e openfold3-cuda13       pytest openfold3/tests/test_kernels.py -v [passed]
pixi run -e openfold3-cuda13-pypi       pytest openfold3/tests/test_kernels.py -v [passed]

Other Notes

@jandom
jandom requested a review from jnwei July 2, 2026 13:09
@jandom jandom self-assigned this Jul 2, 2026
@jandom jandom added the safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. label Jul 2, 2026
Comment on lines +28 to +31
def deepspeed_is_initialized() -> bool:
"""Whether DeepSpeed distributed comm is initialized. Never imports deepspeed."""
ds = sys.modules.get("deepspeed")
return ds is not None and ds.comm.comm.is_initialized()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This checks if the module is available without importing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we require that ds comm is initialized for every use of deepspeed, also in simple inference workloads?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That is a fair question...

Comment on lines +116 to +119
# Default inference kernels: cuEquivariance on CUDA, Triton on
# ROCm. DeepSpeed remains available as an explicit opt-in.
"use_deepspeed_evo_attention": False,
"use_cueq_triangle_kernels": not _is_rocm,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is the most consequential change for inference. I don't think we want to rush this PR out, so keeping it as draft

Comment thread pyproject.toml
requires-python = ">=3.10"
# Upper-bounded at <3.15: TorchScript (torch.jit.script/script_method, still used by
# deepspeed) is unsupported and breaks on Python 3.15+, so 3.14 is the max runnable.
requires-python = ">=3.10,<3.15"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drive-by fix – we're getting all these torch.jit.script deprecation warnings, things just won't work with py315

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think deepspeed newer version is almost free of script uses (see this commit)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hopefully won't be an issue either way soon :P

@jandom jandom changed the title refactor: change default inference kernel refactor: prepare deepspeed for ejection Jul 3, 2026
@jandom
jandom marked this pull request as ready for review July 3, 2026 11:23
@jandom jandom added safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. and removed safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. labels Jul 3, 2026
# Prevent deepspeed from doing triton matmul autotuning, which can hang if
# libaio is not installed and cause restart errors on preemption. Set here
# (rather than at import time) so it only runs when the DS kernel is used.
deepspeed.HAS_TRITON = False

@sdvillal sdvillal Jul 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a way we could simply not do this? Or at least have a global config to allow the user to disable it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed

@jandom
jandom marked this pull request as draft July 7, 2026 09:57
@jandom
jandom marked this pull request as ready for review July 28, 2026 13:33
@jandom jandom added safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. and removed safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants