Skip to content

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

Merged
terrykong merged 1 commit into
mainfrom
fix-ray258-main
Oct 4, 2026
Merged

terrykong merged 1 commit into
mainfrom
fix-ray258-main

Conversation

@terrykong

@terrykong terrykong commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

v0.8 mirror #4468

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 7ec559d

@terrykong
terrykong merged commit 31b4c02 into main Oct 4, 2026
213 of 215 checks passed
@terrykong
terrykong deleted the fix-ray258-main branch October 4, 2026 13:51
ZhiyuLi-Nvidia pushed a commit that referenced this pull request Oct 4, 2026
Resolve conflicts with advantage actors (#4469 base): checkpoint workers,
SingleControllerActorArgs and test fakes keep both storage_units and
advantage_actors.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Zhiyu Li <[email protected]>
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