Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4d7b669
dev-train: replace training/legacy with upstream core_v0.16.1 content
lxd-cumt Apr 17, 2026
c932fb0
merge: resolve conflicts for megatron training upstream sync (core_v0…
lxd-cumt Apr 17, 2026
1e45969
fix(platform): replace torch.cuda.current_device() with cur_platform.…
lxd-cumt Apr 17, 2026
16410ff
fix(imports+platform): lazy import StableLM2SchedulerConfig, cur_plat…
lxd-cumt Apr 17, 2026
9b4ab72
patch(train): add FlagScale-only files and sync report
lxd-cumt Apr 17, 2026
2904f73
fix(arguments): rebuild from upstream core_v0.16.1, remove 83 stale a…
lxd-cumt Apr 17, 2026
9256d43
fix(train): remove --enable-hetero and --hetero-pipeline-layer-split …
lxd-cumt Apr 20, 2026
912d22f
fix(args): add FlagScale-specific config fields to ArgumentGroupFacto…
lxd-cumt Apr 20, 2026
01f9b7d
fix(optimizer): use old-style OptimizerConfig overrides instead of Pa…
lxd-cumt Apr 20, 2026
31fbaa2
fix(train_gpt): unpack only 5 values from get_batch
lxd-cumt Apr 20, 2026
e0c9233
Add missing eval_interval: 1000 to 27 training YAMLs
lxd-cumt Apr 20, 2026
cb0bf0d
dev-train-0.17: replace training/ and legacy/ with upstream core_v0.1…
lxd-cumt Apr 20, 2026
c45749c
feat: apply FlagScale patches to training/ and legacy/ on top of 0.17.0
lxd-cumt Apr 20, 2026
932ca69
feat: remove legacy_tokenizer flag and align tokenizer with upstream …
lxd-cumt Apr 20, 2026
3e6ce2a
refactor: remove FlagScale-forked muon optimizer code, keep upstream …
lxd-cumt Apr 20, 2026
01a5150
sync: update all flagscale/train/megatron/ files to match upstream co…
lxd-cumt Apr 20, 2026
4c91438
feat(tokenizer): unify FlagScale tokenizers with registration-based f…
lxd-cumt Apr 20, 2026
df3aac3
fix: guard loss accumulator reset with should_reset to fix halved lm_…
lxd-cumt Apr 21, 2026
9d23ffb
fix(train): restore manual definitions for enable_hetero and hetero_p…
lxd-cumt Apr 21, 2026
6f8caad
fix(train): guard data_parallel_size and expert_tensor_parallel_size …
lxd-cumt Apr 21, 2026
7e061ec
fix: remove moe_use_legacy_grouped_gemm references dropped by upstream
lxd-cumt Apr 21, 2026
0fa4110
refactor: replace torch.cuda with cur_platform abstraction in FlagSca…
lxd-cumt Apr 21, 2026
0cb3f9f
fix: remove stale moe_use_legacy_grouped_gemm check from arguments_fs.py
lxd-cumt Apr 22, 2026
02cb070
fix: sync arguments.py with upstream core_r0.17.0 FP4 param gather ch…
lxd-cumt Apr 22, 2026
6ac5a06
Merge branch 'main' of https://github.com/flagos-ai/FlagScale into de…
lxd-cumt Apr 22, 2026
06b7f65
remove aquila
lxd-cumt Apr 22, 2026
6da2c0a
remove detect_all_factory_conflicts.py and SYNC_REPORT.md from FlagScale
lxd-cumt Apr 22, 2026
de8711d
Merge branch 'main' of https://github.com/flagos-ai/FlagScale into de…
lxd-cumt Apr 22, 2026
a01aa13
format
lxd-cumt Apr 22, 2026
6e3eb68
tmp change Megatron-LM-FL repo source for cicd testing
lxd-cumt Apr 22, 2026
42f45a9
fix para_ctx
lxd-cumt Apr 22, 2026
2085492
Refactor Qwen2VLTokenizer to use AutoTokenizer
heavyrain-lzy Apr 23, 2026
af6d74b
from gitee to github, for cicd test
lxd-cumt Apr 23, 2026
580cd9c
fix
lxd-cumt Apr 23, 2026
4fa89c3
fix null tokenizer
lxd-cumt Apr 24, 2026
c9572e9
code format
lxd-cumt Apr 24, 2026
1ba6d33
fix mock errors
lxd-cumt Apr 24, 2026
cef9b26
Merge branch 'main' of https://github.com/flagos-ai/FlagScale into de…
lxd-cumt Apr 24, 2026
ecca73b
fix: add missing eval_interval to engram CI/CD test config
lxd-cumt Apr 24, 2026
22c3cd9
fix: add missing eval_interval to deepseek tp2_pp2_ep2 CI/CD test config
lxd-cumt Apr 24, 2026
d7cf9ad
fix
lxd-cumt Apr 24, 2026
056eefb
tmp cancel update functional test logs
lxd-cumt Apr 24, 2026
620a8e2
update golden values
lxd-cumt Apr 24, 2026
5b29b10
reset cicd config
lxd-cumt Apr 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ folder to get started.
pip install -U scikit-build-core==0.11 pybind11 ninja cmake
git clone https://github.com/flagos-ai/FlagGems
cd FlagGems
pip install --no-build-isolation .
pip install --no-build-isolation .
```
See more details in [FlagGems](https://github.com/flagos-ai/FlagGems)

Expand Down
1 change: 1 addition & 0 deletions examples/aquila/conf/train/1_8b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
clip_grad: 1.0
train_samples: 8192 #8192 #29297664 #120B tokens 100step
eval_iters: 0
eval_interval: 1000
micro_batch_size: 8
global_batch_size: 1024
seed: 42
Expand Down
1 change: 1 addition & 0 deletions examples/aquila/conf/train/3b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ model:
clip_grad: 1.0
train_samples: 244141056 #1TB tokens #29297664 #120B tokens
eval_iters: 0
eval_interval: 1000
micro_batch_size: 2
global_batch_size: 2048
seed: 42
Expand Down
2 changes: 1 addition & 1 deletion examples/aquila/conf/train/7b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ model:
clip_grad: 1.0
train_samples: 1002539063
eval_iters: 0
eval_interval: 1000
micro_batch_size: 2
global_batch_size: 1728
seed: 1234
Expand All @@ -57,7 +58,6 @@ data:
data_path: ${data_path:??}
split: 1
tokenizer:
legacy_tokenizer: true
tokenizer_type: AquilaTokenizerFS
vocab_file: ./examples/aquila/tokenizer/vocab.json
merge_file: ./examples/aquila/tokenizer/merges.txt
Expand Down
1 change: 1 addition & 0 deletions examples/deepseek_v3/conf/train/11b_a2b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ model:
micro_batch_size: 1
global_batch_size: 256
eval_iters: 0
eval_interval: 1000
train_samples: 244141056 #1T #29297664 #120B tokens

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/deepseek_v3/conf/train/16b_a3b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ model:
micro_batch_size: 1
global_batch_size: 128 #2048
eval_iters: 0
eval_interval: 1000
train_iters: 102400

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/deepseek_v3/conf/train/16b_a3b_finetune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ model:
micro_batch_size: 1
global_batch_size: 128 #2048
eval_iters: 0
eval_interval: 1000
train_iters: 102400

# lora finetune
Expand Down
2 changes: 1 addition & 1 deletion examples/deepseek_v3/conf/train/engram.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ model:
micro_batch_size: 2
global_batch_size: 2048
eval_iters: 0
eval_interval: 1000
train_iters: 20

optimizer:
Expand All @@ -142,7 +143,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: /workspace/qwentokenizer
vocab_size: 151851
Expand Down
1 change: 1 addition & 0 deletions examples/llava_onevision/conf/train/1_5b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ model:
profile_ranks: 7
use_pytorch_profiler: True
eval_iters: 0
eval_interval: 1000
micro_batch_size: 2
global_batch_size: 512
allow_missing_vision_projection_checkpoint: True
Expand Down
1 change: 1 addition & 0 deletions examples/llava_onevision/conf/train/7b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ model:
clip_grad: 1.0
train_iters: 625
eval_iters: 0
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 320
allow_missing_vision_projection_checkpoint: True
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen2_5/conf/train/10b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ model:
micro_batch_size: 1
global_batch_size: 16
eval_iters: 0
eval_interval: 1000
train_samples: 25600000 #1T #29297664 #120B tokens

optimizer:
Expand All @@ -80,7 +81,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: xxx
vocab_size: 151643
Expand Down
1 change: 1 addition & 0 deletions examples/qwen2_5_vl/conf/train/32b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
clip_grad: 1.0
train_iters: 15846
eval_iters: 0
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 256
allow_missing_vision_projection_checkpoint: False
Expand Down
1 change: 1 addition & 0 deletions examples/qwen2_5_vl/conf/train/7b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
clip_grad: 1.0
train_iters: 62
eval_iters: 0 # no valid
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 16
allow_missing_vision_projection_checkpoint: False
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen3/conf/train/0_6b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ model:
micro_batch_size: 1
global_batch_size: 2048
eval_iters: 0
eval_interval: 1000
train_samples: 244141056 #1T #29297664 #120B tokens

optimizer:
Expand All @@ -82,7 +83,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: Qwen3-0.6B
vocab_size: 151936
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen3/conf/train/10b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ model:
micro_batch_size: 1
global_batch_size: 16
eval_iters: 0
eval_interval: 1000
train_samples: 25600000 #1T #29297664 #120B tokens

optimizer:
Expand All @@ -82,7 +83,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: xxx
vocab_size: 151669
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen3/conf/train/10b_muon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ model:
micro_batch_size: 2
global_batch_size: 2048
eval_iters: 0
eval_interval: 1000
train_samples: 29297664 #120B tokens

optimizer:
Expand All @@ -85,7 +86,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: <tokenizer_path>
vocab_size: 151669
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3/conf/train/14b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ model:
micro_batch_size: 1
global_batch_size: 2048
eval_iters: 0
eval_interval: 1000
train_samples: 244141056 #1T #29297664 #120B tokens

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3/conf/train/235b_a22b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ model:
micro_batch_size: 1
global_batch_size: 2048
eval_iters: 0
eval_interval: 1000
train_samples: 244141056 #1T #29297664 #120B tokens

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3/conf/train/30b_a3b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ model:
micro_batch_size: 1
global_batch_size: 128 #2048
eval_iters: 0
eval_interval: 1000
train_iters: 102400

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3/conf/train/32b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
micro_batch_size: 1
global_batch_size: 128 #2048
eval_iters: 0
eval_interval: 1000
train_iters: 102400

optimizer:
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen3/conf/train/engram.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ model:
# hf: max_steps: 24000
train_iters: 102400
eval_iters: 0
eval_interval: 1000


optimizer:
Expand All @@ -105,7 +106,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: Qwen2TokenizerFS
tokenizer_path: xxx
vocab_size: 151936
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen3/conf/train/te_fl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ model:
micro_batch_size: 1
global_batch_size: 8 #2048
eval_iters: 0
eval_interval: 1000
train_iters: 102400

optimizer:
Expand All @@ -92,7 +93,6 @@ data:
split: 1
no_mmap_bin_files: true
tokenizer:
legacy_tokenizer: true
tokenizer_type: QwenTokenizerFS
tokenizer_path: xxx
vocab_size: 151851
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3_vl/conf/train/32b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ model:
clip_grad: 1.0
train_iters: 62
eval_iters: 0 # no valid
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 16
allow_missing_vision_projection_checkpoint: False
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3_vl/conf/train/4b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
clip_grad: 1.0
train_iters: 62
eval_iters: 0 # no valid
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 16
allow_missing_vision_projection_checkpoint: False
Expand Down
1 change: 1 addition & 0 deletions examples/qwen3_vl/conf/train/8b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ model:
clip_grad: 1.0
train_iters: 5000
eval_iters: 0 # no valid
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 4
allow_missing_vision_projection_checkpoint: False
Expand Down
1 change: 1 addition & 0 deletions examples/qwq/conf/train/32b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ model:
micro_batch_size: 1
global_batch_size: 128
eval_iters: 0
eval_interval: 1000
train_iters: 102400

optimizer:
Expand Down
1 change: 1 addition & 0 deletions examples/robobrain_x0/conf/train/robobrain_x0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ model:
#######################
train_iters: 330
eval_iters: 0 # no valid
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 256
allow_missing_vision_projection_checkpoint: False
Expand Down
1 change: 1 addition & 0 deletions examples/robobrain_x0/conf/train/robobrain_x0_lerobot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ model:
# 1000
train_iters: 50
eval_iters: 0
eval_interval: 1000
micro_batch_size: 1
global_batch_size: 64
allow_missing_vision_projection_checkpoint: False
Expand Down
14 changes: 9 additions & 5 deletions flagscale/models/megatron/engram/engram.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import torch
import torch.nn as nn

from megatron.plugin.platform import get_platform

from .engram_config import EngramConfig
from .multi_head_embedding import MultiHeadEmbedding

Expand All @@ -17,6 +19,8 @@
## Megatron
from megatron.core.transformer.utils import sharded_state_dict_default

cur_platform = get_platform()

class Engram(nn.Module):
def __init__(self, engram_cfg: EngramConfig, layer_id):
super().__init__()
Expand Down Expand Up @@ -46,8 +50,8 @@ def __init__(self, engram_cfg: EngramConfig, layer_id):
)
self.embedding_cache = None # Cache for pre-computed embeddings
self.embedding_stream = None # Stream for pre-computing embeddings
if torch.cuda.is_available():
self.embedding_stream = torch.cuda.Stream()
if cur_platform.is_available():
self.embedding_stream = cur_platform.Stream()
self.short_conv = ShortConv(
hidden_size=self.backbone_config.hidden_size,
kernel_size=engram_cfg.engram_kernel_size,
Expand Down Expand Up @@ -91,7 +95,7 @@ def forward(self, hidden_states, hash_input_ids):
if self.embedding_cache is not None:
embeddings, embedding_event = self.embedding_cache
if embedding_event is not None:
torch.cuda.current_stream().wait_event(embedding_event) # Ensure pre-computed embeddings are ready
cur_platform.current_stream().wait_event(embedding_event) # Ensure pre-computed embeddings are ready
self.embedding_cache = None # Clear cache after use
del embedding_event # Free the event
else:
Expand Down Expand Up @@ -141,9 +145,9 @@ def pre_compute_embedding(self, input_ids: torch.Tensor):
"""
assert input_ids is not None, "Input ids can not be None for EngramModel"
self.embedding_stream.synchronize() # Ensure previous computations on the stream are finished
with torch.cuda.stream(self.embedding_stream):
with cur_platform.stream(self.embedding_stream):
embedding_result = self.memory(input_ids).flatten(start_dim=-2)
embedding_event = torch.cuda.Event()
embedding_event = cur_platform.Event()
embedding_event.record(self.embedding_stream)
self.embedding_cache = (embedding_result, embedding_event)

Expand Down
Loading
Loading