-
Notifications
You must be signed in to change notification settings - Fork 3k
[single_controller][decorator] Define a DynamicEnum class to make Dispatch and Execute extensible.
#1424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tongyx361
merged 8 commits into
volcengine:main
from
hongpeng-guo:hpguo/extend_decorator
May 8, 2025
Merged
[single_controller][decorator] Define a DynamicEnum class to make Dispatch and Execute extensible.
#1424
tongyx361
merged 8 commits into
volcengine:main
from
hongpeng-guo:hpguo/extend_decorator
May 8, 2025
Conversation
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
Signed-off-by: Hongpeng Guo <[email protected]>
Signed-off-by: Hongpeng Guo <[email protected]>
DynamicEnum class to make Dispatch and Execute extensible.DynamicEnum class to make Dispatch and Execute extensible.
DynamicEnum class to make Dispatch and Execute extensible.DynamicEnum class to make Dispatch and Execute extensible.
Signed-off-by: Hongpeng Guo <[email protected]>
Signed-off-by: Hongpeng Guo <[email protected]>
Signed-off-by: Hongpeng Guo <[email protected]>
Signed-off-by: Hongpeng Guo <[email protected]>
DynamicEnum class to make Dispatch and Execute extensible.DynamicEnum class to make Dispatch and Execute extensible.
Signed-off-by: Hongpeng Guo <[email protected]>
tongyx361
previously approved these changes
May 7, 2025
ZihengJiang
reviewed
May 7, 2025
ZihengJiang
reviewed
May 7, 2025
Signed-off-by: Hongpeng Guo <[email protected]>
tongyx361
approved these changes
May 8, 2025
chenjiaoAngel
added a commit
to chenjiaoAngel/verl
that referenced
this pull request
Nov 14, 2025
…Dispatch` and `Execute` extensible. (volcengine#1424) ### Checklist Before Starting - [x] Search for similar PR(s). ### What does this PR do? Today, extending `verl` in proprietary usage large requires forking it, and padding code changes in the private fork. For example, the current `verl` API doesn't support adding new `Dispatch` and `Execute` mode in runtime. The only way to achieve it is to make a new private fork. This PR replace the static `Enum` type of `Dispatch` and `Execute` into a new `"DynamicEnum"` type, that the users can use new APIs `register_dispatch_mode` and `update_dispatch_mode` to adding and define new distributed mode at runtime using native `verl` API, instead of making a fork. ### Specific Changes * Defined `DynamicEnum` class in `utils.py_functional.py`; * Re-defined `Dispatch` and `Execute` classes, all existing Enum API and usage are still usbale; * Added `register_dispatch_mode` and `update_dispatch_mode` for users to register new dispatch modes at runtime; * nit: `pre-commit` automatically fixed part of code format in another PR volcengine#1331 ### Usage Example > Provide usage example(s) for easier usage. ```python def test_register_new_dispatch_mode(): # Test registration def dummy_dispatch(worker_group, *args, **kwargs): return args, kwargs def dummy_collect(worker_group, output): return output register_dispatch_mode("TEST_MODE", dummy_dispatch, dummy_collect) # Verify enum extension _check_dispatch_mode(Dispatch.TEST_MODE) # Verify registry update assert get_predefined_dispatch_fn(Dispatch.TEST_MODE) == {"dispatch_fn": dummy_dispatch, "collect_fn": dummy_collect} ``` ### Test Added `tests/verl/test_decorator.py` ### Checklist Before Submitting - [x] Read the [Contribute Guide](https://github.com/volcengine/verl?tab=readme-ov-file#contribution-guide). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl?tab=readme-ov-file#code-linting-and-formatting). - [ ] Add `[BREAKING]` to the PR title if it breaks any API. - [ ] Update the documentation about your changes in the [docs](https://github.com/volcengine/verl/tree/main/docs). - [x] Add CI test(s) if neccessary. --------- Signed-off-by: Hongpeng Guo <[email protected]>
TimurTaepov
pushed a commit
to giorgossideris/verl
that referenced
this pull request
Dec 20, 2025
…Dispatch` and `Execute` extensible. (volcengine#1424) ### Checklist Before Starting - [x] Search for similar PR(s). ### What does this PR do? Today, extending `verl` in proprietary usage large requires forking it, and padding code changes in the private fork. For example, the current `verl` API doesn't support adding new `Dispatch` and `Execute` mode in runtime. The only way to achieve it is to make a new private fork. This PR replace the static `Enum` type of `Dispatch` and `Execute` into a new `"DynamicEnum"` type, that the users can use new APIs `register_dispatch_mode` and `update_dispatch_mode` to adding and define new distributed mode at runtime using native `verl` API, instead of making a fork. ### Specific Changes * Defined `DynamicEnum` class in `utils.py_functional.py`; * Re-defined `Dispatch` and `Execute` classes, all existing Enum API and usage are still usbale; * Added `register_dispatch_mode` and `update_dispatch_mode` for users to register new dispatch modes at runtime; * nit: `pre-commit` automatically fixed part of code format in another PR volcengine#1331 ### Usage Example > Provide usage example(s) for easier usage. ```python def test_register_new_dispatch_mode(): # Test registration def dummy_dispatch(worker_group, *args, **kwargs): return args, kwargs def dummy_collect(worker_group, output): return output register_dispatch_mode("TEST_MODE", dummy_dispatch, dummy_collect) # Verify enum extension _check_dispatch_mode(Dispatch.TEST_MODE) # Verify registry update assert get_predefined_dispatch_fn(Dispatch.TEST_MODE) == {"dispatch_fn": dummy_dispatch, "collect_fn": dummy_collect} ``` ### Test Added `tests/verl/test_decorator.py` ### Checklist Before Submitting - [x] Read the [Contribute Guide](https://github.com/volcengine/verl?tab=readme-ov-file#contribution-guide). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl?tab=readme-ov-file#code-linting-and-formatting). - [ ] Add `[BREAKING]` to the PR title if it breaks any API. - [ ] Update the documentation about your changes in the [docs](https://github.com/volcengine/verl/tree/main/docs). - [x] Add CI test(s) if neccessary. --------- Signed-off-by: Hongpeng Guo <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist Before Starting
What does this PR do?
Today, extending
verlin proprietary usage large requires forking it, and padding code changes in the private fork.For example, the current
verlAPI doesn't support adding newDispatchandExecutemode in runtime. The only way to achieve it is to make a new private fork.This PR replace the static
Enumtype ofDispatchandExecuteinto a new"DynamicEnum"type, that the users can use new APIsregister_dispatch_modeandupdate_dispatch_modeto adding and define new distributed mode at runtime using nativeverlAPI, instead of making a fork.Specific Changes
DynamicEnumclass inutils.py_functional.py;DispatchandExecuteclasses, all existing Enum API and usage are still usbale;register_dispatch_modeandupdate_dispatch_modefor users to register new dispatch modes at runtime;pre-commitautomatically fixed part of code format in another PR fix: ray worker exit with SYSTEM_ERROR caused by SIGALRM from math re… #1331Usage Example
Test
Added
tests/verl/test_decorator.pyChecklist Before Submitting
[BREAKING]to the PR title if it breaks any API.