Repository navigation
feat(engine): add CPU-staged Megatron AdamW #1613
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
Merged
Changes from 51 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
c1df884
feat(trainer): add multi-objective policy distillation
yulangz a51aa18
fix: propagate role env to forked workers
yulangz 3794efa
feat: offload SGLang CUDA graphs during AWEX training
yulangz a0be494
Merge branch 'main' into feature/mopd
yulangz e249e32
Merge remote-tracking branch 'github/main' into feature/mopd
yulangz a05754b
fix: restore MOPD CI compatibility
yulangz 47f36e0
chore: merge main into feature/mopd
yulangz 627a4f4
chore: merge main into feature/mopd
yulangz 476fc62
test: stabilize MOPD CI fixtures
yulangz 7cad29b
fix(engine): stabilize AWEX colocated weight updates
yulangz ce6b7a7
feat(engine): add GPU-staged optimizer support
yulangz f7f7f7c
feat(examples): add CPU-staged Qwen3 MoE example
yulangz 62a7b4a
test: consolidate staged optimizer coverage
yulangz 07fda30
feat: add DAPO-Math CPU-staged training example
8fd2a5e
fix(dataset): use compatible chat template helper
7dd2bed
fix: release colocated actor memory between phases
0365518
feat(engine): integrate CPU-staged optimizer residency
e1fc363
fix(engine): use native AWEX Qwen3 converter
d5bd29b
feat(engine): decouple staged offload from optimizer choice
e97a42d
test(engine): add staged optimizer parity coverage
3c90fba
refactor(engine): share staged optimizer runtime
eb63993
refactor(engine): reuse native staged update rules
e9ecd7e
perf(engine): select staged AdamW update backend
08826c7
test(engine): expand staged optimizer parallel coverage
f4c94a2
fix(engine): handle staged optimizer schedules and empty owners
e851361
chore: merge main into optimizer offload branch
551b48a
fix(engine): use physical GPU ranks for AWEX TP servers
27b110c
fix(models): disable bridge wgrad fusion without native extension
812992a
refactor: simplify staged optimizers and add Qwen3.5 example
335cf93
fix(engine): budget padded microbatches by rectangular input size
6fc019c
fix(ci): provision Muon dependency and correct test fixtures
5da34c0
fix(ci): install Muon dependency in a runner-writable directory
b8a97bd
test: reduce tree training memory and always release engines
8c909e3
fix(engine): avoid ephemeral ports for SGLang rendezvous
25d91c2
chore: merge main into optimizer offload branch
d745230
Merge remote-tracking branch 'origin/main' into feature/optimizer_off…
fbc070f
test: align unit tests with runtime backends
fff0213
Merge remote-tracking branch 'origin/main' into feature/optimizer_off…
1d6f822
refactor(engine): split Muon from staged AdamW
8228c45
chore: merge main and align CI fixtures
0186f36
test(engine): align optimizer fixture with model config
163773d
fix(engine): keep AWEX transfer ranks dense
e9e05d4
test: defer VLM model path resolution during collection
b63aeae
fix(ci): preserve checkout path for worker processes
b00bd98
chore: merge main into optimizer offload branch
bac678a
fix(engine): merge main and refresh offload test fixtures
231e92b
fix(ci): align AWEX with latest main before unit tests
4a2a677
fix(engine): rebuild staged optimizer state after HF reload
37431a6
fix(engine): avoid double-offset AWEX transfer ranks
be24155
refactor(engine): split activation tracking from optimizer offload
1d0f81a
fix(engine): release AWEX IPC exports after reader acknowledgement
25ba63b
refactor(engine): narrow AWEX changes to staged optimizer support
e40259f
fix(engine): allow chunked Qwen3.5 text in model-owned THD
309a5ce
fix: propagate AWEX transfer ranks for separate rollout workers
f4a707c
fix(engine): preserve stub optimizers on frozen pipeline ranks
fdb3955
ci: isolate ephemeral GPU runners by workflow run and attempt
1cbf988
chore: merge latest main into optimizer offload branch
af68c53
chore: merge latest main with named loss support
99e9507
test: complete Qwen recovery configuration fixture
59f5705
chore: sync R3 main and drop superseded Flash Next fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from datasets import Dataset, load_dataset | ||
|
|
||
| from areal.utils.hf_utils import apply_chat_template | ||
|
|
||
|
|
||
| def get_dapo_math_17k_rl_dataset( | ||
| path: str, | ||
| split: str, | ||
| tokenizer, | ||
| max_length: int | None = None, | ||
| ) -> Dataset: | ||
| """Load local DAPO-Math-17k parquet data for RL training.""" | ||
| del split | ||
| dataset_root = Path(path) | ||
| parquet_files = sorted((dataset_root / "data").glob("*.parquet")) | ||
| json_files = sorted(dataset_root.glob("*.jsonl")) + sorted( | ||
| dataset_root.glob("*.json") | ||
| ) | ||
| if parquet_files: | ||
| dataset = load_dataset( | ||
| "parquet", | ||
| data_files=[str(data_file) for data_file in parquet_files], | ||
| split="train", | ||
| ) | ||
| elif json_files: | ||
| dataset = load_dataset( | ||
| "json", | ||
| data_files=[str(data_file) for data_file in json_files], | ||
| split="train", | ||
| ) | ||
| else: | ||
| raise FileNotFoundError( | ||
| f"No parquet or JSON data files found under {dataset_root}" | ||
| ) | ||
|
|
||
| def process(sample): | ||
| answer = sample.get("label") | ||
| if answer is None: | ||
| answer = sample["reward_model"]["ground_truth"] | ||
| return {"messages": sample["prompt"], "answer": str(answer)} | ||
|
|
||
| dataset = dataset.map(process, remove_columns=dataset.column_names) | ||
|
|
||
| if max_length is not None: | ||
| if tokenizer is None: | ||
| raise ValueError("tokenizer is required when max_length is set") | ||
|
|
||
| def filter_length(sample): | ||
| prompt_ids = apply_chat_template( | ||
| tokenizer, sample["messages"], add_generation_prompt=True, tokenize=True | ||
| ) | ||
| return len(prompt_ids) <= max_length | ||
|
|
||
| dataset = dataset.filter(filter_length) | ||
|
|
||
| return dataset |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.