Skip to content

Commit 772c224

Browse files
[veomni] refactor: no long check the attn_implementation/moe_implementation in VeOmniEngineConfig (#5019)
in case VeOmni backend add more attn_implementation and moe_implementation, no long check the attn_implementation/moe_implementation in VeOmniEngineConfig, and leaving the work for `build_foundation_model`, which is interface VeOmni provided. ### What does this PR do? > Add **concise** overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review. ### Checklist Before Starting - [x] Search for similar PRs. Paste at least one query link here: ... - [x] Format the PR title as `[{modules}] {type}: {description}` (This will be checked by the CI) - `{modules}` include `fsdp`, `megatron`, `veomni`, `sglang`, `vllm`, `rollout`, `trainer`, `ci`, `training_utils`, `recipe`, `hardware`, `deployment`, `ray`, `worker`, `single_controller`, `misc`, `perf`, `model`, `algo`, `env`, `tool`, `ckpt`, `doc`, `data`, `cfg`, `reward` - If this PR involves multiple modules, separate them with `,` like `[megatron, fsdp, doc]` - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test` - If this PR breaks any API (CLI arguments, config, function signature, etc.), add `[BREAKING]` to the beginning of the title. - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching` ### Test > For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc. ### API and Usage Example > Demonstrate how the API changes if any, and provide usage example(s) if possible. ```python # Add code snippet or script demonstrating how to use this ``` ### Design & Code Changes > Demonstrate the high-level design if this PR is complex, and list the specific changes. ### Checklist Before Submitting > [!IMPORTANT] > Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review. - [x] Read the [Contribute Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md). - [x] Apply [pre-commit checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting): `pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=always` - [ ] Add / Update [the documentation](https://github.com/volcengine/verl/tree/main/docs). - [ ] Add unit or end-to-end test(s) to [the CI workflow](https://github.com/volcengine/verl/tree/main/.github/workflows) to cover all the code. If not feasible, explain why: ... - [ ] Once your PR is ready for CI, send a message in [the `ci-request` channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the `verl` Slack workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ). (If not accessible, please try [the Feishu group (飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).) - [ ] If your PR is related to the `recipe` submodule, please also update the reference to the submodule commit via `git submodule update --remote` or `cd recipe && git pull origin main`. --------- Co-authored-by: Huazhong <hzji210@gmail.com>
1 parent b703663 commit 772c224

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

verl/trainer/config/engine/veomni.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ enable_fsdp_offload: false
5656

5757
enable_reentrant: false
5858

59+
# support eager, sdpa, flash_attention_2, flash_attention_3, veomni_flash_attention_2_with_sp,
60+
# veomni_flash_attention_3_with_sp and native-sparse
5961
attn_implementation: flash_attention_2
6062

61-
moe_implementation: eager
63+
# eager or fused
64+
moe_implementation: fused
6265

6366
force_use_huggingface: false
6467

verl/workers/config/engine.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,21 @@ class VeOmniEngineConfig(EngineConfig):
212212
enable_full_shard (bool): Enable fully shard for FSDP training (ZeRO-3), default False
213213
enable_fsdp_offload (bool): Enable CPU offload for FSDP1, default False
214214
enable_reentrant (bool): Use reentrant gradient checkpointing, default False
215-
attn_implementation (str): Attention implementation to use, default "flash-attn"
216-
moe_implementation (str): MoE implementation to use, default "eager"
215+
attn_implementation (str): Attention implementation to use.
216+
1. `eager`
217+
2. `sdpa`
218+
3. `flash_attention_2`
219+
4. `flash_attention_3`
220+
5. `veomni_flash_attention_2_with_sp`
221+
6. `veomni_flash_attention_3_with_sp`
222+
7. `native-sparse`
223+
default "flash_attention_2"
224+
Note: In case VeOmni add more attn_implementation, please check https://github.com/ByteDance-Seed/VeOmni/
225+
moe_implementation (str): MoE implementation to use.
226+
1. `eager`
227+
2. `fused`
228+
default "fused"
229+
Note: In case VeOmni add more moe_implementation, please check https://github.com/ByteDance-Seed/VeOmni/
217230
force_use_huggingface (bool): Force loading model from huggingface, default False
218231
activation_gpu_limit (float): When enabling activation offload, `activation_gpu_limit` GB
219232
activations are allowed to reserve on GPU, default 0.0
@@ -256,8 +269,8 @@ class VeOmniEngineConfig(EngineConfig):
256269
load_checkpoint_path: Optional[str] = None
257270
enable_fsdp_offload: bool = False
258271
enable_reentrant: bool = False
259-
attn_implementation: Optional[Literal["eager", "sdpa", "flash_attention_2", "native-sparse"]] = "flash_attention_2"
260-
moe_implementation: Optional[Literal[None, "eager", "fused"]] = "eager"
272+
attn_implementation: str = "flash_attention_2"
273+
moe_implementation: str = "fused"
261274
force_use_huggingface: bool = False
262275
activation_gpu_limit: float = 0.0
263276
basic_modules: Optional[list[str]] = field(default_factory=list)

0 commit comments

Comments
 (0)