Skip to content

fix(megatron): stream generate_async without .options() so Ray 2.58 accepts it - #4468

Merged
terrykong merged 1 commit into
r0.8.0from
fix-ray258-r0.8.0
Oct 5, 2026
Merged

terrykong merged 1 commit into
r0.8.0from
fix-ray258-r0.8.0

Conversation

@terrykong

@terrykong terrykong commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

main mirror #4469

What broke

After the Ray 2.58 bump (#4419), every Megatron generation call fails:

ValueError: num_returns='streaming' can only be used with generator functions (functions that use 'yield'). The decorated function is not a generator function.

This breaks these L1 jobs: Megatron_Generation (H100 and GB200), GB200_Megatron_Omni, and GB200_Megatron_Omni_Single_Controller.

Why

MegatronGeneration.generate_async calls worker.generate_async.options(num_returns="streaming"). The driver process cannot import the Megatron worker class (it lives in an isolated venv), so Ray gives the handle a placeholder class whose methods are not marked as generators. Ray 2.58 added a check in ActorMethod.options() that rejects num_returns="streaming" on non-generator methods. Ray 2.56 did not have this check. ActorMethod._remote() does not run it.

Fix

Call _remote(..., num_returns="streaming") directly instead of .options(...).remote(...). One file, no behavior change on older Ray.

Testing

On #4463, with Ray 2.58 and only the failing L1 jobs enabled:

🤖 Generated with Claude Code

@terrykong terrykong added the CI:L1 Run doctests, unit tests, and functional tests label Oct 4, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 19274b1

@terrykong terrykong changed the title fix(megatron): stream generate_async without .options() so Ray 2.58 accepts it (r0.8.0) fix(megatron): stream generate_async without .options() so Ray 2.58 accepts it Oct 4, 2026
@terrykong
terrykong merged commit 63bc465 into r0.8.0 Oct 5, 2026
306 of 312 checks passed
@terrykong
terrykong deleted the fix-ray258-r0.8.0 branch October 5, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants