From 7cd99fc8872e5b94c54eb67b8f8107de1b8bb506 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 14:20:02 +0800 Subject: [PATCH 01/18] Fix typo environment variable and unbuffer python outputs Squashed from: - Fix PYTHONBUFFERED typo in launch scripts and command utils - Fix the same typo in the NPU docker patch - Unbuffer the ray workers, not only the submitting client - Unbuffer the launchers that submit ray jobs of their own --- docker/npu_patch/miles.patch | 4 +- .../eval/scripts/run-qwen3-32B.sh | 2 +- .../experimental/eval/scripts/run-qwen3-4B.sh | 2 +- .../eval_multi_task/multi_task.sh | 2 +- .../formal_math/single_round/run_minimal.py | 3 +- .../run-qwen3-30B-A3B-multi-agent.sh | 2 +- .../reproducibility/run-qwen2.5-0.5B-gsm8k.sh | 2 +- .../experimental/search-r1/run_qwen2.5_3B.sh | 2 +- .../strands_sglang/strands_qwen3_8b.sh | 2 +- .../experimental/tau-bench/run_qwen3_4B.sh | 2 +- .../fully_async/run-qwen3-4b-fully_async.sh | 2 +- examples/geo3k_vlm/run_geo3k_vlm.sh | 2 +- examples/geo3k_vlm/run_geo3k_vlm_sft.sh | 2 +- .../run-kimi-k2-Thinking-int4.sh | 2 +- .../run-moonlight-16B-A3B-int4.sh | 2 +- .../low_precision/run-qwen3-235B-A22B-int4.sh | 2 +- .../low_precision/run-qwen3-30B-A3B-int4.sh | 2 +- .../run-qwen3-30b-a3b-fp8-two-nodes.sh | 2 +- .../low_precision/run-qwen3-4b-fp8.sh | 2 +- .../run-glm4.5-air-8node-profile.sh | 2 +- .../run-glm4.7-flash-2node-profile.sh | 2 +- .../run-glm5-disagg-profile.sh | 2 +- .../run-kimi-k2-64node-profile.sh | 2 +- .../run-qwen3-235B-A22B-16node-profile.sh | 2 +- .../run-qwen3-30B-A3B-4node-profile.sh | 2 +- .../infra_features/p2p_weight_transfer/run.py | 1 + .../run-qwen3-4b-fsdp-mis.sh | 2 +- .../run-qwen3-4b-mis.sh | 2 +- examples/lora/dev.sh | 2 +- .../lora/run-gpt-oss-20B-megatron-moe-lora.sh | 2 +- examples/lora/run-kimi-k25-megatron-lora.sh | 2 +- .../lora/run-qwen2.5-0.5B-megatron-lora.sh | 2 +- ...-megatron-lora-disaggregated-multi-node.sh | 2 +- ...-qwen2.5-3B-megatron-lora-disaggregated.sh | 2 +- examples/lora/run-qwen3-4B-megatron-lora.sh | 2 +- .../lora/run-qwen3-4b-megatron-lora-result.sh | 2 +- .../phase1_rlvr_teacher.sh | 2 +- .../qwen3_5_35b_selfdistill/phase2_gb200.sh | 2 +- .../phase2_opd_selfdistill.sh | 2 +- .../run-qwen3-8B-opd-megatron.sh | 2 +- .../run-qwen3-8B-opd-multi-teacher.sh | 2 +- .../run-qwen3-8B-opd.sh | 2 +- miles/utils/external_utils/command_utils.py | 6 ++- scripts/amd/run-qwen3-4B-amd.sh | 2 +- scripts/run-deepseek-r1.sh | 2 +- scripts/run-glm4-9B-4xgpu-radixtree.sh | 2 +- scripts/run-glm4-9B.sh | 2 +- scripts/run-glm4.5-355B-A32B.sh | 2 +- scripts/run-glm4.7-flash.sh | 2 +- scripts/run-gpt-oss-20b-bf16.sh | 2 +- scripts/run-kimi-k2-Instruct.sh | 2 +- scripts/run-kimi-k2-Thinking.sh | 2 +- scripts/run-kimi-k25.sh | 2 +- scripts/run-mimo-7B-rl-eagle.sh | 2 +- scripts/run-moonlight-16B-A3B.sh | 2 +- scripts/run-nemotron-3-nano-30b-a3b.sh | 2 +- scripts/run-nemotron-3-nano-4b.sh | 2 +- scripts/run-nemotron-3-super-120b-a12b.sh | 2 +- scripts/run-qwen3-235B-A22B-sft.sh | 2 +- scripts/run-qwen3-235B-A22B.sh | 2 +- scripts/run-qwen3-32B.sh | 2 +- scripts/run-qwen3-4B-base-sft.sh | 2 +- scripts/run-qwen3-4B.sh | 2 +- scripts/run-qwen3-4B_4xgpu.sh | 2 +- scripts/run-qwen3-next-80B-A3B-8gpus.sh | 2 +- scripts/run-qwen3-next-80B-A3B.sh | 2 +- scripts/run-qwen3.5-27B.sh | 2 +- scripts/run-qwen3.5-35B-A3B-mtp.sh | 2 +- scripts/run-qwen3.5-4B.sh | 2 +- scripts/run-qwen3.5-9B.sh | 2 +- scripts/run-qwen3.6-27B.sh | 2 +- tests/fast/test_ray_launcher_unbuffering.py | 39 +++++++++++++++++++ tests/fast/utils/test_command_utils.py | 34 ++++++++++++++++ tests/test_gspo.sh | 2 +- tools/convert_torch_dist_to_hf_ray.py | 1 + 75 files changed, 151 insertions(+), 73 deletions(-) create mode 100644 tests/fast/test_ray_launcher_unbuffering.py diff --git a/docker/npu_patch/miles.patch b/docker/npu_patch/miles.patch index eb94ed217d..19af8a0c56 100644 --- a/docker/npu_patch/miles.patch +++ b/docker/npu_patch/miles.patch @@ -383,7 +383,7 @@ index d016e01ac..08b4d6eff 100644 + if not external_ray: + exec_command( + # will prevent ray from buffering stdout/stderr -+ f"export PYTHONBUFFERED=16 && " ++ f"export PYTHONUNBUFFERED=1 && " + f"ray start --head --node-ip-address {master_addr} --disable-usage-stats " + ) + @@ -440,7 +440,7 @@ index d016e01ac..08b4d6eff 100644 + else "" + ) + exec_command( -+ f"export no_proxy=127.0.0.1 && export PYTHONBUFFERED=16 && " ++ f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " + f"{cmd_megatron_model_source}" + f'ray job submit --address="http://127.0.0.1:8265" ' + f"--runtime-env-json='{runtime_env_json}' " diff --git a/examples/experimental/eval/scripts/run-qwen3-32B.sh b/examples/experimental/eval/scripts/run-qwen3-32B.sh index 880a15609e..525bfe357d 100644 --- a/examples/experimental/eval/scripts/run-qwen3-32B.sh +++ b/examples/experimental/eval/scripts/run-qwen3-32B.sh @@ -18,7 +18,7 @@ set -ex SKILLS_OPENAI_MODEL_NAME=${SKILLS_OPENAI_MODEL_NAME:-"miles-openai-model"} -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/experimental/eval/scripts/run-qwen3-4B.sh b/examples/experimental/eval/scripts/run-qwen3-4B.sh index cda6a77a00..e2647973c8 100644 --- a/examples/experimental/eval/scripts/run-qwen3-4B.sh +++ b/examples/experimental/eval/scripts/run-qwen3-4B.sh @@ -19,7 +19,7 @@ SKILLS_OPENAI_MODEL_NAME=${SKILLS_OPENAI_MODEL_NAME:-"miles-openai-model"} MILES_OPTIMIZER=${MILES_OPTIMIZER:-adam} -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/experimental/eval_multi_task/multi_task.sh b/examples/experimental/eval_multi_task/multi_task.sh index de40dc146c..090c461a00 100644 --- a/examples/experimental/eval_multi_task/multi_task.sh +++ b/examples/experimental/eval_multi_task/multi_task.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/experimental/formal_math/single_round/run_minimal.py b/examples/experimental/formal_math/single_round/run_minimal.py index 2992a53b60..fa19ccf452 100644 --- a/examples/experimental/formal_math/single_round/run_minimal.py +++ b/examples/experimental/formal_math/single_round/run_minimal.py @@ -121,6 +121,7 @@ runtime_env_json = json.dumps( { "env_vars": { + "PYTHONUNBUFFERED": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", @@ -129,7 +130,7 @@ ) cmd = ( - f"export PYTHONBUFFERED=16 && " + f"export PYTHONUNBUFFERED=1 && " f'source "{repo_base_dir}/scripts/models/{MODEL_TYPE}.sh" && ' f'ray job submit --address="http://127.0.0.1:8265" ' f"--runtime-env-json='{runtime_env_json}' " diff --git a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh index 4b9b38ce27..6054950125 100644 --- a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh +++ b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh b/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh index dc64b35c94..f8d498ee2e 100644 --- a/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh +++ b/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" source "${SCRIPT_DIR}/../../../scripts/models/qwen2.5-0.5B.sh" diff --git a/examples/experimental/search-r1/run_qwen2.5_3B.sh b/examples/experimental/search-r1/run_qwen2.5_3B.sh index 096307db08..798a29d75b 100644 --- a/examples/experimental/search-r1/run_qwen2.5_3B.sh +++ b/examples/experimental/search-r1/run_qwen2.5_3B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" source "${SCRIPT_DIR}/../../../scripts/models/qwen2.5-3B.sh" diff --git a/examples/experimental/strands_sglang/strands_qwen3_8b.sh b/examples/experimental/strands_sglang/strands_qwen3_8b.sh index a16c2cd28e..3f769475f8 100644 --- a/examples/experimental/strands_sglang/strands_qwen3_8b.sh +++ b/examples/experimental/strands_sglang/strands_qwen3_8b.sh @@ -16,7 +16,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/experimental/tau-bench/run_qwen3_4B.sh b/examples/experimental/tau-bench/run_qwen3_4B.sh index d69e154732..172834e79f 100644 --- a/examples/experimental/tau-bench/run_qwen3_4B.sh +++ b/examples/experimental/tau-bench/run_qwen3_4B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/fully_async/run-qwen3-4b-fully_async.sh b/examples/fully_async/run-qwen3-4b-fully_async.sh index ab86086389..44445b8647 100644 --- a/examples/fully_async/run-qwen3-4b-fully_async.sh +++ b/examples/fully_async/run-qwen3-4b-fully_async.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/geo3k_vlm/run_geo3k_vlm.sh b/examples/geo3k_vlm/run_geo3k_vlm.sh index a82c61b7b1..e95c55ebb4 100644 --- a/examples/geo3k_vlm/run_geo3k_vlm.sh +++ b/examples/geo3k_vlm/run_geo3k_vlm.sh @@ -57,7 +57,7 @@ pkill -9 redis set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # Detect NVLink NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) diff --git a/examples/geo3k_vlm/run_geo3k_vlm_sft.sh b/examples/geo3k_vlm/run_geo3k_vlm_sft.sh index 764a7df39e..7975c4c07f 100644 --- a/examples/geo3k_vlm/run_geo3k_vlm_sft.sh +++ b/examples/geo3k_vlm/run_geo3k_vlm_sft.sh @@ -48,7 +48,7 @@ pkill -9 redis set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # Detect NVLink NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) diff --git a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh index 302035b627..bb15892442 100644 --- a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh +++ b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi | grep -o "NVLink" | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh index 12ea3ee81e..f941f0b728 100644 --- a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh @@ -14,7 +14,7 @@ pkill -9 redis set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh index 2abac52d3a..a859ad59da 100644 --- a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi | grep -o "NVLink" | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh index 6873dd9e3a..7dbc5c2327 100644 --- a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderrs -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh b/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh index 90aca5b909..0f6fbf6b5b 100644 --- a/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh +++ b/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh @@ -14,7 +14,7 @@ set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh b/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh index 036969cfff..bf8f6407ae 100644 --- a/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh +++ b/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh index 3836a33fb6..cba92a94e8 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh @@ -21,7 +21,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh index cd372bd532..b7f68bad2a 100644 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh @@ -15,7 +15,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh index 441d382528..39e0abdbff 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh @@ -23,7 +23,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh index d7a67b5481..ac6259487d 100644 --- a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh @@ -19,7 +19,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh index b3df98e219..d4da973d41 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh @@ -15,7 +15,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh index 0b68d20920..1f4cbb2d54 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh @@ -18,7 +18,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Positional arguments diff --git a/examples/infra_features/p2p_weight_transfer/run.py b/examples/infra_features/p2p_weight_transfer/run.py index 30cce5df36..c05e93d3d2 100644 --- a/examples/infra_features/p2p_weight_transfer/run.py +++ b/examples/infra_features/p2p_weight_transfer/run.py @@ -829,6 +829,7 @@ def cmd_run( # --- Build runtime env JSON --- nccl_nvls_val = "1" if cfg.enable_nccl_nvls else "0" env_vars = { + "PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", diff --git a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh index 9973e6d136..8eb412be6f 100644 --- a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh +++ b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh @@ -16,7 +16,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 NVLINK_COUNT=$(nvidia-smi | grep -o "NVLink" | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh index 179e88c4b9..2f2922a8dd 100644 --- a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh +++ b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/lora/dev.sh b/examples/lora/dev.sh index 83870879f1..80648cfb81 100644 --- a/examples/lora/dev.sh +++ b/examples/lora/dev.sh @@ -2,7 +2,7 @@ export FLASHINFER_DISABLE_VERSION_CHECK=1 export GPUS_PER_NODE=1 # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=1 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0} # for rerun the task diff --git a/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh b/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh index f349f29228..e26d663fa2 100644 --- a/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh +++ b/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh @@ -10,7 +10,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1,2,3} GPUS_PER_NODE=$(echo "$CUDA_VISIBLE_DEVICES" | tr ',' '\n' | wc -l) diff --git a/examples/lora/run-kimi-k25-megatron-lora.sh b/examples/lora/run-kimi-k25-megatron-lora.sh index 04be6bc489..f43f141dab 100755 --- a/examples/lora/run-kimi-k25-megatron-lora.sh +++ b/examples/lora/run-kimi-k25-megatron-lora.sh @@ -17,7 +17,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh b/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh index 3349757840..bc287acd69 100644 --- a/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh +++ b/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh @@ -2,7 +2,7 @@ export FLASHINFER_DISABLE_VERSION_CHECK=1 export GPUS_PER_NODE=8 # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # for rerun the task pkill sglang diff --git a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh index 36e77c0125..592c77148a 100644 --- a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh +++ b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh @@ -53,7 +53,7 @@ # # so rank 0 exposes 1 GPU and rank 1 exposes 2 GPUs to Ray automatically. export FLASHINFER_DISABLE_VERSION_CHECK=1 -export PYTHONBUFFERED=1 +export PYTHONUNBUFFERED=1 # --------------------------------------------------------------------------- # Cluster topology — edit these (or pass as env vars) to size the cluster diff --git a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh index da93ef1c20..f04fabf65b 100644 --- a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh +++ b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh @@ -1,7 +1,7 @@ #!/bin/bash export FLASHINFER_DISABLE_VERSION_CHECK=1 export GPUS_PER_NODE=1 -export PYTHONBUFFERED=1 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1} # for rerun the task diff --git a/examples/lora/run-qwen3-4B-megatron-lora.sh b/examples/lora/run-qwen3-4B-megatron-lora.sh index f47732be5d..9f8f92c4ae 100644 --- a/examples/lora/run-qwen3-4B-megatron-lora.sh +++ b/examples/lora/run-qwen3-4B-megatron-lora.sh @@ -18,7 +18,7 @@ set -ex SKILLS_OPENAI_MODEL_NAME=${SKILLS_OPENAI_MODEL_NAME:-"miles-openai-model"} export GPUS_PER_NODE=4 -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/lora/run-qwen3-4b-megatron-lora-result.sh b/examples/lora/run-qwen3-4b-megatron-lora-result.sh index dae8d590cb..7d3ab820dd 100644 --- a/examples/lora/run-qwen3-4b-megatron-lora-result.sh +++ b/examples/lora/run-qwen3-4b-megatron-lora-result.sh @@ -17,7 +17,7 @@ set -ex # export SGLANG_LORA_ENABLE_FUSION=1 # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 # export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True" # export PYTORCH_ALLOC_CONF="expandable_segments:True" export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0,1,2,3} diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh index b04c3d5a5a..398222f42a 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh @@ -19,7 +19,7 @@ # EXAMPLE_DIR this directory (for rm.py + eval config on PYTHONPATH) # ============================================================================= set -ex -export PYTHONUNBUFFERED=16 +export PYTHONUNBUFFERED=1 MODEL_DIR=${MODEL_DIR:-/cluster_public/miles_data/models} DATA_DIR=${DATA_DIR:-/node_public/maocheng-qwen35/data} diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh index 512abe575c..96b725ce24 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh @@ -25,7 +25,7 @@ # teacher == student -> opd_reverse_kl ~= 0 (inert). # ============================================================================= set -ex -export PYTHONUNBUFFERED=16 +export PYTHONUNBUFFERED=1 MODE=${MODE:-pure} # GB200 tiling: this cluster is 4 GPUs/node, so world=8 = 2 nodes x 4 GPUs. diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh index 0c3109a174..39975c9863 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh @@ -25,7 +25,7 @@ # teacher == student -> opd_reverse_kl ~= 0 (inert). # ============================================================================= set -ex -export PYTHONUNBUFFERED=16 +export PYTHONUNBUFFERED=1 MODE=${MODE:-pure} MODEL_DIR=${MODEL_DIR:-/cluster_public/miles_data/models} diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh index a208ca11a5..263e7c0987 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh @@ -11,7 +11,7 @@ set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh index 1d3f843b5b..a719d143ea 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh @@ -86,7 +86,7 @@ print(f"wrote {n} tagged prompts to {out_path}") PYEOF -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd.sh b/examples/on_policy_distillation/run-qwen3-8B-opd.sh index c684d7aa21..71d11514e7 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd.sh @@ -34,7 +34,7 @@ echo "Teacher model server is up and running at $TEACHER_IP:$TEACHER_PORT." sleep 10 -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index 90509fb82c..3cf54876f9 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -148,7 +148,7 @@ def execute_train( if not external_ray: exec_command( # will prevent ray from buffering stdout/stderr - f"export PYTHONBUFFERED=16 && " + f"export PYTHONUNBUFFERED=1 && " f"ray start --head --node-ip-address {master_addr} --num-gpus {num_gpus_per_node} --disable-usage-stats" ) @@ -156,6 +156,8 @@ def execute_train( f() runtime_env_vars = { + # exported for the submitting client too, but only the runtime env reaches the ray workers + "PYTHONUNBUFFERED": "1", # If setting this in FSDP, the computation communication overlapping may have issues **( {} @@ -196,7 +198,7 @@ def execute_train( else "" ) exec_command( - f"export no_proxy=127.0.0.1 && export PYTHONBUFFERED=16 && " + f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " f"{cmd_megatron_model_source}" f"""ray job submit {'' if 'RAY_ADDRESS' in os.environ else '--address="http://127.0.0.1:8265" '}""" f"--runtime-env-json={shlex.quote(runtime_env_json)} " diff --git a/scripts/amd/run-qwen3-4B-amd.sh b/scripts/amd/run-qwen3-4B-amd.sh index bc6d4d40c0..d3251fcf50 100644 --- a/scripts/amd/run-qwen3-4B-amd.sh +++ b/scripts/amd/run-qwen3-4B-amd.sh @@ -17,7 +17,7 @@ export RAY_EXPERIMENTAL_NOSET_HIP_VISIBLE_DEVICES=${RAY_EXPERIMENTAL_NOSET_HIP_V export RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES=${RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES:-"1"} # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 if [[ -n "${HIP_VISIBLE_DEVICES:-}" ]]; then export CUDA_VISIBLE_DEVICES="${HIP_VISIBLE_DEVICES}" diff --git a/scripts/run-deepseek-r1.sh b/scripts/run-deepseek-r1.sh index 93e6c0f4bf..35e3d313e3 100644 --- a/scripts/run-deepseek-r1.sh +++ b/scripts/run-deepseek-r1.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-glm4-9B-4xgpu-radixtree.sh b/scripts/run-glm4-9B-4xgpu-radixtree.sh index 09ac6f892a..dbebcd3782 100755 --- a/scripts/run-glm4-9B-4xgpu-radixtree.sh +++ b/scripts/run-glm4-9B-4xgpu-radixtree.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=0,1,2,3 diff --git a/scripts/run-glm4-9B.sh b/scripts/run-glm4-9B.sh index b67523883f..84080ae63b 100644 --- a/scripts/run-glm4-9B.sh +++ b/scripts/run-glm4-9B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-glm4.5-355B-A32B.sh b/scripts/run-glm4.5-355B-A32B.sh index 0deaf0b887..36e3366e0c 100644 --- a/scripts/run-glm4.5-355B-A32B.sh +++ b/scripts/run-glm4.5-355B-A32B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-glm4.7-flash.sh b/scripts/run-glm4.7-flash.sh index 790c556081..18e58fa88e 100644 --- a/scripts/run-glm4.7-flash.sh +++ b/scripts/run-glm4.7-flash.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-gpt-oss-20b-bf16.sh b/scripts/run-gpt-oss-20b-bf16.sh index c5495d2a02..6ad71ce4c2 100644 --- a/scripts/run-gpt-oss-20b-bf16.sh +++ b/scripts/run-gpt-oss-20b-bf16.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 export HF_HOME=/workspace/hf_cache # Load model architecture config diff --git a/scripts/run-kimi-k2-Instruct.sh b/scripts/run-kimi-k2-Instruct.sh index 86919eff4d..28715be2b7 100644 --- a/scripts/run-kimi-k2-Instruct.sh +++ b/scripts/run-kimi-k2-Instruct.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-kimi-k2-Thinking.sh b/scripts/run-kimi-k2-Thinking.sh index e5006b3b57..b36a034b89 100644 --- a/scripts/run-kimi-k2-Thinking.sh +++ b/scripts/run-kimi-k2-Thinking.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-kimi-k25.sh b/scripts/run-kimi-k25.sh index bdeb46d8ca..e0ec3ccccc 100755 --- a/scripts/run-kimi-k25.sh +++ b/scripts/run-kimi-k25.sh @@ -16,7 +16,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-mimo-7B-rl-eagle.sh b/scripts/run-mimo-7B-rl-eagle.sh index 092f25fef0..2efbc2d6be 100644 --- a/scripts/run-mimo-7B-rl-eagle.sh +++ b/scripts/run-mimo-7B-rl-eagle.sh @@ -14,7 +14,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-moonlight-16B-A3B.sh b/scripts/run-moonlight-16B-A3B.sh index ef695d398b..69a66fdfc4 100644 --- a/scripts/run-moonlight-16B-A3B.sh +++ b/scripts/run-moonlight-16B-A3B.sh @@ -14,7 +14,7 @@ pkill -9 redis set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-nemotron-3-nano-30b-a3b.sh b/scripts/run-nemotron-3-nano-30b-a3b.sh index da6c568b72..4123adb882 100755 --- a/scripts/run-nemotron-3-nano-30b-a3b.sh +++ b/scripts/run-nemotron-3-nano-30b-a3b.sh @@ -14,7 +14,7 @@ pkill -9 ray pkill -9 python set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then HAS_NVLINK=1; else HAS_NVLINK=0; fi diff --git a/scripts/run-nemotron-3-nano-4b.sh b/scripts/run-nemotron-3-nano-4b.sh index 34a61f2cb5..dfdfe7743b 100644 --- a/scripts/run-nemotron-3-nano-4b.sh +++ b/scripts/run-nemotron-3-nano-4b.sh @@ -15,7 +15,7 @@ pkill -9 python set -ex -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-nemotron-3-super-120b-a12b.sh b/scripts/run-nemotron-3-super-120b-a12b.sh index 5f0a5f400f..fd1e31f146 100755 --- a/scripts/run-nemotron-3-super-120b-a12b.sh +++ b/scripts/run-nemotron-3-super-120b-a12b.sh @@ -23,7 +23,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-235B-A22B-sft.sh b/scripts/run-qwen3-235B-A22B-sft.sh index 50b46c0485..a5a801c4c8 100644 --- a/scripts/run-qwen3-235B-A22B-sft.sh +++ b/scripts/run-qwen3-235B-A22B-sft.sh @@ -24,7 +24,7 @@ if [ -z "${MASTER_ADDR}" ]; then fi # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-235B-A22B.sh b/scripts/run-qwen3-235B-A22B.sh index ffd5972ac0..45067036fb 100644 --- a/scripts/run-qwen3-235B-A22B.sh +++ b/scripts/run-qwen3-235B-A22B.sh @@ -24,7 +24,7 @@ if [ -z "${MASTER_ADDR}" ]; then fi # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-32B.sh b/scripts/run-qwen3-32B.sh index f6eb8240a8..156bcf5d03 100644 --- a/scripts/run-qwen3-32B.sh +++ b/scripts/run-qwen3-32B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-4B-base-sft.sh b/scripts/run-qwen3-4B-base-sft.sh index 6086313e0e..a30209f750 100644 --- a/scripts/run-qwen3-4B-base-sft.sh +++ b/scripts/run-qwen3-4B-base-sft.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-4B.sh b/scripts/run-qwen3-4B.sh index 11f23d3589..2285cf57c0 100644 --- a/scripts/run-qwen3-4B.sh +++ b/scripts/run-qwen3-4B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-4B_4xgpu.sh b/scripts/run-qwen3-4B_4xgpu.sh index 7a2cd4113b..96d9a42eaa 100755 --- a/scripts/run-qwen3-4B_4xgpu.sh +++ b/scripts/run-qwen3-4B_4xgpu.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 export CUDA_VISIBLE_DEVICES=4,5,6,7 diff --git a/scripts/run-qwen3-next-80B-A3B-8gpus.sh b/scripts/run-qwen3-next-80B-A3B-8gpus.sh index 7e36e19442..bc110cf43b 100644 --- a/scripts/run-qwen3-next-80B-A3B-8gpus.sh +++ b/scripts/run-qwen3-next-80B-A3B-8gpus.sh @@ -24,7 +24,7 @@ if [ -z "${MASTER_ADDR}" ]; then fi # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3-next-80B-A3B.sh b/scripts/run-qwen3-next-80B-A3B.sh index d5d7251241..545c8a1309 100644 --- a/scripts/run-qwen3-next-80B-A3B.sh +++ b/scripts/run-qwen3-next-80B-A3B.sh @@ -24,7 +24,7 @@ if [ -z "${MASTER_ADDR}" ]; then fi # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3.5-27B.sh b/scripts/run-qwen3.5-27B.sh index ac2109de59..3eab260fb1 100644 --- a/scripts/run-qwen3.5-27B.sh +++ b/scripts/run-qwen3.5-27B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3.5-35B-A3B-mtp.sh b/scripts/run-qwen3.5-35B-A3B-mtp.sh index 1f16b7120e..062d99686e 100755 --- a/scripts/run-qwen3.5-35B-A3B-mtp.sh +++ b/scripts/run-qwen3.5-35B-A3B-mtp.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3.5-4B.sh b/scripts/run-qwen3.5-4B.sh index 211f502cde..7fce9bdae9 100644 --- a/scripts/run-qwen3.5-4B.sh +++ b/scripts/run-qwen3.5-4B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3.5-9B.sh b/scripts/run-qwen3.5-9B.sh index 9bfacf6abc..7664feb47b 100644 --- a/scripts/run-qwen3.5-9B.sh +++ b/scripts/run-qwen3.5-9B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/scripts/run-qwen3.6-27B.sh b/scripts/run-qwen3.6-27B.sh index c339f1d906..dbe7c7c2c0 100755 --- a/scripts/run-qwen3.6-27B.sh +++ b/scripts/run-qwen3.6-27B.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 NVLINK_COUNT=$(nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l) if [ "$NVLINK_COUNT" -gt 0 ]; then diff --git a/tests/fast/test_ray_launcher_unbuffering.py b/tests/fast/test_ray_launcher_unbuffering.py new file mode 100644 index 0000000000..d397c03fb1 --- /dev/null +++ b/tests/fast/test_ray_launcher_unbuffering.py @@ -0,0 +1,39 @@ +import subprocess +from pathlib import Path + +import pytest + +REPO_ROOT = Path(__file__).resolve().parents[2] +LAUNCHER_DIRS = ("examples", "scripts", "tools", "miles/utils/external_utils") +RAY_RUNTIME_ENV_MARKERS = ("runtime-env-json", "runtime_env=", "runtime_env_json") + + +def tracked_files() -> list[Path]: + listing = subprocess.run( + ["git", "-C", str(REPO_ROOT), "ls-files", "-z", *LAUNCHER_DIRS], + capture_output=True, + text=True, + check=True, + ) + return [REPO_ROOT / name for name in listing.stdout.split("\0") if name.endswith((".py", ".sh"))] + + +def ray_launchers() -> list[Path]: + return [path for path in tracked_files() if any(marker in path.read_text() for marker in RAY_RUNTIME_ENV_MARKERS)] + + +def test_the_repo_has_ray_launchers_to_check() -> None: + """A discovery bug that finds nothing would make every other check in this file vacuous.""" + assert len(ray_launchers()) > 50 + + +@pytest.mark.parametrize("launcher", ray_launchers(), ids=lambda path: str(path.relative_to(REPO_ROOT))) +def test_every_ray_launcher_unbuffers_python(launcher: Path) -> None: + """Ray buffers worker stdout unless PYTHONUNBUFFERED rides along with the job it submits.""" + assert "PYTHONUNBUFFERED" in launcher.read_text() + + +@pytest.mark.parametrize("launcher", ray_launchers(), ids=lambda path: str(path.relative_to(REPO_ROOT))) +def test_no_ray_launcher_spells_the_variable_wrong(launcher: Path) -> None: + """PYTHONBUFFERED is not a variable python reads; the typo silently buffers everything.""" + assert "PYTHONBUFFERED" not in launcher.read_text().replace("PYTHONUNBUFFERED", "") diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 6719aac92e..fa3a88c195 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -24,6 +24,40 @@ def test_convert_checkpoint_preserves_source_paths(monkeypatch, tmp_path): assert f"PYTHONPATH={shlex.quote(expected)} " in commands[0] +def test_execute_train_exports_unbuffered_python_to_ray(monkeypatch): + """Ray start and job submit must export the correctly spelled PYTHONUNBUFFERED.""" + commands = [] + monkeypatch.delenv("MILES_SCRIPT_EXTERNAL_RAY", raising=False) + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + + command_utils.execute_train( + train_args="", + num_gpus_per_node=1, + megatron_model_type="model_type", + ) + + exports = [command for command in commands if "export PYTHONUNBUFFERED" in command] + assert len(exports) == 2 + assert not any("PYTHONBUFFERED" in command for command in commands) + assert all("export PYTHONUNBUFFERED=1 &&" in command for command in exports) + + +def test_execute_train_unbuffers_the_ray_workers_too(monkeypatch): + """An export only reaches the submitting client; the ray workers read the runtime environment.""" + commands = [] + monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + + command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="model_type") + + runtime_env_arg = next(arg for arg in shlex.split(commands[-1]) if arg.startswith("--runtime-env-json=")) + assert json.loads(runtime_env_arg.split("=", 1)[1])["env_vars"]["PYTHONUNBUFFERED"] == "1" + + def test_execute_train_preserves_source_paths_in_ray_runtime(monkeypatch): commands = [] monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") diff --git a/tests/test_gspo.sh b/tests/test_gspo.sh index 6e915ca652..830e3bbcc6 100644 --- a/tests/test_gspo.sh +++ b/tests/test_gspo.sh @@ -13,7 +13,7 @@ pkill -9 python set -ex # will prevent ray from buffering stdout/stderr -export PYTHONBUFFERED=16 +export PYTHONUNBUFFERED=1 CKPT_ARGS=( --hf-checkpoint /root/Qwen3-0.6B diff --git a/tools/convert_torch_dist_to_hf_ray.py b/tools/convert_torch_dist_to_hf_ray.py index bc5b542986..f36edb9dea 100644 --- a/tools/convert_torch_dist_to_hf_ray.py +++ b/tools/convert_torch_dist_to_hf_ray.py @@ -1140,6 +1140,7 @@ def make_conversion_actor(): num_gpus=0, runtime_env={ "env_vars": { + "PYTHONUNBUFFERED": "1", "RAY_ACCEL_ENV_VAR_OVERRIDE_ON_ZERO": "0", "RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES": "1", } From c17b0233dbb0371d8495210d07d04fda90f197be Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 14:27:45 +0800 Subject: [PATCH 02/18] Add a shell launch script test harness for future protection Squashed from: - Add a shell launch script test harness - Make the shell harness report stderr and emit shim stdout correctly - Drop the deprecated huggingface-cli shim - Exercise the shim behaviours the single real script never reaches - Poll the ray cluster the way the real scripts do in the synthetic script - Group the harness tests by what they exercise - Make the harness record commands in fork order and refuse to be unfrozen --- tests/fast/launch_scripts/__init__.py | 0 tests/fast/launch_scripts/sh_harness.py | 201 +++++++++++++++++++ tests/fast/launch_scripts/test_sh_harness.py | 165 +++++++++++++++ 3 files changed, 366 insertions(+) create mode 100644 tests/fast/launch_scripts/__init__.py create mode 100644 tests/fast/launch_scripts/sh_harness.py create mode 100644 tests/fast/launch_scripts/test_sh_harness.py diff --git a/tests/fast/launch_scripts/__init__.py b/tests/fast/launch_scripts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/launch_scripts/sh_harness.py b/tests/fast/launch_scripts/sh_harness.py new file mode 100644 index 0000000000..7bc3d14e81 --- /dev/null +++ b/tests/fast/launch_scripts/sh_harness.py @@ -0,0 +1,201 @@ +import json +import os +import signal +import subprocess +import time +from dataclasses import dataclass +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[3] +REPO_ROOT_PLACEHOLDER = "" +SANDBOX_PLACEHOLDER = "" + +_ARG_SEPARATOR = "\x1f" +_RECORD_SEPARATOR = "\x1e" + +_SYSTEM_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + +_FROZEN_ENV = { + "HOME": "/root", + "LANG": "C", + "LC_ALL": "C", + "TERM": "dumb", + "MASTER_ADDR": "127.0.0.1", + "NODE_RANK": "0", + "WANDB_KEY": "frozen-wandb-key", + "WANDB_API_KEY": "frozen-wandb-api-key", +} + +_SHIMMED_COMMANDS = ( + "apt", + "apt-get", + "curl", + "date", + "docker", + "git", + "hf", + "ip", + "mkdir", + "nc", + "nvidia-smi", + "pip", + "pip3", + "pkill", + "python", + "python3", + "ray", + "rm", + "rsync", + "sleep", + "torchrun", + "wget", +) + +_SHIM_STDOUT = { + # large enough that "wait until this many GPUs joined the ray cluster" loops exit immediately + "python": "1000000", + "python3": "1000000", + "date": "20260101_000000", +} + +_SHIM_TEMPLATE = """#!/bin/bash +record="$$${{MILES_SH_HARNESS_ARG_SEP}}{name}" +for arg in "$@"; do + record="$record$MILES_SH_HARNESS_ARG_SEP$arg" +done +printf '%s%s' "$record" "$MILES_SH_HARNESS_RECORD_SEP" >>"$MILES_SH_HARNESS_CAPTURE" +{stdout_statement}exit 0 +""" + + +@dataclass(frozen=True) +class LaunchScriptRun: + invocations: list[list[str]] + stdout: str + stderr: str + returncode: int + + def invocations_of(self, command: str) -> list[list[str]]: + return [argv for argv in self.invocations if argv[0] == command] + + def ray_job_submit_argv(self) -> list[str]: + matches = [argv for argv in self.invocations_of("ray") if argv[1:3] == ["job", "submit"]] + assert len(matches) == 1, f"expected exactly one `ray job submit`, got {len(matches)}" + return matches[0] + + +def run_launch_script( + script: Path, + sandbox: Path, + extra_env: dict[str, str] | None = None, + timeout: float = 120.0, +) -> LaunchScriptRun: + sandbox.mkdir(parents=True, exist_ok=True) + fake_bin = sandbox / "fake_bin" + capture = sandbox / "capture" + workdir = sandbox / "workdir" + _write_shims(fake_bin) + capture.write_bytes(b"") + workdir.mkdir(exist_ok=True) + + frozen = { + **_FROZEN_ENV, + "PATH": f"{fake_bin}:{_SYSTEM_PATH}", + "MILES_SH_HARNESS_CAPTURE": str(capture), + "MILES_SH_HARNESS_ARG_SEP": _ARG_SEPARATOR, + "MILES_SH_HARNESS_RECORD_SEP": _RECORD_SEPARATOR, + } + _reject_unfreezing(extra_env or {}, frozen=frozen) + + deadline = time.monotonic() + timeout + process = subprocess.Popen( + ["bash", str(script)], + cwd=workdir, + env={**frozen, **(extra_env or {})}, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + start_new_session=True, + ) + try: + stdout, stderr = process.communicate(timeout=timeout) + except subprocess.TimeoutExpired: + os.killpg(process.pid, signal.SIGKILL) + process.communicate() + raise + _wait_until_the_script_leaves_nothing_running(process.pid, deadline=deadline) + + invocations = _parse_capture(capture.read_text(), sandbox=sandbox) + + return LaunchScriptRun( + invocations=invocations, + stdout=_sanitize(stdout, sandbox=sandbox), + stderr=_sanitize(stderr, sandbox=sandbox), + returncode=process.returncode, + ) + + +def format_invocations(invocations: list[list[str]]) -> str: + lines = [] + for index, argv in enumerate(invocations): + lines.append(f"### {index}") + lines.extend(json.dumps(arg) for arg in argv) + lines.append("") + return "\n".join(lines) + + +def _reject_unfreezing(extra_env: dict[str, str], frozen: dict[str, str]) -> None: + """Silently shadowing PATH or a frozen value would unshim the run or unfreeze the snapshot.""" + collisions = sorted(set(extra_env) & set(frozen)) + assert not collisions, f"extra_env may not override the harness-controlled {collisions}" + + +def _wait_until_the_script_leaves_nothing_running(pgid: int, deadline: float) -> None: + """A script backgrounding a shimmed command outlives bash, and would append after we read.""" + while True: + alive = _live_pids_of_group(pgid) + if not alive: + return + assert time.monotonic() < deadline, f"process group {pgid} still running after the timeout: {sorted(alive)}" + time.sleep(0.005) + + +def _live_pids_of_group(pgid: int) -> set[int]: + """A zombie can no longer append to the capture, but killpg still reports its group as alive. + + A command backgrounded inside a command substitution is orphaned when the substitution's + subshell exits, and nothing reaps it when PID 1 is not an init that does so. + """ + live = set() + for entry in Path("/proc").iterdir(): + if not entry.name.isdigit(): + continue + try: + fields = (entry / "stat").read_text().rpartition(")")[2].split() + except OSError: + continue + state, process_group = fields[0], int(fields[2]) + if process_group == pgid and state != "Z": + live.add(int(entry.name)) + return live + + +def _write_shims(fake_bin: Path) -> None: + fake_bin.mkdir(exist_ok=True) + for name in _SHIMMED_COMMANDS: + stdout = _SHIM_STDOUT.get(name) + stdout_statement = "" if stdout is None else f"printf '%s\\n' {stdout!a}\n" + shim = fake_bin / name + shim.write_text(_SHIM_TEMPLATE.format(name=name, stdout_statement=stdout_statement)) + shim.chmod(0o755) + + +def _parse_capture(raw: str, sandbox: Path) -> list[list[str]]: + """Order by pid, not by append order: a `&` child appends whenever it gets scheduled.""" + records = [record.split(_ARG_SEPARATOR) for record in raw.split(_RECORD_SEPARATOR) if record != ""] + records.sort(key=lambda record: int(record[0])) + return [[_sanitize(arg, sandbox=sandbox) for arg in record[1:]] for record in records] + + +def _sanitize(text: str, sandbox: Path) -> str: + return text.replace(str(sandbox), SANDBOX_PLACEHOLDER).replace(str(REPO_ROOT), REPO_ROOT_PLACEHOLDER) diff --git a/tests/fast/launch_scripts/test_sh_harness.py b/tests/fast/launch_scripts/test_sh_harness.py new file mode 100644 index 0000000000..c0de9fc1b0 --- /dev/null +++ b/tests/fast/launch_scripts/test_sh_harness.py @@ -0,0 +1,165 @@ +import pytest + +from tests.fast.launch_scripts import sh_harness +from tests.fast.launch_scripts.sh_harness import REPO_ROOT, REPO_ROOT_PLACEHOLDER, run_launch_script + +_SCRIPT = REPO_ROOT / "scripts" / "run-qwen3-4B.sh" + +_BACKGROUNDING_SCRIPT = """#!/bin/bash +set -ex +python3 -m sglang.launch_server --port 13141 >/dev/null 2>&1 & +curl -sf http://127.0.0.1:13141/health_generate +ray job submit --address="http://127.0.0.1:8265" -- python3 train.py +""" + +_BACKGROUNDING_INSIDE_A_SUBSTITUTION_SCRIPT = """#!/bin/bash +set -ex +start_server() { + python3 -m sglang.launch_server --port "$1" >/dev/null 2>&1 & + echo "/tmp/server-$1.log" +} +LOG=$(start_server 13141) +curl -sf http://127.0.0.1:13141/health_generate +ray job submit --address="http://127.0.0.1:8265" -- python3 train.py "$LOG" +""" + +_SYNTHETIC_SCRIPT = """#!/bin/bash +set -ex +EXPECTED_GPUS=32 +while true; do + AVAILABLE_GPUS=$(python3 -c "import ray; print(int(ray.cluster_resources().get('GPU', 0)))" 2>/dev/null || echo 0) + if [ "$AVAILABLE_GPUS" -ge "$EXPECTED_GPUS" ]; then + break + fi + sleep 5 +done +hf download some/model --local-dir /root/models/some-model +torchrun --nproc-per-node 8 CHECKOUT/tools/convert_hf_to_torch_dist.py +ray job submit --address="http://127.0.0.1:8265" -- python3 CHECKOUT/train.py +""" + + +class TestRunLaunchScriptOnARealScript: + @pytest.fixture + def run(self, tmp_path): + return run_launch_script(_SCRIPT, sandbox=tmp_path) + + def test_script_runs_to_completion_without_touching_the_real_system(self, run): + """The shimmed PATH lets a real launch script run end to end and exit cleanly.""" + assert run.returncode == 0 + + def test_destructive_commands_are_intercepted_instead_of_executed(self, run): + """pkill / ray stop are recorded by shims, so they never reach the test runner.""" + assert ["pkill", "-9", "sglang"] in run.invocations + assert ["ray", "stop", "--force"] in run.invocations + + def test_ray_start_is_recorded_with_the_frozen_master_addr(self, run): + """Node address comes from the frozen environment, not from the developer machine.""" + (ray_start,) = [argv for argv in run.invocations_of("ray") if argv[1] == "start"] + assert "--node-ip-address" in ray_start + assert ray_start[ray_start.index("--node-ip-address") + 1] == "127.0.0.1" + + def test_ray_job_submit_argv_contains_the_expanded_model_args(self, run): + """`source scripts/models/*.sh` expansion must be visible in the captured argv.""" + argv = run.ray_job_submit_argv() + assert argv[:3] == ["ray", "job", "submit"] + assert "--num-layers" in argv + assert argv[argv.index("--num-layers") + 1] == "36" + assert argv[argv.index("--hf-checkpoint") + 1] == "/root/Qwen3-4B" + + def test_nvlink_detection_is_frozen_to_absent(self, run): + """The nvidia-smi shim reports no NVLink, so NCCL_NVLS_ENABLE is deterministic.""" + argv = run.ray_job_submit_argv() + (runtime_env,) = [arg for arg in argv if arg.startswith("--runtime-env-json=")] + assert '"NCCL_NVLS_ENABLE": "0"' in runtime_env + + def test_reruns_produce_identical_recordings(self, tmp_path): + """Snapshot testing only works if the harness is deterministic across runs.""" + first = run_launch_script(_SCRIPT, sandbox=tmp_path / "a") + second = run_launch_script(_SCRIPT, sandbox=tmp_path / "b") + + assert first.invocations == second.invocations + + +class TestRunLaunchScriptOnABackgroundingScript: + @pytest.fixture + def script(self, tmp_path): + script = tmp_path / "backgrounding.sh" + script.write_text(_BACKGROUNDING_SCRIPT) + return script + + def test_a_backgrounded_command_is_still_recorded(self, script, tmp_path): + """bash exits without reaping `&` children, so reading the capture too early loses them.""" + run = run_launch_script(script, sandbox=tmp_path / "sandbox", timeout=30) + + assert run.returncode == 0 + assert run.invocations_of("python3")[0][1:3] == ["-m", "sglang.launch_server"] + + @pytest.mark.parametrize("attempt", range(20)) + def test_backgrounding_does_not_perturb_the_recorded_order(self, script, tmp_path, attempt): + """Snapshots assert an exact sequence, so a `&` must not shuffle records run to run.""" + run = run_launch_script(script, sandbox=tmp_path / f"sandbox-{attempt}", timeout=30) + + assert [argv[0] for argv in run.invocations] == ["python3", "curl", "ray"] + + def test_records_are_ordered_by_the_fork_that_made_them_not_by_arrival(self, tmp_path): + """bash forks in command order, so the pid orders records even when a `&` child appends late.""" + late_background = f"11{sh_harness._ARG_SEPARATOR}python3{sh_harness._RECORD_SEPARATOR}" + foreground = f"12{sh_harness._ARG_SEPARATOR}curl{sh_harness._RECORD_SEPARATOR}" + + parsed = sh_harness._parse_capture(foreground + late_background, sandbox=tmp_path) + + assert parsed == [["python3"], ["curl"]] + + def test_a_command_backgrounded_inside_a_substitution_does_not_hang_the_run(self, tmp_path): + """Orphaned by its subshell, it lingers as a zombie wherever PID 1 does not reap, and killpg still sees the group.""" + script = tmp_path / "substitution.sh" + script.write_text(_BACKGROUNDING_INSIDE_A_SUBSTITUTION_SCRIPT) + + run = run_launch_script(script, sandbox=tmp_path / "sandbox", timeout=30) + + assert run.returncode == 0 + assert [argv[0] for argv in run.invocations] == ["python3", "curl", "ray"] + + +class TestRunLaunchScriptEnvironmentFreeze: + def test_extra_env_may_not_shadow_a_frozen_variable(self, tmp_path): + """A caller overriding MASTER_ADDR would unfreeze every snapshot that records it.""" + with pytest.raises(AssertionError, match="MASTER_ADDR"): + run_launch_script(_SCRIPT, sandbox=tmp_path, extra_env={"MASTER_ADDR": "10.0.0.9"}) + + def test_extra_env_may_not_shadow_the_capture_channel(self, tmp_path): + """Redirecting the capture path would make every shim record vanish silently.""" + with pytest.raises(AssertionError, match="MILES_SH_HARNESS_CAPTURE"): + run_launch_script(_SCRIPT, sandbox=tmp_path, extra_env={"MILES_SH_HARNESS_CAPTURE": "/dev/null"}) + + def test_extra_env_may_still_supply_a_variable_the_harness_does_not_own(self, tmp_path): + """The freeze must not block the per-script inputs the snapshot suite has to pass in.""" + run = run_launch_script(_SCRIPT, sandbox=tmp_path, extra_env={"BASE_FOLDER": "/frozen/checkpoints"}) + + assert run.returncode == 0 + + +class TestRunLaunchScriptOnTheShimEdgeCases: + @pytest.fixture + def run(self, tmp_path): + script = tmp_path / "synthetic.sh" + script.write_text(_SYNTHETIC_SCRIPT.replace("CHECKOUT", str(REPO_ROOT))) + return run_launch_script(script, sandbox=tmp_path / "sandbox", timeout=30) + + def test_a_gpu_wait_loop_leaves_on_its_first_poll(self, run): + """The python shim must emit a real number; emitting its repr spins the loop until timeout.""" + assert run.returncode == 0 + assert run.invocations_of("sleep") == [] + + def test_downloads_and_torchrun_are_intercepted(self, run): + """Unshimmed, these would pull real weights and start a real training job.""" + assert run.invocations_of("hf")[0][1] == "download" + assert run.invocations_of("torchrun")[0][1] == "--nproc-per-node" + + def test_a_repo_path_inside_argv_becomes_a_placeholder(self, run): + """Recordings must not embed the checkout location of whoever ran the test.""" + torchrun_argv = run.invocations_of("torchrun")[0] + + assert torchrun_argv[-1] == f"{REPO_ROOT_PLACEHOLDER}/tools/convert_hf_to_torch_dist.py" + assert str(REPO_ROOT) not in " ".join(torchrun_argv) From 0e26739e458226143209d1eb81585f6f4c9d4169 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Sun, 26 Jul 2026 23:22:12 +0800 Subject: [PATCH 03/18] Fix various launch scripts errors about missing line concatenations or paths Squashed from: - Fix launch scripts whose model config path could never resolve - Fix two launcher entrypoints that raised before issuing any command - Cover the two regressions this op fixes --- .../low_precision/run-kimi-k2-Thinking-int4.sh | 2 +- .../low_precision/run-moonlight-16B-A3B-int4.sh | 2 +- .../low_precision/run-qwen3-235B-A22B-int4.sh | 2 +- .../low_precision/run-qwen3-30B-A3B-int4.sh | 2 +- examples/lora/run-qwen3-4B-megatron-lora.sh | 6 +++--- miles/utils/external_utils/command_utils.py | 8 ++++++-- scripts/run-kimi-k2-Instruct.sh | 2 +- scripts/run-kimi-k2-Thinking.sh | 2 +- tests/fast/utils/test_command_utils.py | 16 ++++++++++++++++ 9 files changed, 31 insertions(+), 11 deletions(-) diff --git a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh index bb15892442..f7fa4840e2 100644 --- a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh +++ b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh @@ -24,7 +24,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../models/kimi-k2-thinking.sh" +source "${SCRIPT_DIR}/../../../scripts/models/kimi-k2-thinking.sh" CKPT_ARGS=( --hf-checkpoint /root/Kimi-K2-Thinking/ diff --git a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh index f941f0b728..17b81f2ee8 100644 --- a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh @@ -25,7 +25,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../models/moonlight.sh" +source "${SCRIPT_DIR}/../../../scripts/models/moonlight.sh" CKPT_ARGS=( --hf-checkpoint /root/Moonlight-16B-A3B-Instruct-INT4 diff --git a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh index a859ad59da..490f8e4141 100644 --- a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh @@ -24,7 +24,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../models/qwen3-235B-A22B.sh" +source "${SCRIPT_DIR}/../../../scripts/models/qwen3-235B-A22B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-235B-A22B-INT4/ diff --git a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh index 7dbc5c2327..0ff20072ec 100644 --- a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh @@ -24,7 +24,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../models/qwen3-30B-A3B.sh" +source "${SCRIPT_DIR}/../../../scripts/models/qwen3-30B-A3B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-30B-A3B-INT4/ diff --git a/examples/lora/run-qwen3-4B-megatron-lora.sh b/examples/lora/run-qwen3-4B-megatron-lora.sh index 9f8f92c4ae..48ed58344e 100644 --- a/examples/lora/run-qwen3-4B-megatron-lora.sh +++ b/examples/lora/run-qwen3-4B-megatron-lora.sh @@ -29,12 +29,12 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../.." &>/dev/null && pwd)" -source "${REPO_ROOT}/miles/scripts/models/qwen3-4B.sh" +REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." &>/dev/null && pwd)" +source "${REPO_ROOT}/scripts/models/qwen3-4B.sh" # Store eval/delegate settings in a YAML config similar to examples/experimental/eval_multi_task. # EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/examples/experimental/eval/scripts/multi_tasks.yaml"} -EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/miles/examples/experimental/eval/scripts/multi_tasks.yaml"} +EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/examples/experimental/eval/scripts/multi_tasks.yaml"} CKPT_ARGS=( diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index 3cf54876f9..e76ff9be5a 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -75,8 +75,10 @@ def convert_checkpoint( ) -def rsync_simple(path_src: str, path_dst: str): - exec_command_all_ray_node(f"mkdir -p {path_dst} && rsync -a --info=progress2 {path_src}/ {path_dst}") +def rsync_simple(path_src: str, path_dst: str, num_nodes: int | None = None): + exec_command_all_ray_node( + f"mkdir -p {path_dst} && rsync -a --info=progress2 {path_src}/ {path_dst}", num_nodes=num_nodes + ) def hf_download_dataset(full_name: str, data_dir: str = "/root/datasets"): @@ -341,6 +343,8 @@ def save_to_temp_file(text: str, ext: str): "H100": 8, "GB200": 4, "GB300": 4, + "MI350X": 8, + "MI355X": 8, } GENERATION_HARDWARE = { diff --git a/scripts/run-kimi-k2-Instruct.sh b/scripts/run-kimi-k2-Instruct.sh index 28715be2b7..525f63c6a7 100644 --- a/scripts/run-kimi-k2-Instruct.sh +++ b/scripts/run-kimi-k2-Instruct.sh @@ -168,7 +168,7 @@ ray job submit --address="http://127.0.0.1:8265" \ --actor-num-nodes 32 \ --actor-num-gpus-per-node 8 \ --colocate \ - --update-weight-buffer-size $(( 4 * 512 * 1024 * 1024)) + --update-weight-buffer-size $(( 4 * 512 * 1024 * 1024)) \ ${MODEL_ARGS[@]} \ ${CKPT_ARGS[@]} \ ${ROLLOUT_ARGS[@]} \ diff --git a/scripts/run-kimi-k2-Thinking.sh b/scripts/run-kimi-k2-Thinking.sh index b36a034b89..d603fedb47 100644 --- a/scripts/run-kimi-k2-Thinking.sh +++ b/scripts/run-kimi-k2-Thinking.sh @@ -170,7 +170,7 @@ ray job submit --address="http://127.0.0.1:8265" \ --actor-num-nodes 32 \ --actor-num-gpus-per-node 8 \ --colocate \ - --update-weight-buffer-size $(( 4 * 512 * 1024 * 1024)) + --update-weight-buffer-size $(( 4 * 512 * 1024 * 1024)) \ ${MODEL_ARGS[@]} \ ${CKPT_ARGS[@]} \ ${ROLLOUT_ARGS[@]} \ diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index fa3a88c195..d30c13049c 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -149,3 +149,19 @@ def fail_wait(*args, **kwargs): assert len(commands) == 2 assert all("pkill -x mooncake_master" in command for command in commands) + + +@pytest.mark.parametrize("hardware", ["H100", "GB200", "GB300", "MI350X", "MI355X"]) +def test_every_supported_hardware_declares_its_gpus_per_node(hardware): + """A launcher whose default hardware is missing here raises KeyError before doing anything.""" + assert command_utils.NUM_GPUS_OF_HARDWARE[hardware] > 0 + + +def test_rsync_simple_limits_itself_to_the_requested_node_count(monkeypatch): + """prepare_cp asks for the training node count; forwarding it is the whole point of the argument.""" + calls = [] + monkeypatch.setattr(command_utils, "exec_command_all_ray_node", lambda cmd, **kwargs: calls.append(kwargs)) + + command_utils.rsync_simple("/src", "/dst", num_nodes=4) + + assert calls == [{"num_nodes": 4}] From b68927a6e669a781fe093da35366820ca4b4ad38 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Sun, 26 Jul 2026 23:30:21 +0800 Subject: [PATCH 04/18] Derive the miles checkout location instead of hardcoding it in launch scripts Squashed from: - Derive the miles checkout location instead of hardcoding it - Quote the derived train.py path and pin the invariant - Find the shell scripts without shelling out to git --- .../multi_agent/run-qwen3-30B-A3B-multi-agent.sh | 2 +- .../strands_sglang/strands_qwen3_8b.sh | 6 ++++-- .../run-glm4.5-air-8node-profile.sh | 2 +- .../run-glm4.7-flash-2node-profile.sh | 2 +- .../run-glm5-disagg-profile.sh | 2 +- .../run-kimi-k2-64node-profile.sh | 2 +- .../run-qwen3-235B-A22B-16node-profile.sh | 2 +- .../run-qwen3-30B-A3B-4node-profile.sh | 2 +- .../run-qwen3-4b-mis.sh | 2 +- .../lora/run-qwen3-4b-megatron-lora-result.sh | 2 +- .../qwen3_5_35b_selfdistill/convert_gb200.sh | 2 +- .../phase1_rlvr_teacher.sh | 4 ++-- .../qwen3_5_35b_selfdistill/phase2_gb200.sh | 4 ++-- .../phase2_opd_selfdistill.sh | 4 ++-- .../run-qwen3-8B-opd-megatron.sh | 3 ++- .../run-qwen3-8B-opd-multi-teacher.sh | 3 ++- .../on_policy_distillation/run-qwen3-8B-opd.sh | 3 ++- scripts/run-qwen3-4B_4xgpu.sh | 2 +- .../launch_scripts/test_shell_script_hygiene.py | 16 ++++++++++++++++ 19 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 tests/fast/launch_scripts/test_shell_script_hygiene.py diff --git a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh index 6054950125..fa484f0468 100644 --- a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh +++ b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh @@ -24,7 +24,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "/root/miles/scripts/models/qwen3-30B-A3B.sh" +source "${SCRIPT_DIR}/../../../scripts/models/qwen3-30B-A3B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-30B-A3B diff --git a/examples/experimental/strands_sglang/strands_qwen3_8b.sh b/examples/experimental/strands_sglang/strands_qwen3_8b.sh index 3f769475f8..9e4aa1f45e 100644 --- a/examples/experimental/strands_sglang/strands_qwen3_8b.sh +++ b/examples/experimental/strands_sglang/strands_qwen3_8b.sh @@ -26,7 +26,9 @@ else fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" -source "/root/miles/scripts/models/qwen3-8B.sh" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." &>/dev/null && pwd)" +source "${SCRIPT_DIR}/../../../scripts/models/qwen3-8B.sh" # Generate timestamp suffix for save path TIMESTAMP_SUFFIX=$(date +%Y%m%d_%H%M%S) @@ -137,7 +139,7 @@ ray start --head --node-ip-address ${MASTER_ADDR} --num-gpus 8 --disable-usage-s # Build the runtime environment JSON with proper variable substitution RUNTIME_ENV_JSON="{ \"env_vars\": { - \"PYTHONPATH\": \"/root/Megatron-LM/:${SCRIPT_DIR}:/root/miles\", + \"PYTHONPATH\": \"/root/Megatron-LM/:${SCRIPT_DIR}:${MILES_ROOT}\", \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\", \"NCCL_NVLS_ENABLE\": \"${HAS_NVLINK}\" } diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh index cba92a94e8..b6981ced2f 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh @@ -71,7 +71,7 @@ NUM_TRAIN_NODES=$((NUM_TRAIN_GPUS / GPUS_PER_NODE)) MODEL_NAME="GLM-4.5-Air" MODEL_TYPE="glm4.5-106B-A12B" -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" # Rotary base override diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh index b7f68bad2a..b2604b5c24 100644 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh @@ -79,7 +79,7 @@ MODEL_NAME="GLM-4.7-Flash" MODEL_TYPE="glm4.7-flash" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" # --------------------------------------------------------------------------- diff --git a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh index 39e0abdbff..0a279c28dc 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh @@ -115,7 +115,7 @@ esac NUM_TRAIN_NODES=$((NUM_TRAIN_GPUS / GPUS_PER_NODE)) -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" echo "" diff --git a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh index ac6259487d..8dc4e00853 100644 --- a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh @@ -84,7 +84,7 @@ MODEL_NAME="Kimi-K2-Instruct" MODEL_TYPE="kimi-k2" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh index d4da973d41..129d0abb99 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh @@ -80,7 +80,7 @@ MODEL_NAME="Qwen3-235B-A22B-Instruct-2507" MODEL_TYPE="qwen3-235B-A22B" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" export MODEL_ARGS_ROTARY_BASE=5000000 source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh index 1f4cbb2d54..e17a48445f 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh @@ -83,7 +83,7 @@ MODEL_NAME="Qwen3-30B-A3B" MODEL_TYPE="qwen3-30B-A3B" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -MILES_ROOT="/root/miles" +MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" # Rotary base override diff --git a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh index 2f2922a8dd..4a3f0aeda7 100644 --- a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh +++ b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh @@ -24,7 +24,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "/root/miles/scripts/models/qwen3-4B.sh" +source "${SCRIPT_DIR}/../../../scripts/models/qwen3-4B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B diff --git a/examples/lora/run-qwen3-4b-megatron-lora-result.sh b/examples/lora/run-qwen3-4b-megatron-lora-result.sh index 7d3ab820dd..0d76d807cb 100644 --- a/examples/lora/run-qwen3-4b-megatron-lora-result.sh +++ b/examples/lora/run-qwen3-4b-megatron-lora-result.sh @@ -33,7 +33,7 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" LR=2e-5 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source /root/miles/scripts/models/qwen3-4B.sh +source "${SCRIPT_DIR}/../../scripts/models/qwen3-4B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/convert_gb200.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/convert_gb200.sh index 8cd85d2e04..047f75e662 100644 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/convert_gb200.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/convert_gb200.sh @@ -9,7 +9,7 @@ set -ex HF_IN=${1:?hf checkpoint dir} SAVE_OUT=${2:?torch_dist save dir} -MILES_DIR=${MILES_DIR:-/workspace/miles} +MILES_DIR=${MILES_DIR:-"$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)"} MEGATRON_PATH=${MEGATRON_PATH:-/root/Megatron-LM} # Identical architecture spec to phase2_gb200.sh's MODEL_ARGS. diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh index 398222f42a..62739b9523 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh @@ -25,7 +25,7 @@ MODEL_DIR=${MODEL_DIR:-/cluster_public/miles_data/models} DATA_DIR=${DATA_DIR:-/node_public/maocheng-qwen35/data} OUTPUT_DIR=${OUTPUT_DIR:-/node_public/maocheng-qwen35/ckpt-teacher} EXAMPLE_DIR=${EXAMPLE_DIR:-$(cd "$(dirname "$0")" && pwd)} -MILES_DIR=${MILES_DIR:-/root/miles} +MILES_DIR=${MILES_DIR:-"$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)"} RAY_ADDRESS=${RAY_ADDRESS:-http://127.0.0.1:8265} mkdir -p "${OUTPUT_DIR}" @@ -97,7 +97,7 @@ RUNTIME_ENV_JSON="{\"env_vars\": {\"PYTHONPATH\": \"${MILES_DIR}:/root/Megatron- cd "${MILES_DIR}" ray job submit --address="${RAY_ADDRESS}" --submission-id qwen3.5-rlvr-teacher --no-wait \ --runtime-env-json="${RUNTIME_ENV_JSON}" \ - -- python3 ${MILES_DIR}/train.py \ + -- python3 "${MILES_DIR}/train.py" \ --actor-num-nodes 1 --actor-num-gpus-per-node 8 --num-gpus-per-node 8 --colocate \ ${MODEL_ARGS[@]} ${CKPT_ARGS[@]} ${ROLLOUT_ARGS[@]} ${OPTIMIZER_ARGS[@]} ${GRPO_ARGS[@]} \ ${WANDB_ARGS[@]} ${PERF_ARGS[@]} ${EVAL_ARGS[@]} ${SGLANG_ARGS[@]} ${MISC_ARGS[@]} ${RM_ARGS[@]} diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh index 96b725ce24..34af362f2e 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh @@ -39,7 +39,7 @@ DATA_DIR=${DATA_DIR:-/node_public/maocheng-qwen35/data} OUTPUT_DIR=${OUTPUT_DIR:-/node_public/maocheng-qwen35/ckpt-opd-${MODE}} TEACHER_LOAD=${TEACHER_LOAD:-/node_public/maocheng-qwen35/ckpt-teacher} # parent dir! EXAMPLE_DIR=${EXAMPLE_DIR:-$(cd "$(dirname "$0")" && pwd)} -MILES_DIR=${MILES_DIR:-/workspace/miles} +MILES_DIR=${MILES_DIR:-"$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)"} RAY_ADDRESS=${RAY_ADDRESS:-http://127.0.0.1:8265} OPD_KL_COEF=${OPD_KL_COEF:-0.2} mkdir -p "${OUTPUT_DIR}" @@ -131,7 +131,7 @@ RUNTIME_ENV_JSON="{\"env_vars\": {\"PYTHONPATH\": \"${MILES_DIR}:/root/Megatron- cd "${MILES_DIR}" ray job submit --address="${RAY_ADDRESS}" --submission-id qwen3.5-opd-${MODE} --no-wait \ --runtime-env-json="${RUNTIME_ENV_JSON}" \ - -- python3 ${MILES_DIR}/train.py \ + -- python3 "${MILES_DIR}/train.py" \ --actor-num-nodes ${ACTOR_NUM_NODES} --actor-num-gpus-per-node ${GPUS_PER_NODE} --num-gpus-per-node ${GPUS_PER_NODE} --colocate \ ${MODEL_ARGS[@]} ${CKPT_ARGS[@]} ${OPD_ARGS[@]} ${ROLLOUT_ARGS[@]} ${OPTIMIZER_ARGS[@]} ${GRPO_ARGS[@]} \ ${WANDB_ARGS[@]} ${PERF_ARGS[@]} ${EVAL_ARGS[@]} ${SGLANG_ARGS[@]} ${MISC_ARGS[@]} ${RM_ARGS[@]} diff --git a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh index 39975c9863..9b72b4bda9 100755 --- a/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh +++ b/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh @@ -33,7 +33,7 @@ DATA_DIR=${DATA_DIR:-/node_public/maocheng-qwen35/data} OUTPUT_DIR=${OUTPUT_DIR:-/node_public/maocheng-qwen35/ckpt-opd-${MODE}} TEACHER_LOAD=${TEACHER_LOAD:-/node_public/maocheng-qwen35/ckpt-teacher} # parent dir! EXAMPLE_DIR=${EXAMPLE_DIR:-$(cd "$(dirname "$0")" && pwd)} -MILES_DIR=${MILES_DIR:-/root/miles} +MILES_DIR=${MILES_DIR:-"$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)"} RAY_ADDRESS=${RAY_ADDRESS:-http://127.0.0.1:8265} OPD_KL_COEF=${OPD_KL_COEF:-0.2} mkdir -p "${OUTPUT_DIR}" @@ -112,7 +112,7 @@ RUNTIME_ENV_JSON="{\"env_vars\": {\"PYTHONPATH\": \"${MILES_DIR}:/root/Megatron- cd "${MILES_DIR}" ray job submit --address="${RAY_ADDRESS}" --submission-id qwen3.5-opd-${MODE} --no-wait \ --runtime-env-json="${RUNTIME_ENV_JSON}" \ - -- python3 ${MILES_DIR}/train.py \ + -- python3 "${MILES_DIR}/train.py" \ --actor-num-nodes 1 --actor-num-gpus-per-node 8 --num-gpus-per-node 8 --colocate \ ${MODEL_ARGS[@]} ${CKPT_ARGS[@]} ${OPD_ARGS[@]} ${ROLLOUT_ARGS[@]} ${OPTIMIZER_ARGS[@]} ${GRPO_ARGS[@]} \ ${WANDB_ARGS[@]} ${PERF_ARGS[@]} ${EVAL_ARGS[@]} ${SGLANG_ARGS[@]} ${MISC_ARGS[@]} ${RM_ARGS[@]} diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh index 263e7c0987..0e971aae26 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh @@ -21,7 +21,8 @@ else fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" -source "/root/miles/scripts/models/qwen3-8B.sh" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" CKPT_ARGS=( diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh index a719d143ea..fad2c0aade 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh @@ -96,7 +96,8 @@ else fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" -source "/root/miles/scripts/models/qwen3-8B.sh" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" CKPT_ARGS=( diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd.sh b/examples/on_policy_distillation/run-qwen3-8B-opd.sh index 71d11514e7..1389138133 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd.sh @@ -44,7 +44,8 @@ else fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" -source "/root/miles/scripts/models/qwen3-8B.sh" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" CKPT_ARGS=( diff --git a/scripts/run-qwen3-4B_4xgpu.sh b/scripts/run-qwen3-4B_4xgpu.sh index 96d9a42eaa..085266c7dd 100755 --- a/scripts/run-qwen3-4B_4xgpu.sh +++ b/scripts/run-qwen3-4B_4xgpu.sh @@ -26,7 +26,7 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "/root/miles/scripts/models/qwen3-4B.sh" +source "${SCRIPT_DIR}/models/qwen3-4B.sh" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B diff --git a/tests/fast/launch_scripts/test_shell_script_hygiene.py b/tests/fast/launch_scripts/test_shell_script_hygiene.py new file mode 100644 index 0000000000..d04d1a0e25 --- /dev/null +++ b/tests/fast/launch_scripts/test_shell_script_hygiene.py @@ -0,0 +1,16 @@ +from tests.fast.launch_scripts.sh_harness import REPO_ROOT + +_HARDCODED_CHECKOUTS = ("/root/miles", "/workspace/miles") + + +def test_no_shell_script_hardcodes_the_checkout_location(): + """A script that assumes one absolute checkout only runs inside one container image.""" + offenders = [ + path.relative_to(REPO_ROOT).as_posix() + for root in (REPO_ROOT / "scripts", REPO_ROOT / "examples") + for path in root.rglob("*.sh") + for text in [path.read_text(errors="replace")] + if any(hardcoded in text for hardcoded in _HARDCODED_CHECKOUTS) + ] + + assert offenders == [] From bc3e351b8096f1412861449cccf4ff8ba20261be Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 15:02:02 +0800 Subject: [PATCH 05/18] Snapshot the external commands of every shell launch script Squashed from: - Snapshot the external commands of every shell launch script - Apply isort and black to the shell launch script test - Intercept ps so the recordings do not read the host process list - Harden the harness against host state the rollout exposed - Share the snapshot compare-or-update step and stop running each script twice - Keep the generated snapshots under one obvious tests/snapshots tree - Group the launch script tests by subject - Name the shell launcher test after what it covers - Assert the recorded order for every script, including the concurrent ones - Regenerate the concurrent launcher's snapshot in its true command order --- pyproject.toml | 1 + tests/fast/launch_scripts/sh_harness.py | 57 +- .../launch_scripts/test_sh_launch_scripts.py | 102 ++ tests/snapshots/README.md | 18 + .../eval/scripts/run-qwen3-32B.sh.txt | 203 +++ .../eval/scripts/run-qwen3-4B.sh.txt | 199 +++ .../eval_multi_task/multi_task.sh.txt | 197 +++ .../run-qwen3-30B-A3B-multi-agent.sh.txt | 259 ++++ .../run-qwen2.5-0.5B-gsm8k.sh.txt | 191 +++ .../search-r1/run_qwen2.5_3B.sh.txt | 175 +++ .../strands_sglang/strands_qwen3_8b.sh.txt | 210 +++ .../tau-bench/run_qwen3_4B.sh.txt | 200 +++ .../run-qwen3-4b-fully_async.sh.txt | 187 +++ .../examples/geo3k_vlm/run_geo3k_vlm.sh.txt | 269 ++++ .../geo3k_vlm/run_geo3k_vlm_sft.sh.txt | 204 +++ .../run-kimi-k2-Thinking-int4.sh.txt | 250 ++++ .../run-moonlight-16B-A3B-int4.sh.txt | 299 +++++ .../run-qwen3-235B-A22B-int4.sh.txt | 252 ++++ .../run-qwen3-30B-A3B-int4.sh.txt | 260 ++++ .../run-qwen3-30b-a3b-fp8-two-nodes.sh.txt | 231 ++++ .../low_precision/run-qwen3-4b-fp8.sh.txt | 197 +++ .../run-glm4.5-air-8node-profile.sh.txt | 257 ++++ .../run-glm4.7-flash-2node-profile.sh.txt | 264 ++++ .../run-glm5-disagg-profile.sh.txt | 284 ++++ .../run-kimi-k2-64node-profile.sh.txt | 287 ++++ .../run-qwen3-235B-A22B-16node-profile.sh.txt | 251 ++++ .../run-qwen3-30B-A3B-4node-profile.sh.txt | 242 ++++ .../run-qwen3-4b-fsdp-mis.sh.txt | 164 +++ .../run-qwen3-4b-mis.sh.txt | 205 +++ .../sh/examples/lora/dev.sh.txt | 183 +++ .../run-gpt-oss-20B-megatron-moe-lora.sh.txt | 231 ++++ .../lora/run-kimi-k25-megatron-lora.sh.txt | 289 ++++ .../run-qwen2.5-0.5B-megatron-lora.sh.txt | 186 +++ ...atron-lora-disaggregated-multi-node.sh.txt | 223 ++++ ...n2.5-3B-megatron-lora-disaggregated.sh.txt | 185 +++ .../lora/run-qwen3-4B-megatron-lora.sh.txt | 217 +++ .../run-qwen3-4b-megatron-lora-result.sh.txt | 195 +++ .../phase1_rlvr_teacher.sh.txt | 208 +++ .../phase2_gb200.sh.txt | 217 +++ .../phase2_opd_selfdistill.sh.txt | 215 +++ .../run-qwen3-8B-opd-megatron.sh.txt | 189 +++ .../run-qwen3-8B-opd-multi-teacher.sh.txt | 266 ++++ .../run-qwen3-8B-opd.sh.txt | 227 ++++ .../sh/scripts/amd/run-qwen3-4B-amd.sh.txt | 192 +++ .../sh/scripts/run-deepseek-r1.sh.txt | 271 ++++ .../run-glm4-9B-4xgpu-radixtree.sh.txt | 204 +++ .../sh/scripts/run-glm4-9B.sh.txt | 204 +++ .../sh/scripts/run-glm4.5-355B-A32B.sh.txt | 261 ++++ .../sh/scripts/run-glm4.7-flash.sh.txt | 249 ++++ .../sh/scripts/run-gpt-oss-20b-bf16.sh.txt | 197 +++ .../sh/scripts/run-kimi-k2-Instruct.sh.txt | 259 ++++ .../sh/scripts/run-kimi-k2-Thinking.sh.txt | 257 ++++ .../sh/scripts/run-kimi-k25.sh.txt | 274 ++++ .../sh/scripts/run-mimo-7B-rl-eagle.sh.txt | 211 +++ .../sh/scripts/run-moonlight-16B-A3B.sh.txt | 299 +++++ .../run-nemotron-3-nano-30b-a3b.sh.txt | 216 +++ .../sh/scripts/run-nemotron-3-nano-4b.sh.txt | 180 +++ .../run-nemotron-3-super-120b-a12b.sh.txt | 1185 +++++++++++++++++ .../sh/scripts/run-qwen3-235B-A22B-sft.sh.txt | 199 +++ .../sh/scripts/run-qwen3-235B-A22B.sh.txt | 275 ++++ .../sh/scripts/run-qwen3-32B.sh.txt | 237 ++++ .../sh/scripts/run-qwen3-4B-base-sft.sh.txt | 167 +++ .../sh/scripts/run-qwen3-4B.sh.txt | 197 +++ .../sh/scripts/run-qwen3-4B_4xgpu.sh.txt | 200 +++ .../run-qwen3-next-80B-A3B-8gpus.sh.txt | 263 ++++ .../sh/scripts/run-qwen3-next-80B-A3B.sh.txt | 274 ++++ .../sh/scripts/run-qwen3.5-27B.sh.txt | 209 +++ .../sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt | 289 ++++ .../sh/scripts/run-qwen3.5-4B.sh.txt | 205 +++ .../sh/scripts/run-qwen3.5-9B.sh.txt | 206 +++ .../sh/scripts/run-qwen3.6-27B.sh.txt | 209 +++ 71 files changed, 16330 insertions(+), 5 deletions(-) create mode 100644 tests/fast/launch_scripts/test_sh_launch_scripts.py create mode 100644 tests/snapshots/README.md create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt create mode 100644 tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt diff --git a/pyproject.toml b/pyproject.toml index fe01b30790..dda21a631a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ testpaths = ["./tests"] # must be an explicit path to avoid importing another " # directories to ignore when discovering tests norecursedirs = [ "external", + "snapshots", "examples", "docs", "scripts", diff --git a/tests/fast/launch_scripts/sh_harness.py b/tests/fast/launch_scripts/sh_harness.py index 7bc3d14e81..11bf959fb5 100644 --- a/tests/fast/launch_scripts/sh_harness.py +++ b/tests/fast/launch_scripts/sh_harness.py @@ -2,6 +2,7 @@ import os import signal import subprocess +import sys import time from dataclasses import dataclass from pathlib import Path @@ -29,6 +30,7 @@ _SHIMMED_COMMANDS = ( "apt", "apt-get", + "awk", "curl", "date", "docker", @@ -41,21 +43,44 @@ "pip", "pip3", "pkill", + "ps", "python", "python3", "ray", "rm", "rsync", + "scp", "sleep", + "ssh", "torchrun", "wget", ) +_GPU_COUNT_LARGER_THAN_ANY_WAIT_LOOP_EXPECTS = "1000000" + +_FROZEN_RAY_DASHBOARD_PROCESS = "root 1 0.0 0.0 ray dashboard --node-ip-address=10.0.0.1 --dashboard-port=8265" + _SHIM_STDOUT = { - # large enough that "wait until this many GPUs joined the ray cluster" loops exit immediately - "python": "1000000", - "python3": "1000000", "date": "20260101_000000", + "ps": _FROZEN_RAY_DASHBOARD_PROCESS, +} + +_PYTHON_SHIM_BODY = """case "${1:-}" in +-c) + case "$2" in + *cluster_resources*) printf '%s\\n' 'REPLACE_GPU_COUNT' ;; + *import*) ;; + *) "$MILES_SH_HARNESS_REAL_PYTHON" "$@" ;; + esac + ;; +esac +""".replace( + "REPLACE_GPU_COUNT", _GPU_COUNT_LARGER_THAN_ANY_WAIT_LOOP_EXPECTS +) + +_SHIM_BODY = { + "python": _PYTHON_SHIM_BODY, + "python3": _PYTHON_SHIM_BODY, } _SHIM_TEMPLATE = """#!/bin/bash @@ -68,6 +93,13 @@ """ +def iter_launch_scripts() -> list[Path]: + roots = [REPO_ROOT / "scripts", REPO_ROOT / "examples"] + return sorted( + path for root in roots for path in root.rglob("*.sh") if "ray job submit" in path.read_text(errors="replace") + ) + + @dataclass(frozen=True) class LaunchScriptRun: invocations: list[list[str]] @@ -87,6 +119,7 @@ def ray_job_submit_argv(self) -> list[str]: def run_launch_script( script: Path, sandbox: Path, + args: tuple[str, ...] = (), extra_env: dict[str, str] | None = None, timeout: float = 120.0, ) -> LaunchScriptRun: @@ -104,12 +137,13 @@ def run_launch_script( "MILES_SH_HARNESS_CAPTURE": str(capture), "MILES_SH_HARNESS_ARG_SEP": _ARG_SEPARATOR, "MILES_SH_HARNESS_RECORD_SEP": _RECORD_SEPARATOR, + "MILES_SH_HARNESS_REAL_PYTHON": sys.executable, } _reject_unfreezing(extra_env or {}, frozen=frozen) deadline = time.monotonic() + timeout process = subprocess.Popen( - ["bash", str(script)], + ["bash", str(script), *args], cwd=workdir, env={**frozen, **(extra_env or {})}, stdout=subprocess.PIPE, @@ -135,6 +169,19 @@ def run_launch_script( ) +SNAPSHOT_UPDATE_ENV_VAR = "MILES_UPDATE_LAUNCH_SCRIPT_SNAPSHOTS" + + +def assert_matches_snapshot(snapshot: Path, actual: str, subject: str) -> None: + if os.environ.get(SNAPSHOT_UPDATE_ENV_VAR): + snapshot.parent.mkdir(parents=True, exist_ok=True) + snapshot.write_text(actual) + return + + assert snapshot.exists(), f"missing snapshot for {subject}; regenerate with {SNAPSHOT_UPDATE_ENV_VAR}=1" + assert actual == snapshot.read_text() + + def format_invocations(invocations: list[list[str]]) -> str: lines = [] for index, argv in enumerate(invocations): @@ -186,7 +233,7 @@ def _write_shims(fake_bin: Path) -> None: stdout = _SHIM_STDOUT.get(name) stdout_statement = "" if stdout is None else f"printf '%s\\n' {stdout!a}\n" shim = fake_bin / name - shim.write_text(_SHIM_TEMPLATE.format(name=name, stdout_statement=stdout_statement)) + shim.write_text(_SHIM_TEMPLATE.format(name=name, stdout_statement=stdout_statement + _SHIM_BODY.get(name, ""))) shim.chmod(0o755) diff --git a/tests/fast/launch_scripts/test_sh_launch_scripts.py b/tests/fast/launch_scripts/test_sh_launch_scripts.py new file mode 100644 index 0000000000..d354ef5f28 --- /dev/null +++ b/tests/fast/launch_scripts/test_sh_launch_scripts.py @@ -0,0 +1,102 @@ +from dataclasses import dataclass, field + +import pytest +from tests.fast.launch_scripts.sh_harness import ( + REPO_ROOT, + assert_matches_snapshot, + format_invocations, + iter_launch_scripts, + run_launch_script, +) + +_SNAPSHOT_DIR = REPO_ROOT / "tests" / "snapshots" / "launch_scripts" / "sh" + + +@dataclass(frozen=True) +class LaunchScriptCase: + args: tuple[str, ...] = () + env: dict[str, str] = field(default_factory=dict) + + +_CHECKPOINT_DIR = "/frozen/checkpoints" +_HEAD_NODE_IP = "10.0.0.1" + +_SCRIPTS_REFUSING_TO_RUN_WITHOUT_EXPLICIT_INPUTS: dict[str, LaunchScriptCase] = { + "examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh": LaunchScriptCase(args=("p2p", "0")), + "examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh": LaunchScriptCase( + env={"OUTPUT_DIR": "{workdir}"} + ), + "examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh": LaunchScriptCase( + env={"OUTPUT_DIR": "{workdir}"} + ), + "examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh": LaunchScriptCase( + env={"OUTPUT_DIR": "{workdir}"} + ), + "examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh": LaunchScriptCase( + args=("p2p", "0", _HEAD_NODE_IP), env={"MILES_LOG_DIR": "{workdir}"} + ), + "examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh": LaunchScriptCase( + args=("p2p", "0", _HEAD_NODE_IP) + ), + "examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh": LaunchScriptCase( + args=("GLM-5", "p2p", "0", _HEAD_NODE_IP), env={"MILES_LOG_DIR": "{workdir}"} + ), + "examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh": LaunchScriptCase( + args=("p2p", "0", _HEAD_NODE_IP) + ), + "examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh": LaunchScriptCase( + args=("p2p", "0", _HEAD_NODE_IP) + ), + "examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh": LaunchScriptCase( + args=("p2p", "0", _HEAD_NODE_IP) + ), + "scripts/run-nemotron-3-super-120b-a12b.sh": LaunchScriptCase(args=("head", _HEAD_NODE_IP)), + "scripts/run-qwen3-235B-A22B-sft.sh": LaunchScriptCase(env={"BASE_FOLDER": _CHECKPOINT_DIR}), + "scripts/run-qwen3-235B-A22B.sh": LaunchScriptCase(env={"BASE_FOLDER": _CHECKPOINT_DIR}), + "scripts/run-qwen3-next-80B-A3B-8gpus.sh": LaunchScriptCase(env={"BASE_FOLDER": _CHECKPOINT_DIR}), + "scripts/run-qwen3-next-80B-A3B.sh": LaunchScriptCase(env={"BASE_FOLDER": _CHECKPOINT_DIR}), + "scripts/run-qwen3.6-27B.sh": LaunchScriptCase(env={"OUTPUT_DIR": _CHECKPOINT_DIR}), +} + +_SCRIPTS = [script.relative_to(REPO_ROOT).as_posix() for script in iter_launch_scripts()] + + +@pytest.fixture(params=_SCRIPTS, scope="module") +def recorded(request, tmp_path_factory): + rel = request.param + case = _SCRIPTS_REFUSING_TO_RUN_WITHOUT_EXPLICIT_INPUTS.get(rel, LaunchScriptCase()) + tmp_path = tmp_path_factory.mktemp("launch_script") + workdir = tmp_path / "workdir" + run = run_launch_script( + REPO_ROOT / rel, + sandbox=tmp_path, + args=case.args, + extra_env={key: value.format(workdir=workdir) for key, value in case.env.items()}, + ) + return rel, run + + +class TestEveryLaunchScript: + def test_invocations_match_snapshot(self, recorded): + """Every launch script must issue exactly the recorded sequence of external commands.""" + rel, run = recorded + snapshot = _SNAPSHOT_DIR / f"{rel}.txt" + actual = f"# returncode: {run.returncode}\n\n{format_invocations(run.invocations)}" + + assert_matches_snapshot(snapshot, actual, rel) + + def test_submits_exactly_one_ray_job(self, recorded): + """A launch script that no longer reaches `ray job submit` is broken, whatever else it does.""" + _, run = recorded + assert run.returncode == 0 + assert len(run.ray_job_submit_argv()) > 10 + + +class TestDiscovery: + def test_every_discovered_script_has_a_snapshot_and_vice_versa(self): + """A script that stops matching the discovery filter would otherwise vanish silently.""" + discovered = {f"{rel}.txt" for rel in _SCRIPTS} + recorded = {path.relative_to(_SNAPSHOT_DIR).as_posix() for path in _SNAPSHOT_DIR.rglob("*.txt")} + + assert discovered == recorded + assert len(discovered) > 60 diff --git a/tests/snapshots/README.md b/tests/snapshots/README.md new file mode 100644 index 0000000000..3e181c7373 --- /dev/null +++ b/tests/snapshots/README.md @@ -0,0 +1,18 @@ +# Snapshots + +Expected results for the repository's snapshot tests. Everything here is +generated: never edit a file by hand, regenerate it and review the diff. + +| Directory | Produced by | Contains | +| --- | --- | --- | +| `launch_scripts/sh/` | `tests/fast/launch_scripts/test_sh_launch_scripts.py` | every external command each `scripts/**.sh` and `examples/**.sh` launcher issues, including the full `ray job submit` argv | + +Regenerate after an intentional change: + +```bash +MILES_UPDATE_LAUNCH_SCRIPT_SNAPSHOTS=1 pytest tests/fast/launch_scripts +``` + +The recordings are reproducible on any machine: the launchers run under a +shimmed PATH with a frozen environment, and absolute paths are replaced by +`` / `` placeholders. diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt new file mode 100644 index 0000000000..4ce3827918 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt @@ -0,0 +1,203 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"25600" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/shared/Qwen3-32B" +"--ref-load" +"/root/shared/Qwen3-32B_torch_dist" +"--load" +"/root/shared/Qwen3-32B_miles/" +"--save" +"/root/shared/Qwen3-32B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--use-wandb" +"--wandb-project" +"miles-eval" +"--wandb-group" +"qwen3-32b-eval" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"5" +"--eval-config" +"/examples/experimental/eval/scripts/multi_tasks.yaml" +"--eval-function-path" +"examples.experimental.eval.eval_delegate_rollout.generate_rollout" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt new file mode 100644 index 0000000000..24bd9216b6 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt @@ -0,0 +1,199 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"2" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"2" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"miles-eval" +"--wandb-group" +"qwen3-4b-eval" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"5" +"--eval-config" +"/examples/experimental/eval/scripts/multi_tasks.yaml" +"--eval-function-path" +"examples.experimental.eval.eval_delegate_rollout.generate_rollout" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt new file mode 100644 index 0000000000..7217c79d1f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt @@ -0,0 +1,197 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"/train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"eval" +"--wandb-group" +"multi_task" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-config" +"/examples/experimental/eval_multi_task/multi_task.yaml" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt new file mode 100644 index 0000000000..797fee6c21 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt @@ -0,0 +1,259 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/Qwen3-30B-A3B" +"--ref-load" +"/root/Qwen3-30B-A3B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--custom-generate-function-path" +"examples.experimental.multi_agent.rollout_with_multi_agents.generate_with_multi_agents" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-context-len" +"16384" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"20480" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt new file mode 100644 index 0000000000..132b497801 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt @@ -0,0 +1,191 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--calculate-per-token-loss" +"--swiglu" +"--num-layers" +"24" +"--hidden-size" +"896" +"--ffn-hidden-size" +"4864" +"--num-attention-heads" +"14" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-0.5B-Instruct/" +"--ref-load" +"/root/Qwen2.5-0.5B-Instruct_torch_dist/" +"--prompt-data" +"/root/gsm8k/train.parquet" +"--input-key" +"messages" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-team" +"glm-zero" +"--wandb-project" +"miles-dev" +"--wandb-group" +"qwen2.5-0.5B-gsm8k-deterministic" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-deterministic-inference" +"--sglang-attention-backend" +"flashinfer" +"--deterministic-mode" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt new file mode 100644 index 0000000000..abbfec1eca --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt @@ -0,0 +1,175 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/:/examples/experimental/search-r1\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--rollout-num-gpus" +"4" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"16" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-3B/" +"--ref-load" +"/root/Qwen2.5-3B_torch_dist/" +"--prompt-data" +"/root/Search-R1/data/nq_hotpotqa_train/train.parquet" +"--input-key" +"prompt" +"--label-key" +"reward_model" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"512" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.01" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.001" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-generate-function-path" +"generate_with_search.generate" +"--custom-rm-path" +"generate_with_search.reward_func" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt new file mode 100644 index 0000000000..b7344a73b1 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt @@ -0,0 +1,210 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"date" +"+%Y%m%d_%H%M%S" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/:/examples/experimental/strands_sglang:/examples\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/models/Qwen/Qwen3-8B" +"--ref-load" +"/root/models/Qwen/Qwen3-8B_torch_dist" +"--save" +"/root/models/Qwen/Qwen3-8B_strands_dapo_20260101_000000" +"--save-interval" +"20" +"--rotary-base" +"1000000" +"--prompt-data" +"/root/data/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--rollout-shuffle" +"--num-rollout" +"3000" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"128" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"strands-miles" +"--wandb-group" +"Qwen3-8B-strands-dapo" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"18432" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/data/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.4" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-generate-function-path" +"examples.experimental.strands_sglang.generate_with_strands.generate" +"--custom-rm-path" +"examples.experimental.strands_sglang.generate_with_strands.reward_func" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt new file mode 100644 index 0000000000..d0fb68d3d7 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt @@ -0,0 +1,200 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"2" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" +"--temp-dir" +"/root/shared/ray_temp" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/:/examples/experimental/tau-bench\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"TAU_USER_MODEL_PROVIDER\": \"gemini\",\n \"TAU_USER_MODEL\": \"gemini-2.5-flash-lite\",\n \"GEMINI_API_KEY\": \"\",\n \"DEEPSEEK_API_KEY\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"2" +"--rollout-num-gpus" +"2" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"5000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B-Instruct-2507/" +"--ref-load" +"/root/Qwen3-4B-Instruct-2507_torch_dist/" +"--load" +"/root/Qwen3-4B-Instruct-2507_miles/" +"--save" +"/root/Qwen3-4B-Instruct-2507_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/tau-bench/retail_train_tasks.jsonl" +"--input-key" +"index" +"--rollout-shuffle" +"--num-rollout" +"500" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"5" +"--eval-prompt-data" +"retail-dev" +"/root/tau-bench/retail_dev_tasks.jsonl" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-generate-function-path" +"generate_with_tau.generate" diff --git a/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt b/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt new file mode 100644 index 0000000000..4e35206c44 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt @@ -0,0 +1,187 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"MILES_EXPERIMENTAL_ROLLOUT_REFACTOR\": \"1\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train_async.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--rollout-num-gpus" +"4" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--fully-async" +"--prompt-data" +"/path/to/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"dapo" +"--reward-key" +"score" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--rollout-num-gpus-per-engine" +"1" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt new file mode 100644 index 0000000000..e00be71454 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt @@ -0,0 +1,269 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"miles" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"miles" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"mkdir" +"-p" +"/root/models" +"/root/datasets" + +### 11 +"hf" +"download" +"Qwen/Qwen3-VL-8B-Instruct" +"--local-dir" +"/root/models/Qwen3-VL-8B-Instruct" + +### 12 +"hf" +"download" +"--repo-type" +"dataset" +"chenhegu/geo3k_imgurl" +"--local-dir" +"/root/datasets/geo3k_imgurl" + +### 13 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 14 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--multimodal-keys" +"{\"image\": \"images\"}" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"5000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/models/Qwen3-VL-8B-Instruct" +"--prompt-data" +"/root/datasets/geo3k_imgurl/train.parquet" +"--input-key" +"problem" +"--label-key" +"answer" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--custom-generate-function-path" +"examples.geo3k_vlm.rollout.generate" +"--num-rollout" +"3000" +"--rollout-batch-size" +"64" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"512" +"--eval-interval" +"20" +"--eval-prompt-data" +"geo3k_imgurl" +"/root/datasets/geo3k_imgurl/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"4096" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.6" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--use-wandb" +"--wandb-project" +"miles-geo3k-vlm" +"--wandb-group" +"qwen3-vl-8b-instruct-megatron" +"--wandb-key" +"frozen-wandb-api-key" +"--disable-wandb-random-suffix" +"--train-backend" +"megatron" +"--load" +"/root/models/Qwen3-VL-8B-Instruct" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--megatron-to-hf-mode" +"bridge" +"--colocate" diff --git a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt new file mode 100644 index 0000000000..a2355b5e92 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt @@ -0,0 +1,204 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"miles" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"miles" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"mkdir" +"-p" +"/root/models" +"/root/datasets" + +### 11 +"hf" +"download" +"Qwen/Qwen3-VL-8B-Instruct" +"--local-dir" +"/root/models/Qwen3-VL-8B-Instruct" + +### 12 +"hf" +"download" +"--repo-type" +"dataset" +"chenhegu/geo3k_imgurl" +"--local-dir" +"/root/datasets/geo3k_imgurl" + +### 13 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 14 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train_async.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--multimodal-keys" +"{\"image\": \"images\"}" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"5000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/models/Qwen3-VL-8B-Instruct" +"--load" +"/root/models/Qwen3-VL-8B-Instruct" +"--rollout-function-path" +"miles.rollout.sft_rollout.generate_rollout" +"--prompt-data" +"/root/datasets/geo3k_imgurl/train_formatted.parquet" +"--input-key" +"messages" +"--apply-chat-template" +"--rollout-shuffle" +"--num-epoch" +"3000" +"--rollout-batch-size" +"128" +"--global-batch-size" +"128" +"--loss-type" +"sft_loss" +"--calculate-per-token-loss" +"--disable-compute-advantages-and-returns" +"--debug-train-only" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"cosine" +"--min-lr" +"1e-6" +"--lr-warmup-fraction" +"0.1" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.95" +"--use-wandb" +"--wandb-project" +"miles-geo3k-vlm-sft" +"--wandb-group" +"qwen3-vl-8b-instruct-megatron" +"--wandb-key" +"frozen-wandb-api-key" +"--disable-wandb-random-suffix" +"--train-backend" +"megatron" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--megatron-to-hf-mode" +"bridge" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt new file mode 100644 index 0000000000..c32efbf09f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt @@ -0,0 +1,250 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NCCL_TIMEOUT_MS\":\"360000000\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"32\"\n }\n}" +"--" +"python3" +"/personal/miles/miles/train.py" +"--actor-num-nodes" +"32" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--update-weight-buffer-size" +"2147483648" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/root/Kimi-K2-Thinking/" +"--ref-load" +"/root/Kimi-K2_thinking_torch_dist/" +"--load" +"/root/Kimi-K2-thinking_miles/" +"--save" +"/root/Kimi-K2-thinking_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"0.8" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"5" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"10" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-server-concurrency" +"1024" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--no-check-for-nan-in-loss-and-grad" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt new file mode 100644 index 0000000000..3c647619e0 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt @@ -0,0 +1,299 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"128\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--colocate" +"--disable-bias-linear" +"--num-layers" +"27" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11264" +"--num-attention-heads" +"16" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--no-masked-softmax-fusion" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"1" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"64" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"1408" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2816" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.446" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/root/Moonlight-16B-A3B-Instruct-INT4" +"--ref-load" +"/root/Moonlight-16B-A3B-Instruct-INT4_torch_dist" +"--load" +"/root/Moonlight-16B-A3B_miles/" +"--save" +"/root/Moonlight-16B-A3B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"3000" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"0.8" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"4" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"4096" +"--eval-top-p" +"0.7" +"--rollout-num-gpus-per-engine" +"4" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--moe-enable-deepep" +"--moe-token-dispatcher-type" +"flex" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt new file mode 100644 index 0000000000..c5f34c7d39 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt @@ -0,0 +1,252 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NCCL_TIMEOUT_MS\":\"360000000\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"128\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"8" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"94" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/Qwen3-235B-A22B-INT4/" +"--ref-load" +"/root/Qwen3-235B-A22B_torch_dist/" +"--load" +"/root/Qwen3-235B-A22B-miles/" +"--save" +"/root/Qwen3-235B-A22B-miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"300" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"16" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"22" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"10" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--no-check-for-nan-in-loss-and-grad" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt new file mode 100644 index 0000000000..d0b9841772 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt @@ -0,0 +1,260 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"128\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/Qwen3-30B-A3B-INT4/" +"--ref-load" +"/root/Qwen3-30B-A3B_torch_dist/" +"--load" +"/root/Qwen3-30B-A3B_miles/" +"--save" +"/root/Qwen3-30B-A3B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"100" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"10" +"--eval-prompt-data" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt new file mode 100644 index 0000000000..a89c5e24a6 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt @@ -0,0 +1,231 @@ +# returncode: 0 + +### 0 +"nvidia-smi" +"topo" +"-m" + +### 1 +"ps" +"aux" + +### 2 +"ps" +"aux" + +### 3 +"ray" +"job" +"submit" +"--address=http://10.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NVTE_FP8_BLOCK_SCALING_FP32_SCALES\": \"1\",\n \"NCCL_TIMEOUT_MS\":\"36000000\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"2" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/Qwen3-30B-A3B-FP8/" +"--ref-load" +"/root/Qwen3-30B-A3B_torch_dist/" +"--load" +"/root/Qwen3-30B-A3B_miles/" +"--save" +"/root/Qwen3-30B-A3B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"200" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"128" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"4" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"20480" +"--moe-enable-deepep" +"--moe-token-dispatcher-type" +"flex" +"--transformer-impl" +"transformer_engine" +"--bf16" +"--fp8-format" +"e4m3" +"--fp8-recipe" +"blockwise" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.6" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--sglang-expert-parallel-size" +"8" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt new file mode 100644 index 0000000000..3580be18de --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt @@ -0,0 +1,197 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/:/examples/infra_features/low_precision\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NVTE_FP8_BLOCK_SCALING_FP32_SCALES\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B-FP8" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/qwen3-4b_cp8_fp8" +"--save" +"/root/rl-model/qwen3-4b_cp8_fp8" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/data/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt new file mode 100644 index 0000000000..433a99f452 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt @@ -0,0 +1,257 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"python3" +"-c" +"print(int(1.0 * 1024 * 1024 * 1024))" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 12 +"mkdir" +"-p" +"/workdir" + +### 13 +"rm" +"-f" +"/workdir/job_done_p2p" + +### 14 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"300\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"MODEL_ARGS_ROTARY_BASE\": \"1000000\",\n \"MILES_LOG_DIR\": \"/workdir\"\n }\n}" +"--" +"python3" +"train.py" +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"96" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"46" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"10944" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--rotary-percent" +"0.5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151552" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1408" +"--moe-shared-expert-intermediate-size" +"1408" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[0]*1+[1]*45" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/models/GLM-4.5-Air" +"--ref-load" +"/root/GLM-4.5-Air_torch_dist" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"4" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"16" +"--balance-data" +"--eval-prompt-data" +"aime" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"1" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"10" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"2048" +"--rollout-num-gpus-per-engine" +"8" +"--rollout-num-gpus" +"32" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"8" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"--sglang-enable-dp-attention" +"--sglang-enable-dp-lm-head" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--sglang-model-loader-extra-config" +"{\"enable_multithread_load\":true,\"num_threads\":8}" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--actor-num-nodes" +"4" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"1073741824" +"--check-weight-update-equal" +"--update-weight-transfer-mode" +"p2p" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt new file mode 100644 index 0000000000..2fcae95126 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt @@ -0,0 +1,264 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 12 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"300\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"MILES_LOG_DIR\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--moe-layer-freq" +"[0]*1+[1]*46" +"--num-experts" +"64" +"--moe-shared-expert-intermediate-size" +"1536" +"--moe-router-topk" +"4" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"1.8" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"64" +"--num-layers" +"47" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"10240" +"--num-attention-heads" +"20" +"--disable-bias-linear" +"--add-qkv-bias" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"768" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--no-rope-fusion" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/root/models/GLM-4.7-Flash/" +"--ref-load" +"/root/multinode/GLM-4.7-Flash_torch_dist/" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"4" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"1.0" +"--global-batch-size" +"16" +"--balance-data" +"--eval-prompt-data" +"aime24" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-temperature" +"0.6" +"--eval-top-p" +"0.95" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"2048" +"--rollout-num-gpus-per-engine" +"4" +"--rollout-num-gpus" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"4" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"--sglang-enable-dp-attention" +"--sglang-enable-dp-lm-head" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"1073741824" +"--update-weight-transfer-mode" +"p2p" +"--check-weight-update-equal" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt new file mode 100644 index 0000000000..03d6e0dd41 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt @@ -0,0 +1,284 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +"mkdir" +"-p" +"/workdir" + +### 12 +"rm" +"-f" +"/workdir/job_done_p2p" + +### 13 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"600\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"1\",\n \"INDEXER_ROPE_NEOX_STYLE\": \"0\",\n \"NVSHMEM_DISABLE_NCCL\": \"1\",\n \"MILES_LOG_DIR\": \"/workdir\"\n }\n}" +"--" +"python3" +"train.py" +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*75" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"78" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" +"--hf-checkpoint" +"/root/models/GLM-5" +"--ref-load" +"/root/GLM-5_torch_dist" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"4" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"1" +"--global-batch-size" +"16" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"16" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"8" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"256" +"--data-pad-size-multiplier" +"4096" +"--log-probs-chunk-size" +"1024" +"--rollout-num-gpus-per-engine" +"64" +"--rollout-num-gpus" +"128" +"--sglang-mem-fraction-static" +"0.90" +"--sglang-enable-dp-attention" +"--sglang-ep-size" +"64" +"--sglang-dp-size" +"64" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-enable-dp-lm-head" +"--sglang-page-size" +"64" +"--sglang-nsa-decode-backend" +"flashmla_sparse" +"--sglang-nsa-prefill-backend" +"flashmla_sparse" +"--sglang-attention-backend" +"nsa" +"--sglang-cuda-graph-max-bs" +"8" +"--sglang-max-running-requests" +"512" +"--sglang-chunked-prefill-size" +"131072" +"--sglang-watchdog-timeout" +"3600" +"--sglang-disable-cuda-graph" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--sglang-remote-instance-weight-loader-ib-device" +"{\"0\":\"ibp0\",\"1\":\"ibp1\",\"2\":\"ibp2\",\"3\":\"ibp3\",\"4\":\"ibp4\",\"5\":\"ibp5\",\"6\":\"ibp6\",\"7\":\"ibp7\"}" +"--sglang-model-loader-extra-config" +"{\"enable_multithread_load\":true,\"num_threads\":8}" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--allgather-cp" +"--moe-token-dispatcher-type" +"alltoall" +"--actor-num-nodes" +"16" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"2147483648" +"--check-weight-update-equal" +"--update-weight-transfer-mode" +"p2p" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt new file mode 100644 index 0000000000..b53d6ae242 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt @@ -0,0 +1,287 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 12 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"300\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"1\",\n \"MILES_LOG_DIR\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"32.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/root/models/Kimi-K2-Instruct/" +"--ref-load" +"/root/multinode/Kimi-K2-Instruct_torch_dist/" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"8" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--balance-data" +"--eval-prompt-data" +"aime" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--decoder-last-pipeline-num-layers" +"5" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--rollout-num-gpus-per-engine" +"32" +"--rollout-num-gpus" +"256" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"32" +"--sglang-dp-size" +"8" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-enable-dp-attention" +"--sglang-enable-dp-lm-head" +"--sglang-server-concurrency" +"1024" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"--sglang-moe-runner-backend" +"triton" +"--sglang-fp8-gemm-backend" +"triton" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--sglang-remote-instance-weight-loader-ib-device" +"{\"0\":\"ibp0\",\"1\":\"ibp1\",\"2\":\"ibp2\",\"3\":\"ibp3\",\"4\":\"ibp4\",\"5\":\"ibp5\",\"6\":\"ibp6\",\"7\":\"ibp7\"}" +"--sglang-model-loader-extra-config" +"{\"enable_multithread_load\":true,\"num_threads\":8}" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-token-dispatcher-type" +"alltoall" +"--actor-num-nodes" +"32" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"2147483648" +"--check-weight-update-equal" +"--update-weight-transfer-mode" +"p2p" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt new file mode 100644 index 0000000000..6576a46dad --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt @@ -0,0 +1,251 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"python3" +"-c" +"print(int(1.0 * 1024 * 1024 * 1024))" + +### 11 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 12 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 13 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"300\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"1\",\n \"MILES_LOG_DIR\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"94" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"5000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/models/Qwen3-235B-A22B-Instruct-2507/" +"--ref-load" +"/root/multinode/Qwen3-235B-A22B-Instruct-2507_torch_dist/" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"8" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"64" +"--balance-data" +"--eval-prompt-data" +"aime" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"16" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"22" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--rollout-num-gpus-per-engine" +"32" +"--rollout-num-gpus" +"64" +"--sglang-mem-fraction-static" +"0.75" +"--sglang-ep-size" +"32" +"--sglang-dp-size" +"1" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"--sglang-enable-dp-attention" +"--sglang-enable-dp-lm-head" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--sglang-model-loader-extra-config" +"{\"enable_multithread_load\":true,\"num_threads\":8}" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--actor-num-nodes" +"8" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"1073741824" +"--check-weight-update-equal" +"--update-weight-transfer-mode" +"p2p" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt new file mode 100644 index 0000000000..d04fe971f3 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt @@ -0,0 +1,242 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 12 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"MC_TRANSFER_TIMEOUT\": \"300\",\n \"RAY_DEBUG\": \"1\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"1\",\n \"MILES_LOG_DIR\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/root/models/Qwen3-30B-A3B/" +"--ref-load" +"/root/multinode/Qwen3-30B-A3B_torch_dist/" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"13" +"--rollout-batch-size" +"4" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"100" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"16" +"--balance-data" +"--eval-prompt-data" +"aime" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"2048" +"--rollout-num-gpus-per-engine" +"8" +"--rollout-num-gpus" +"16" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"8" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"--sglang-enable-dp-attention" +"--sglang-enable-dp-lm-head" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--sglang-model-loader-extra-config" +"{\"enable_multithread_load\":true,\"num_threads\":8}" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--actor-num-nodes" +"2" +"--actor-num-gpus-per-node" +"8" +"--update-weight-buffer-size" +"1073741824" +"--check-weight-update-equal" +"--update-weight-transfer-mode" +"p2p" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh.txt new file mode 100644 index 0000000000..5dbdf0c31a --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-fsdp-mis.sh.txt @@ -0,0 +1,164 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"date" +"+%Y%m%d_%H%M%S" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/:/examples/infra_features/train_infer_mismatch_helper\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--load" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--balance-data" +"--rm-type" +"deepscaler" +"--num-rollout" +"100" +"--rollout-batch-size" +"8" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"64" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--use-kl-loss" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-dev-mcore-fsdp" +"--wandb-group" +"qwen3-4B-fsdp-1130-ref" +"--wandb-key" +"frozen-wandb-api-key" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.75" +"--sglang-decode-log-interval" +"1000" +"--sglang-chunked-prefill-size" +"4096" +"--sglang-attention-backend" +"fa3" +"--train-backend" +"fsdp" +"--update-weight-buffer-size" +"536870912" +"--gradient-checkpointing" +"--attn-implementation" +"flash_attention_3" +"--train-env-vars" +"{\"PYTORCH_CUDA_ALLOC_CONF\":\"expandable_segments:True\"}" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--use-fault-tolerance" +"--dump-details" +"/root/shared_data/qwen3-4B-fsdp-1116-noref/dump_details" +"--custom-config-path" +"examples/infra_features/train_infer_mismatch_helper/mis.yaml" +"--custom-tis-function-path" +"examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_fsdp" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt new file mode 100644 index 0000000000..5d0cf0562d --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt @@ -0,0 +1,205 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"200" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-mis" +"--wandb-group" +"qwen3-4B-mis" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-config-path" +"examples/infra_features/train_infer_mismatch_helper/mis.yaml" +"--custom-tis-function-path" +"examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt new file mode 100644 index 0000000000..dda91e58a8 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt @@ -0,0 +1,183 @@ +# returncode: 0 + +### 0 +"pkill" +"sglang" + +### 1 +"ray" +"stop" +"--force" + +### 2 +"sleep" +"5" + +### 3 +"pkill" +"-9" +"sglang" + +### 4 +"pkill" +"-9" +"ray" + +### 5 +"pkill" +"-9" +"python" + +### 6 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"1" +"--disable-usage-stats" + +### 7 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"1" +"--colocate" +"--calculate-per-token-loss" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"16" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-3B-Instruct/" +"--megatron-to-hf-mode" +"bridge" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--megatron-to-hf-mode" +"bridge" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--wandb-host" +"https://wandb.ai/" +"--wandb-project" +"miles-lora-update-weight-refactory" +"--wandb-group" +"qwen2.5-3B-lora-benchmark" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"10" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--prompt-data" +"/root/gsm8k/train.parquet" +"--input-key" +"messages" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"5" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"32" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt new file mode 100644 index 0000000000..a1025b6d46 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt @@ -0,0 +1,231 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--colocate" +"--num-layers" +"24" +"--hidden-size" +"2880" +"--ffn-hidden-size" +"2880" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--kv-channels" +"64" +"--use-rotary-position-embeddings" +"--rotary-percent" +"1.0" +"--rotary-base" +"150000" +"--max-position-embeddings" +"131072" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"201088" +"--softmax-type" +"learnable" +"--window-size" +"128,0" +"--window-attn-skip-freq" +"2" +"--no-masked-softmax-fusion" +"--no-rope-fusion" +"--num-experts" +"32" +"--moe-router-topk" +"4" +"--moe-aux-loss-coeff" +"0.0" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-dtype" +"fp32" +"--moe-grouped-gemm" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"gate_proj,up_proj,down_proj" +"--sglang-lora-backend" +"triton" +"--hf-checkpoint" +"/root/models/gpt-oss-20b" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"1" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"1.0" +"--global-batch-size" +"8" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"miles-gpt-oss" +"--wandb-group" +"gpt-oss-20b-moe-lora" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--micro-batch-size" +"1" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"10" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--eval-input-key" +"messages" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"4096" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"4" +"--sglang-dtype" +"bfloat16" +"--sglang-decode-log-interval" +"1000" +"--sglang-mem-fraction-static" +"0.2" +"--sglang-moe-runner-backend" +"triton" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--qkv-format" +"bshd" +"--attention-backend" +"fused" +"--update-weight-buffer-size" +"536870912" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt new file mode 100644 index 0000000000..48d1e0ee36 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt @@ -0,0 +1,289 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NCCL_TIMEOUT\": \"3600\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"32\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"16" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--update-weight-buffer-size" +"2147483648" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/Kimi-K2.5-int4" +"--ref-load" +"/Kimi-K2.5-bf16" +"--megatron-to-hf-mode" +"bridge" +"--model-name" +"kimi_k25" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"q_a_proj,kv_a_proj_with_mqa,o_proj,gate_proj,up_proj,down_proj" +"--experts-shared-outer-loras" +"--lora-base-cpu-backup" +"--no-gradient-accumulation-fusion" +"--sglang-lora-backend" +"triton" +"--sglang-lora-use-virtual-experts" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--balance-data" +"--rm-type" +"deepscaler" +"--num-rollout" +"20" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--filter-zero-reward-samples" +"--use-dynamic-global-batch-size" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--use-distributed-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-kimi-k25" +"--wandb-group" +"kimi-k25-lora" +"--disable-wandb-random-suffix" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"2" +"--context-parallel-size" +"8" +"--expert-model-parallel-size" +"64" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"30" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-server-concurrency" +"1024" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"--use-rollout-routing-replay" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--no-check-for-nan-in-loss-and-grad" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt new file mode 100644 index 0000000000..87c29860d4 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt @@ -0,0 +1,186 @@ +# returncode: 0 + +### 0 +"pkill" +"sglang" + +### 1 +"ray" +"stop" +"--force" + +### 2 +"sleep" +"5" + +### 3 +"pkill" +"-9" +"sglang" + +### 4 +"pkill" +"-9" +"ray" + +### 5 +"pkill" +"-9" +"python" + +### 6 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 7 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--calculate-per-token-loss" +"--swiglu" +"--num-layers" +"24" +"--hidden-size" +"896" +"--ffn-hidden-size" +"4864" +"--num-attention-heads" +"14" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-0.5B-Instruct/" +"--megatron-to-hf-mode" +"bridge" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--megatron-to-hf-mode" +"bridge" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-team" +"miles-lora" +"--wandb-project" +"miles-lora-megatron" +"--wandb-group" +"qwen2.5-0.5B-gsm8k-test" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"10" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.4" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--prompt-data" +"/root/gsm8k/train.parquet" +"--input-key" +"messages" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt new file mode 100644 index 0000000000..a0c726c514 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt @@ -0,0 +1,223 @@ +# returncode: 0 + +### 0 +"apt-get" +"install" +"-y" +"iproute2" + +### 1 +"python3" +"-c" +"import socket;s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM);s.connect(('8.8.8.8',53));print(s.getsockname()[0])" + +### 2 +"ip" +"-o" +"-4" +"addr" +"show" + +### 3 +"awk" +"-v" +"ip=" +"$4 ~ \"^\"ip\"/\" {print $2; exit}" + +### 4 +"pkill" +"sglang" + +### 5 +"ray" +"stop" +"--force" + +### 6 +"sleep" +"5" + +### 7 +"pkill" +"-9" +"sglang" + +### 8 +"pkill" +"-9" +"ray" + +### 9 +"pkill" +"-9" +"python" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"1" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"python3" +"-c" +"import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 12 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\",\n \"NVTE_NORM_FWD_USE_CUDNN\": \"1\",\n \"NVTE_NORM_BWD_USE_CUDNN\": \"1\"\n }\n }" +"--" +"python3" +"train.py" +"--calculate-per-token-loss" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"16" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-3B-Instruct/" +"--megatron-to-hf-mode" +"bridge" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--megatron-to-hf-mode" +"bridge" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-project" +"miles-lora-megatron" +"--wandb-group" +"qwen2.5-3B-lora-disaggregate-2node-p2p" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"10" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-remote-instance-weight-loader-start-seed-via-transfer-engine" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--no-gradient-accumulation-fusion" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"1" +"--update-weight-transfer-mode" +"p2p" +"--update-weight-buffer-size" +"1073741824" +"--check-weight-update-equal" +"--prompt-data" +"/root/gsm8k/train.parquet" +"--input-key" +"messages" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt new file mode 100644 index 0000000000..f6c62b12ad --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt @@ -0,0 +1,185 @@ +# returncode: 0 + +### 0 +"pkill" +"sglang" + +### 1 +"ray" +"stop" +"--force" + +### 2 +"sleep" +"5" + +### 3 +"pkill" +"-9" +"sglang" + +### 4 +"pkill" +"-9" +"ray" + +### 5 +"pkill" +"-9" +"python" + +### 6 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"2" +"--disable-usage-stats" + +### 7 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"1" +"--calculate-per-token-loss" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"16" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" +"--hf-checkpoint" +"/root/Qwen2.5-3B-Instruct/" +"--megatron-to-hf-mode" +"bridge" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--megatron-to-hf-mode" +"bridge" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-project" +"miles-lora-megatron" +"--wandb-group" +"qwen2.5-3B-lora-disaggregate" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"10" +"--eval-prompt-data" +"gsm8k" +"/root/gsm8k/test.parquet" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"1024" +"--eval-top-k" +"1" +"--rollout-num-gpus" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--prompt-data" +"/root/gsm8k/train.parquet" +"--input-key" +"messages" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt new file mode 100644 index 0000000000..e70fe24e1c --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt @@ -0,0 +1,217 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"NVTE_ALLOW_NONDETERMINISTIC_ALGO\": \"0\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/models/Qwen3-4B" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/root/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"2048" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"64" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--global-batch-size" +"128" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-team" +"miles-lora" +"--wandb-project" +"miles-lora-megatron" +"--wandb-group" +"qwen3-4B-test" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"5" +"--eval-prompt-data" +"aime24" +"/root/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"2" +"--eval-max-response-len" +"16384" +"--eval-top-k" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-deterministic-inference" +"--sglang-attention-backend" +"flashinfer" +"--deterministic-mode" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--lora-rank" +"32" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--megatron-to-hf-mode" +"bridge" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt new file mode 100644 index 0000000000..c7444461f4 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt @@ -0,0 +1,195 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_ALGO\": \"Ring\",\n \"CUBLAS_WORKSPACE_CONFIG\": \":4096:8\"\n }\n}" +"--" +"python3" +"train.py" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--save" +"/root/Qwen3-4B-lora-ckpt" +"--save-interval" +"50" +"--lora-rank" +"64" +"--lora-alpha" +"32" +"--lora-dropout" +"0.0" +"--target-modules" +"all-linear" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--balance-data" +"--rm-type" +"deepscaler" +"--num-rollout" +"100" +"--rollout-batch-size" +"8" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime24" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--optimizer" +"adam" +"--lr" +"2e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-host" +"https://wandb.ai/" +"--wandb-team" +"miles-lora" +"--wandb-project" +"miles-lora-test" +"--wandb-group" +"qwen3-4B-megatron-lora-dapo-lr2e-5" +"--disable-wandb-random-suffix" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-decode-log-interval" +"1000" +"--sglang-mem-fraction-static" +"0.4" +"--sglang-chunked-prefill-size" +"4096" +"--megatron-to-hf-mode" +"bridge" +"--train-backend" +"megatron" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--colocate" +"--calculate-per-token-loss" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh.txt new file mode 100644 index 0000000000..6e5bd79017 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase1_rlvr_teacher.sh.txt @@ -0,0 +1,208 @@ +# returncode: 0 + +### 0 +"mkdir" +"-p" +"/workdir" + +### 1 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--submission-id" +"qwen3.5-rlvr-teacher" +"--no-wait" +"--runtime-env-json={\"env_vars\": {\"PYTHONPATH\": \":/root/Megatron-LM/\", \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\", \"WANDB_API_KEY\": \"frozen-wandb-api-key\"}}" +"--" +"python3" +"/train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B" +"--ref-load" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B_torch_dist" +"--load" +"/workdir" +"--save" +"/workdir" +"--save-interval" +"5" +"--prompt-data" +"/node_public/maocheng-qwen35/data/dapo_train.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"20" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"24576" +"--rollout-temperature" +"1" +"--num-steps-per-rollout" +"1" +"--over-sampling-batch-size" +"32" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-opd" +"--wandb-group" +"qwen3.5-35b-rlvr-teacher" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--log-probs-chunk-size" +"4096" +"--eval-interval" +"5" +"--eval-config" +"/workdir/eval_dapo_heldout.yaml" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"8" +"--sglang-watchdog-timeout" +"1800" +"--sglang-enable-metrics" +"--sglang-attention-backend" +"fa3" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"32" +"--use-rollout-routing-replay" +"--sglang-mamba-scheduler-strategy" +"extra_buffer" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-rm-path" +"examples.on_policy_distillation.qwen3_5_35b_selfdistill.rm.reward_func" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh.txt new file mode 100644 index 0000000000..859b8611f6 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_gb200.sh.txt @@ -0,0 +1,217 @@ +# returncode: 0 + +### 0 +"mkdir" +"-p" +"/workdir" + +### 1 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--submission-id" +"qwen3.5-opd-pure" +"--no-wait" +"--runtime-env-json={\"env_vars\": {\"PYTHONPATH\": \":/root/Megatron-LM/\", \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\", \"WANDB_API_KEY\": \"frozen-wandb-api-key\", \"PROMETHEUS_PORT\": \"9090\", \"NCCL_NVLS_ENABLE\": \"0\"}}" +"--" +"python3" +"/train.py" +"--actor-num-nodes" +"2" +"--actor-num-gpus-per-node" +"4" +"--num-gpus-per-node" +"4" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"flex" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B" +"--ref-load" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B_torch_dist" +"--load" +"/workdir" +"--save" +"/workdir" +"--save-interval" +"5" +"--use-opd" +"--opd-type" +"megatron" +"--opd-teacher-load" +"/node_public/maocheng-qwen35/ckpt-teacher" +"--opd-kl-coef" +"0.2" +"--prompt-data" +"/node_public/maocheng-qwen35/data/dapo_train.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"12" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"24576" +"--rollout-temperature" +"1" +"--num-steps-per-rollout" +"1" +"--over-sampling-batch-size" +"32" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-opd" +"--wandb-group" +"qwen3.5-35b-opd-pure" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--log-probs-chunk-size" +"4096" +"--eval-interval" +"5" +"--eval-config" +"/workdir/eval_dapo_heldout.yaml" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-watchdog-timeout" +"1800" +"--sglang-enable-metrics" +"--sglang-moe-runner-backend" +"flashinfer_cutlass" +"--sglang-attention-backend" +"trtllm_mha" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"32" +"--use-rollout-routing-replay" +"--sglang-mamba-scheduler-strategy" +"extra_buffer" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-rm-path" +"examples.on_policy_distillation.qwen3_5_35b_selfdistill.rm.reward_func_pure_opd" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh.txt new file mode 100644 index 0000000000..3a333e8757 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/qwen3_5_35b_selfdistill/phase2_opd_selfdistill.sh.txt @@ -0,0 +1,215 @@ +# returncode: 0 + +### 0 +"mkdir" +"-p" +"/workdir" + +### 1 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--submission-id" +"qwen3.5-opd-pure" +"--no-wait" +"--runtime-env-json={\"env_vars\": {\"PYTHONPATH\": \":/root/Megatron-LM/\", \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\", \"WANDB_API_KEY\": \"frozen-wandb-api-key\"}}" +"--" +"python3" +"/train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B" +"--ref-load" +"/cluster_public/miles_data/models/Qwen3.5-35B-A3B_torch_dist" +"--load" +"/workdir" +"--save" +"/workdir" +"--save-interval" +"5" +"--use-opd" +"--opd-type" +"megatron" +"--opd-teacher-load" +"/node_public/maocheng-qwen35/ckpt-teacher" +"--opd-kl-coef" +"0.2" +"--prompt-data" +"/node_public/maocheng-qwen35/data/dapo_train.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"12" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"24576" +"--rollout-temperature" +"1" +"--num-steps-per-rollout" +"1" +"--over-sampling-batch-size" +"32" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--use-wandb" +"--wandb-project" +"miles-opd" +"--wandb-group" +"qwen3.5-35b-opd-pure" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--log-probs-chunk-size" +"4096" +"--eval-interval" +"5" +"--eval-config" +"/workdir/eval_dapo_heldout.yaml" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"8" +"--sglang-watchdog-timeout" +"1800" +"--sglang-enable-metrics" +"--sglang-attention-backend" +"fa3" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"32" +"--use-rollout-routing-replay" +"--sglang-mamba-scheduler-strategy" +"extra_buffer" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-rm-path" +"examples.on_policy_distillation.qwen3_5_35b_selfdistill.rm.reward_func_pure_opd" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt new file mode 100644 index 0000000000..d4a648418a --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt @@ -0,0 +1,189 @@ +# returncode: 0 + +### 0 +"nvidia-smi" +"topo" +"-m" + +### 1 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 2 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"2" +"--rollout-num-gpus" +"4" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/Qwen3-8B" +"--ref-load" +"/root/Qwen3-8B_torch_dist" +"--load" +"/root/Qwen3-8B_miles/" +"--save" +"/root/Qwen3-8B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"300" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-opd" +"--opd-type" +"megatron" +"--opd-kl-coef" +"1.0" +"--opd-teacher-load" +"/root/Qwen3-8B_torch_dist" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.4" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--rm-type" +"math" + +### 3 +"pkill" +"-9" +"sglang" + +### 4 +"sleep" +"3" + +### 5 +"ray" +"stop" +"--force" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"sleep" +"3" + +### 9 +"pkill" +"-9" +"ray" + +### 10 +"pkill" +"-9" +"python" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt new file mode 100644 index 0000000000..590060a19f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt @@ -0,0 +1,266 @@ +# returncode: 0 + +### 0 +"python3" +"-m" +"sglang.launch_server" +"--model-path" +"/root/Qwen3-32B" +"--host" +"0.0.0.0" +"--port" +"13141" +"--tp" +"1" +"--chunked-prefill-size" +"4096" +"--mem-fraction-static" +"0.6" + +### 1 +"python3" +"-m" +"sglang.launch_server" +"--model-path" +"/root/Qwen3-Coder-30B-A3B-Instruct" +"--host" +"0.0.0.0" +"--port" +"13142" +"--tp" +"1" +"--chunked-prefill-size" +"4096" +"--mem-fraction-static" +"0.6" + +### 2 +"curl" +"-sf" +"http://127.0.0.1:13141/health_generate" + +### 3 +"curl" +"http://127.0.0.1:13141/get_model_info" + +### 4 +"curl" +"-sf" +"http://127.0.0.1:13142/health_generate" + +### 5 +"curl" +"http://127.0.0.1:13142/get_model_info" + +### 6 +"sleep" +"10" + +### 7 +"mkdir" +"-p" +"/root/opd-multi-teacher" + +### 8 +"python3" +"-" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"2" +"--rollout-num-gpus" +"4" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/Qwen3-8B" +"--ref-load" +"/root/Qwen3-8B_torch_dist" +"--load" +"/root/Qwen3-8B_miles/" +"--save" +"/root/Qwen3-8B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/opd-multi-teacher/mixed.jsonl" +"--input-key" +"prompt" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"300" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-opd" +"--opd-type" +"sglang" +"--opd-kl-coef" +"1.0" +"--opd-log-prob-top-k" +"16" +"--opd-top-k-strategy" +"only-student" +"--opd-reward-weight-mode" +"student_p" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.4" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-rm-path" +"miles.rollout.on_policy_distillation.reward_func" +"--custom-reward-post-process-path" +"miles.rollout.on_policy_distillation.post_process_rewards" +"--opd-teacher-urls" +"math=http://127.0.0.1:13141/generate" +"code=http://127.0.0.1:13142/generate" +"default=http://127.0.0.1:13141/generate" +"--opd-teacher-key" +"opd_teacher" + +### 12 +"pkill" +"-9" +"sglang" + +### 13 +"sleep" +"3" + +### 14 +"ray" +"stop" +"--force" + +### 15 +"pkill" +"-9" +"ray" + +### 16 +"pkill" +"-9" +"python" + +### 17 +"sleep" +"3" + +### 18 +"pkill" +"-9" +"ray" + +### 19 +"pkill" +"-9" +"python" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt new file mode 100644 index 0000000000..7e32ebd59d --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt @@ -0,0 +1,227 @@ +# returncode: 0 + +### 0 +"python3" +"-m" +"sglang.launch_server" +"--model-path" +"/root/Qwen3-32B" +"--host" +"0.0.0.0" +"--port" +"13141" +"--tp" +"1" +"--chunked-prefill-size" +"4096" +"--mem-fraction-static" +"0.6" + +### 1 +"curl" +"-sf" +"http://127.0.0.1:13141/health_generate" + +### 2 +"curl" +"http://127.0.0.1:13141/get_model_info" + +### 3 +"sleep" +"10" + +### 4 +"nvidia-smi" +"topo" +"-m" + +### 5 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 6 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"2" +"--rollout-num-gpus" +"4" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/Qwen3-8B" +"--ref-load" +"/root/Qwen3-8B_torch_dist" +"--load" +"/root/Qwen3-8B_miles/" +"--save" +"/root/Qwen3-8B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--apply-chat-template" +"--rollout-shuffle" +"--num-rollout" +"300" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-opd" +"--opd-type" +"sglang" +"--opd-kl-coef" +"1.0" +"--opd-log-prob-top-k" +"16" +"--opd-top-k-strategy" +"only-student" +"--opd-reward-weight-mode" +"student_p" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.4" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--custom-rm-path" +"miles.rollout.on_policy_distillation.reward_func" +"--custom-reward-post-process-path" +"miles.rollout.on_policy_distillation.post_process_rewards" +"--rm-url" +"http://127.0.0.1:13141/generate" + +### 7 +"pkill" +"-9" +"sglang" + +### 8 +"sleep" +"3" + +### 9 +"ray" +"stop" +"--force" + +### 10 +"pkill" +"-9" +"ray" + +### 11 +"pkill" +"-9" +"python" + +### 12 +"sleep" +"3" + +### 13 +"pkill" +"-9" +"ray" + +### 14 +"pkill" +"-9" +"python" diff --git a/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt new file mode 100644 index 0000000000..05e1b71c70 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt @@ -0,0 +1,192 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt new file mode 100644 index 0000000000..c3bf834fc9 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt @@ -0,0 +1,271 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"no_proxy\": \"localhost,127.0.0.1,0.0.0.0,${MASTER_ADDR}\",\n \"MASTER_ADDR\": \"${MASTER_ADDR}\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"LD_LIBRARY_PATH\": \"/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/sgl-workspace/nvshmem/install/lib/\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"16" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/DeepSeek-R1/" +"--ref-load" +"/DeepSeek-R1_torch_dist/" +"--load" +"/DeepSeek-R1_miles/" +"--save" +"/DeepSeek-R1_miles/" +"--save-interval" +"20" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"32768" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"13" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/rl_data/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"32768" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"64" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-ep-moe" +"--sglang-enable-dp-attention" +"--sglang-dp-size" +"8" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-enable-dp-lm-head" +"--sglang-enable-deepep-moe" +"--sglang-deepep-mode" +"auto" +"--sglang-server-concurrency" +"1024" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-enable-deepep" +"--moe-token-dispatcher-type" +"flex" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt new file mode 100644 index 0000000000..9e5b0b4f7f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt @@ -0,0 +1,204 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--rollout-num-gpus" +"2" +"--spec" +"miles_plugins.models.glm4" +"get_glm_spec" +"--swiglu" +"--num-layers" +"40" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"13696" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"2" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"10000" +"--vocab-size" +"151552" +"--post-self-attn-layernorm" +"--post-mlp-layernorm" +"--rotary-interleaved" +"--rotary-percent" +"0.5" +"--no-rope-fusion" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/GLM-Z1-9B-0414/" +"--ref-load" +"/root/GLM-Z1-9B-0414_torch_dist" +"--load" +"/root/GLM-Z1-9B-0414_miles/" +"--save" +"/root/GLM-Z1-9B-0414_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--micro-batch-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"2304" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt new file mode 100644 index 0000000000..26f5eddcd2 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt @@ -0,0 +1,204 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--rollout-num-gpus" +"4" +"--spec" +"miles_plugins.models.glm4" +"get_glm_spec" +"--swiglu" +"--num-layers" +"40" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"13696" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"2" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"10000" +"--vocab-size" +"151552" +"--post-self-attn-layernorm" +"--post-mlp-layernorm" +"--rotary-interleaved" +"--rotary-percent" +"0.5" +"--no-rope-fusion" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/GLM-Z1-9B-0414/" +"--ref-load" +"/root/GLM-Z1-9B-0414_torch_dist" +"--load" +"/root/GLM-Z1-9B-0414_miles/" +"--save" +"/root/GLM-Z1-9B-0414_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4608" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt new file mode 100644 index 0000000000..fb0cb55235 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt @@ -0,0 +1,261 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"awk" +"{print $1}" +"/root/mpi_rack_hostfile" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"no_proxy\": \"localhost,127.0.0.1,0.0.0.0,${MASTER_ADDR}\",\n \"GLOO_SOCKET_IFNAME\": \"${MLP_SOCKET_IFNAME}\",\n \"TP_SOCKET_IFNAME\": \"${MLP_SOCKET_IFNAME}\",\n \"MASTER_ADDR\": \"${MLP_WORKER_0_HOST}\",\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"NCCL_CUMEM_ENABLE\": \"0\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NVTE_BWD_LAYERNORM_SM_MARGIN\": \"20\",\n \"NCCL_IB_TC\": \"160\",\n \"NCCL_PXN_DISABLE\": \"0\",\n \"NCCL_IB_GID_INDEX\": \"3\",\n \"NCCL_NET_GDR_LEVEL\": \"4\",\n \"NCCL_IB_RETRY_CNT\": \"7\",\n \"NCCL_IB_TIMEOUT\": \"32\",\n \"NCCL_IB_QPS_PER_CONNECTION\": \"8\",\n \"NCCL_P2P_LEVEL\": \"NVL\",\n \"TORCH_NCCL_AVOID_RECORD_STREAMS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NCCL_MIN_CTAS\": \"4\",\n \"OMPI_MCA_pml\": \"ob1\",\n \"OMPI_MCA_btl\": \"^openib\",\n \"OMPI_MCA_routed\": \"direct\",\n \"OMPI_MCA_routed_radix\": \"1024\",\n \"OMPI_MCA_plm_rsh_no_tree_spawn\": \"1\",\n \"OMPI_MCA_oob_tcp_if_include\": \"${MLP_SOCKET_IFNAME}\",\n \"OMPI_MCA_btl_tcp_if_include\": \"${MLP_SOCKET_IFNAME}\"\n }\n }" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"8" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--save-debug-rollout-data" +"/mnt/zhuzilin/github-miles/data.pt" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"96" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"92" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"12288" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--rotary-percent" +"0.5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151552" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-shared-expert-intermediate-size" +"1536" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-layer-freq" +"[0]*3+[1]*89" +"--num-experts" +"160" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/GLM-4.5-355B-A32B" +"--ref-load" +"/GLM-4.5-355B-A32B_torch_dist/" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"32768" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--rollout-stop-token-ids" +"151329" +"151336" +"151338" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"1e-4" +"--eps-clip-high" +"2e-4" +"--use-tis" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"16" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/rl_data/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"32768" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"32" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-dp-attention" +"--sglang-dp-size" +"4" +"--sglang-ep-size" +"32" +"--sglang-enable-dp-lm-head" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-speculative-algorithm" +"EAGLE" +"--sglang-speculative-num-steps" +"1" +"--sglang-speculative-eagle-topk" +"1" +"--sglang-speculative-num-draft-tokens" +"2" +"--sglang-enable-draft-weights-cpu-backup" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-token-dispatcher-type" +"flex" +"--moe-enable-deepep" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt new file mode 100644 index 0000000000..b1fd672585 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt @@ -0,0 +1,249 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--colocate" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--rollout-num-gpus" +"8" +"--moe-layer-freq" +"[0]*1+[1]*46" +"--num-experts" +"64" +"--moe-shared-expert-intermediate-size" +"1536" +"--moe-router-topk" +"4" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"1.8" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"64" +"--num-layers" +"47" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"10240" +"--num-attention-heads" +"20" +"--disable-bias-linear" +"--add-qkv-bias" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"768" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--no-rope-fusion" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/root/shared/GLM-4.7-Flash" +"--ref-load" +"/root/shared/GLM-4.7-Flash_torch_dist/" +"--prompt-data" +"/root/shared/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1.0" +"--global-batch-size" +"256" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"32768" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime24" +"/root/shared/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-temperature" +"0.6" +"--eval-top-p" +"0.95" +"--rollout-num-gpus-per-engine" +"4" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-speculative-algorithm" +"EAGLE" +"--sglang-speculative-num-steps" +"2" +"--sglang-speculative-eagle-topk" +"1" +"--sglang-speculative-num-draft-tokens" +"3" +"--use-rollout-routing-replay" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt new file mode 100644 index 0000000000..577a4b430c --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt @@ -0,0 +1,197 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--num-layers" +"24" +"--hidden-size" +"2880" +"--ffn-hidden-size" +"2880" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--kv-channels" +"64" +"--use-rotary-position-embeddings" +"--rotary-percent" +"1.0" +"--rotary-base" +"150000" +"--max-position-embeddings" +"131072" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"201088" +"--softmax-type" +"learnable" +"--window-size" +"128,0" +"--window-attn-skip-freq" +"2" +"--no-masked-softmax-fusion" +"--no-rope-fusion" +"--num-experts" +"32" +"--moe-router-topk" +"4" +"--moe-aux-loss-coeff" +"0.0" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-dtype" +"fp32" +"--moe-grouped-gemm" +"--hf-checkpoint" +"/root/shared/gpt-oss-20b" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/root/shared/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"1000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1.0" +"--num-steps-per-rollout" +"1" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--micro-batch-size" +"1" +"--rollout-num-gpus-per-engine" +"4" +"--sglang-dtype" +"bfloat16" +"--sglang-decode-log-interval" +"1000" +"--sglang-mem-fraction-static" +"0.70" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--qkv-format" +"bshd" +"--attention-backend" +"fused" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt new file mode 100644 index 0000000000..66dad480f7 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt @@ -0,0 +1,259 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"32" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--update-weight-buffer-size" +"2147483648" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"32.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/Kimi-K2-Instruct/" +"--ref-load" +"/Kimi-K2_torch_dist/" +"--load" +"/Kimi-K2_miles/" +"--save" +"/Kimi-K2_miles/" +"--save-interval" +"20" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"32768" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"5" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/rl_data/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"32768" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"16" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-dp-attention" +"--sglang-dp-size" +"8" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-enable-dp-lm-head" +"--sglang-ep-size" +"16" +"--sglang-server-concurrency" +"1024" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-enable-deepep" +"--moe-token-dispatcher-type" +"flex" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt new file mode 100644 index 0000000000..88a8cd890f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt @@ -0,0 +1,257 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"32" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--update-weight-buffer-size" +"2147483648" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/Kimi-K2-Thinking-fp8/" +"--ref-load" +"/Kimi-K2-Thinking_torch_dist/" +"--load" +"/Kimi-K2-Thinking_miles/" +"--save" +"/Kimi-K2-Thinking_miles/" +"--save-interval" +"20" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"100" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-tis" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"5" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"16" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-dp-attention" +"--sglang-dp-size" +"8" +"--sglang-moe-dense-tp-size" +"1" +"--sglang-enable-dp-lm-head" +"--sglang-ep-size" +"16" +"--sglang-server-concurrency" +"1024" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt new file mode 100644 index 0000000000..909108edc3 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt @@ -0,0 +1,274 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"NCCL_TIMEOUT\": \"3600\",\n \"OPEN_TRAINING_INT4_FAKE_QAT_FLAG\": \"1\",\n \"OPEN_TRAINING_INT4_GROUP_SIZE\": \"32\",\n \"no_proxy\": \"\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"32" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--update-weight-buffer-size" +"2147483648" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/Kimi-K2.5-int4" +"--ref-load" +"/Kimi-K2.5-bf16" +"--megatron-to-hf-mode" +"bridge" +"--model-name" +"kimi_k25" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--balance-data" +"--rm-type" +"deepscaler" +"--num-rollout" +"20" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"16384" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--filter-zero-reward-samples" +"--use-dynamic-global-batch-size" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--use-distributed-optimizer" +"--advantage-estimator" +"grpo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"miles-kimi-k25" +"--wandb-group" +"kimi-k25" +"--disable-wandb-random-suffix" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"8" +"--context-parallel-size" +"4" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"5" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"4096" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-server-concurrency" +"1024" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"--use-rollout-routing-replay" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--no-check-for-nan-in-loss-and-grad" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt new file mode 100644 index 0000000000..b8b62f4995 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt @@ -0,0 +1,211 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-05" +"--rotary-base" +"640000" +"--vocab-size" +"151680" +"--untie-embeddings-and-output-weights" +"--max-position-embeddings" +"32768" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/root/MiMo-7B-RL" +"--ref-load" +"/root/MiMo-7B-RL_torch_dist" +"--load" +"/root/MiMo-7B-RL-mtp_miles/" +"--save" +"/root/MiMo-7B-RL-mtp_miles/" +"--save-interval" +"2000" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"1" +"--eval-max-response-len" +"8192" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-speculative-algorithm" +"EAGLE" +"--sglang-speculative-num-steps" +"3" +"--sglang-speculative-eagle-topk" +"1" +"--sglang-speculative-num-draft-tokens" +"4" +"--sglang-attention-backend" +"fa3" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--enable-mtp-training" +"--mtp-loss-scaling-factor" +"0.2" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt new file mode 100644 index 0000000000..b71b7296de --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt @@ -0,0 +1,299 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"pkill" +"-9" +"redis" + +### 9 +"nvidia-smi" +"topo" +"-m" + +### 10 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--disable-bias-linear" +"--num-layers" +"27" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11264" +"--num-attention-heads" +"16" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--no-masked-softmax-fusion" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"1" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"64" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"1408" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2816" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.446" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--hf-checkpoint" +"/root/Moonlight-16B-A3B" +"--ref-load" +"/root/Moonlight-16B-A3B_torch_dist" +"--load" +"/root/Moonlight-16B-A3B_miles/" +"--save" +"/root/Moonlight-16B-A3B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"math" +"--num-rollout" +"3000" +"--rollout-batch-size" +"128" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"1" +"--over-sampling-batch-size" +"256" +"--dynamic-sampling-filter-path" +"miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" +"--num-steps-per-rollout" +"4" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"8" +"--eval-max-response-len" +"4096" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--moe-enable-deepep" +"--moe-token-dispatcher-type" +"flex" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt new file mode 100644 index 0000000000..3e128f7144 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt @@ -0,0 +1,216 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--colocate" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--rollout-num-gpus" +"8" +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"52" +"--hidden-size" +"2688" +"--ffn-hidden-size" +"1856" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"128" +"--moe-router-topk" +"6" +"--moe-ffn-hidden-size" +"1856" +"--moe-shared-expert-intermediate-size" +"3712" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16" +"--ref-load" +"/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16" +"--save" +"/nemotron-3-nano-30b-a3b_miles" +"--save-interval" +"20" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"10" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"128" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"2" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"2" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"1024" +"--log-probs-chunk-size" +"128" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--use-rollout-routing-replay" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"auto" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt new file mode 100644 index 0000000000..25060e5996 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt @@ -0,0 +1,180 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--colocate" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--rollout-num-gpus" +"8" +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"40" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"42" +"--hidden-size" +"3136" +"--ffn-hidden-size" +"12544" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/NVIDIA-Nemotron-3-Nano-4B-BF16" +"--ref-load" +"/NVIDIA-Nemotron-3-Nano-4B-BF16" +"--save" +"/nemotron-3-nano-4b_miles" +"--save-interval" +"20" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"10" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"4096" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"2" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"auto" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt new file mode 100644 index 0000000000..97010455b1 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt @@ -0,0 +1,1185 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"10.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"status" + +### 11 +"sleep" +"5" + +### 12 +"ray" +"status" + +### 13 +"sleep" +"5" + +### 14 +"ray" +"status" + +### 15 +"sleep" +"5" + +### 16 +"ray" +"status" + +### 17 +"sleep" +"5" + +### 18 +"ray" +"status" + +### 19 +"sleep" +"5" + +### 20 +"ray" +"status" + +### 21 +"sleep" +"5" + +### 22 +"ray" +"status" + +### 23 +"sleep" +"5" + +### 24 +"ray" +"status" + +### 25 +"sleep" +"5" + +### 26 +"ray" +"status" + +### 27 +"sleep" +"5" + +### 28 +"ray" +"status" + +### 29 +"sleep" +"5" + +### 30 +"ray" +"status" + +### 31 +"sleep" +"5" + +### 32 +"ray" +"status" + +### 33 +"sleep" +"5" + +### 34 +"ray" +"status" + +### 35 +"sleep" +"5" + +### 36 +"ray" +"status" + +### 37 +"sleep" +"5" + +### 38 +"ray" +"status" + +### 39 +"sleep" +"5" + +### 40 +"ray" +"status" + +### 41 +"sleep" +"5" + +### 42 +"ray" +"status" + +### 43 +"sleep" +"5" + +### 44 +"ray" +"status" + +### 45 +"sleep" +"5" + +### 46 +"ray" +"status" + +### 47 +"sleep" +"5" + +### 48 +"ray" +"status" + +### 49 +"sleep" +"5" + +### 50 +"ray" +"status" + +### 51 +"sleep" +"5" + +### 52 +"ray" +"status" + +### 53 +"sleep" +"5" + +### 54 +"ray" +"status" + +### 55 +"sleep" +"5" + +### 56 +"ray" +"status" + +### 57 +"sleep" +"5" + +### 58 +"ray" +"status" + +### 59 +"sleep" +"5" + +### 60 +"ray" +"status" + +### 61 +"sleep" +"5" + +### 62 +"ray" +"status" + +### 63 +"sleep" +"5" + +### 64 +"ray" +"status" + +### 65 +"sleep" +"5" + +### 66 +"ray" +"status" + +### 67 +"sleep" +"5" + +### 68 +"ray" +"status" + +### 69 +"sleep" +"5" + +### 70 +"ray" +"status" + +### 71 +"sleep" +"5" + +### 72 +"ray" +"status" + +### 73 +"sleep" +"5" + +### 74 +"ray" +"status" + +### 75 +"sleep" +"5" + +### 76 +"ray" +"status" + +### 77 +"sleep" +"5" + +### 78 +"ray" +"status" + +### 79 +"sleep" +"5" + +### 80 +"ray" +"status" + +### 81 +"sleep" +"5" + +### 82 +"ray" +"status" + +### 83 +"sleep" +"5" + +### 84 +"ray" +"status" + +### 85 +"sleep" +"5" + +### 86 +"ray" +"status" + +### 87 +"sleep" +"5" + +### 88 +"ray" +"status" + +### 89 +"sleep" +"5" + +### 90 +"ray" +"status" + +### 91 +"sleep" +"5" + +### 92 +"ray" +"status" + +### 93 +"sleep" +"5" + +### 94 +"ray" +"status" + +### 95 +"sleep" +"5" + +### 96 +"ray" +"status" + +### 97 +"sleep" +"5" + +### 98 +"ray" +"status" + +### 99 +"sleep" +"5" + +### 100 +"ray" +"status" + +### 101 +"sleep" +"5" + +### 102 +"ray" +"status" + +### 103 +"sleep" +"5" + +### 104 +"ray" +"status" + +### 105 +"sleep" +"5" + +### 106 +"ray" +"status" + +### 107 +"sleep" +"5" + +### 108 +"ray" +"status" + +### 109 +"sleep" +"5" + +### 110 +"ray" +"status" + +### 111 +"sleep" +"5" + +### 112 +"ray" +"status" + +### 113 +"sleep" +"5" + +### 114 +"ray" +"status" + +### 115 +"sleep" +"5" + +### 116 +"ray" +"status" + +### 117 +"sleep" +"5" + +### 118 +"ray" +"status" + +### 119 +"sleep" +"5" + +### 120 +"ray" +"status" + +### 121 +"sleep" +"5" + +### 122 +"ray" +"status" + +### 123 +"sleep" +"5" + +### 124 +"ray" +"status" + +### 125 +"sleep" +"5" + +### 126 +"ray" +"status" + +### 127 +"sleep" +"5" + +### 128 +"ray" +"status" + +### 129 +"sleep" +"5" + +### 130 +"ray" +"status" + +### 131 +"sleep" +"5" + +### 132 +"ray" +"status" + +### 133 +"sleep" +"5" + +### 134 +"ray" +"status" + +### 135 +"sleep" +"5" + +### 136 +"ray" +"status" + +### 137 +"sleep" +"5" + +### 138 +"ray" +"status" + +### 139 +"sleep" +"5" + +### 140 +"ray" +"status" + +### 141 +"sleep" +"5" + +### 142 +"ray" +"status" + +### 143 +"sleep" +"5" + +### 144 +"ray" +"status" + +### 145 +"sleep" +"5" + +### 146 +"ray" +"status" + +### 147 +"sleep" +"5" + +### 148 +"ray" +"status" + +### 149 +"sleep" +"5" + +### 150 +"ray" +"status" + +### 151 +"sleep" +"5" + +### 152 +"ray" +"status" + +### 153 +"sleep" +"5" + +### 154 +"ray" +"status" + +### 155 +"sleep" +"5" + +### 156 +"ray" +"status" + +### 157 +"sleep" +"5" + +### 158 +"ray" +"status" + +### 159 +"sleep" +"5" + +### 160 +"ray" +"status" + +### 161 +"sleep" +"5" + +### 162 +"ray" +"status" + +### 163 +"sleep" +"5" + +### 164 +"ray" +"status" + +### 165 +"sleep" +"5" + +### 166 +"ray" +"status" + +### 167 +"sleep" +"5" + +### 168 +"ray" +"status" + +### 169 +"sleep" +"5" + +### 170 +"ray" +"status" + +### 171 +"sleep" +"5" + +### 172 +"ray" +"status" + +### 173 +"sleep" +"5" + +### 174 +"ray" +"status" + +### 175 +"sleep" +"5" + +### 176 +"ray" +"status" + +### 177 +"sleep" +"5" + +### 178 +"ray" +"status" + +### 179 +"sleep" +"5" + +### 180 +"ray" +"status" + +### 181 +"sleep" +"5" + +### 182 +"ray" +"status" + +### 183 +"sleep" +"5" + +### 184 +"ray" +"status" + +### 185 +"sleep" +"5" + +### 186 +"ray" +"status" + +### 187 +"sleep" +"5" + +### 188 +"ray" +"status" + +### 189 +"sleep" +"5" + +### 190 +"ray" +"status" + +### 191 +"sleep" +"5" + +### 192 +"ray" +"status" + +### 193 +"sleep" +"5" + +### 194 +"ray" +"status" + +### 195 +"sleep" +"5" + +### 196 +"ray" +"status" + +### 197 +"sleep" +"5" + +### 198 +"ray" +"status" + +### 199 +"sleep" +"5" + +### 200 +"ray" +"status" + +### 201 +"sleep" +"5" + +### 202 +"ray" +"status" + +### 203 +"sleep" +"5" + +### 204 +"ray" +"status" + +### 205 +"sleep" +"5" + +### 206 +"ray" +"status" + +### 207 +"sleep" +"5" + +### 208 +"ray" +"status" + +### 209 +"sleep" +"5" + +### 210 +"ray" +"status" + +### 211 +"sleep" +"5" + +### 212 +"ray" +"status" + +### 213 +"sleep" +"5" + +### 214 +"ray" +"status" + +### 215 +"sleep" +"5" + +### 216 +"ray" +"status" + +### 217 +"sleep" +"5" + +### 218 +"ray" +"status" + +### 219 +"sleep" +"5" + +### 220 +"ray" +"status" + +### 221 +"sleep" +"5" + +### 222 +"ray" +"status" + +### 223 +"sleep" +"5" + +### 224 +"ray" +"status" + +### 225 +"sleep" +"5" + +### 226 +"ray" +"status" + +### 227 +"sleep" +"5" + +### 228 +"ray" +"status" + +### 229 +"sleep" +"5" + +### 230 +"ray" +"status" + +### 231 +"sleep" +"5" + +### 232 +"ray" +"status" + +### 233 +"sleep" +"5" + +### 234 +"ray" +"status" + +### 235 +"sleep" +"5" + +### 236 +"ray" +"status" + +### 237 +"sleep" +"5" + +### 238 +"ray" +"status" + +### 239 +"sleep" +"5" + +### 240 +"ray" +"status" + +### 241 +"sleep" +"5" + +### 242 +"ray" +"status" + +### 243 +"sleep" +"5" + +### 244 +"ray" +"status" + +### 245 +"sleep" +"5" + +### 246 +"ray" +"status" + +### 247 +"sleep" +"5" + +### 248 +"ray" +"status" + +### 249 +"sleep" +"5" + +### 250 +"ray" +"status" + +### 251 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"2" +"--actor-num-gpus-per-node" +"8" +"--rollout-num-gpus" +"16" +"--colocate" +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"88" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"2688" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"512" +"--moe-router-topk" +"22" +"--moe-ffn-hidden-size" +"2688" +"--moe-shared-expert-intermediate-size" +"5376" +"--moe-latent-size" +"1024" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"5.0" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/cluster_public/miles_data/models/NVIDIA-Nemotron-3-Super-120B-A12B-BF16" +"--ref-load" +"/cluster_public/miles_data/models/NVIDIA-Nemotron-3-Super-120B-A12B-BF16" +"--save" +"/cluster_public/miles_data/models/nemotron-3-super-120b-a12b_miles" +"--save-interval" +"20" +"--megatron-to-hf-mode" +"bridge" +"--prompt-data" +"/cluster_public/miles_data/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"10" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"1024" +"--rollout-temperature" +"1" +"--global-batch-size" +"128" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"2" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"1024" +"--log-probs-chunk-size" +"128" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--use-rollout-routing-replay" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"auto" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt new file mode 100644 index 0000000000..e91727a97d --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt @@ -0,0 +1,199 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"awk" +"{print $1}" +"/root/mpi_rack_hostfile" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"no_proxy\": \"127.0.0.1,127.0.0.1\",\n \"MASTER_ADDR\": \"127.0.0.1\",\n \"PYTORCH_CUDA_ALLOC_CONF\": \"expandable_segments:True\"\n }\n}" +"--" +"python3" +"train_async.py" +"--actor-num-nodes" +"4" +"--actor-num-gpus-per-node" +"8" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"94" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/frozen/checkpoints/Qwen3-235B-A22B" +"--ref-load" +"/frozen/checkpoints/Qwen3-235B-A22B_torch_dist" +"--load" +"/frozen/checkpoints/Qwen3-235B-A22B_miles/" +"--save" +"/frozen/checkpoints/Qwen3-235B-A22B_miles/" +"--save-interval" +"1000" +"--rollout-function-path" +"miles.rollout.sft_rollout.generate_rollout" +"--prompt-data" +"/frozen/checkpoints/openhermes2_5.parquet" +"--input-key" +"messages" +"--rollout-shuffle" +"--num-epoch" +"3" +"--rollout-batch-size" +"128" +"--global-batch-size" +"128" +"--loss-type" +"sft_loss" +"--calculate-per-token-loss" +"--disable-compute-advantages-and-returns" +"--debug-train-only" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"cosine" +"--min-lr" +"1e-6" +"--lr-warmup-fraction" +"0.1" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"32" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt new file mode 100644 index 0000000000..2387b134ba --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt @@ -0,0 +1,275 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"awk" +"{print $1}" +"/root/mpi_rack_hostfile" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"no_proxy\": \"127.0.0.1,127.0.0.1\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"8" +"--actor-num-gpus-per-node" +"8" +"--rollout-num-gpus" +"64" +"--update-weight-buffer-size" +"4294967296" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"94" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--hf-checkpoint" +"/frozen/checkpoints/Qwen3-235B-A22B-FP8" +"--ref-load" +"/frozen/checkpoints/Qwen3-235B-A22B_torch_dist" +"--load" +"/frozen/checkpoints/Qwen3-235B-A22B_miles/" +"--save" +"/frozen/checkpoints/Qwen3-235B-A22B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/frozen/checkpoints/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"8" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"64" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"16" +"--expert-tensor-parallel-size" +"1" +"--decoder-last-pipeline-num-layers" +"22" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"16384" +"--eval-prompt-data" +"aime" +"/frozen/checkpoints/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"32" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-enable-dp-attention" +"--sglang-dp-size" +"4" +"--sglang-ep-size" +"32" +"--sglang-enable-dp-lm-head" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--sglang-moe-a2a-backend" +"deepep" +"--sglang-deepep-mode" +"auto" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt new file mode 100644 index 0000000000..9fab9236ea --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt @@ -0,0 +1,237 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"25600" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" +"--hf-checkpoint" +"/root/Qwen3-32B" +"--ref-load" +"/root/Qwen3-32B_torch_dist/" +"--load" +"/root/Qwen3-32B_miles" +"--save" +"/root/Qwen3-32B_miles" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"5" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"8" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"20480" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt new file mode 100644 index 0000000000..3563312a8c --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt @@ -0,0 +1,167 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"PYTORCH_CUDA_ALLOC_CONF\": \"expandable_segments:True\"\n }\n}" +"--" +"python3" +"train_async.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B-Base/" +"--ref-load" +"/root/Qwen3-4B-Base_torch_dist" +"--load" +"/root/Qwen3-4B-Base_miles/" +"--save" +"/root/Qwen3-4B-Base_miles/" +"--save-interval" +"1000" +"--rollout-function-path" +"miles.rollout.sft_rollout.generate_rollout" +"--prompt-data" +"/root/openhermes2_5.parquet" +"--input-key" +"messages" +"--rollout-shuffle" +"--num-epoch" +"3" +"--rollout-batch-size" +"128" +"--global-batch-size" +"128" +"--loss-type" +"sft_loss" +"--calculate-per-token-loss" +"--disable-compute-advantages-and-returns" +"--debug-train-only" +"--optimizer" +"adam" +"--lr" +"1e-5" +"--lr-decay-style" +"cosine" +"--min-lr" +"1e-6" +"--lr-warmup-fraction" +"0.1" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.95" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt new file mode 100644 index 0000000000..d4c1bb37af --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt @@ -0,0 +1,197 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt new file mode 100644 index 0000000000..5aca51b031 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt @@ -0,0 +1,200 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"4" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"4" +"--colocate" +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--hf-checkpoint" +"/root/Qwen3-4B" +"--ref-load" +"/root/Qwen3-4B_torch_dist" +"--load" +"/root/Qwen3-4B_miles/" +"--save" +"/root/Qwen3-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--use-wandb" +"--wandb-project" +"miles-dev-qwen3-radix" +"--wandb-group" +"qwen3-4B-4xgpu" +"--wandb-key" +"frozen-wandb-key" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt new file mode 100644 index 0000000000..fa31c87684 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt @@ -0,0 +1,263 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"awk" +"{print $1}" +"/root/mpi_rack_hostfile" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\",\n \"no_proxy\": \"127.0.0.1,127.0.0.1\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"6" +"--spec" +"miles_plugins.models.qwen3_next" +"get_qwen3_next_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"5120" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"10" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"512" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking" +"--ref-load" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_torch_dist" +"--load" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_miles/" +"--save" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_miles/" +"--save-interval" +"20" +"--prompt-data" +"/frozen/checkpoints/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"300" +"--rollout-batch-size" +"16" +"--n-samples-per-prompt" +"4" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"0.8" +"--global-batch-size" +"64" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"6" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"2048" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/frozen/checkpoints/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"2" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"0.7" +"--rollout-num-gpus-per-engine" +"2" +"--rollout-num-gpus" +"2" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"1" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-token-dispatcher-type" +"alltoall" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt new file mode 100644 index 0000000000..87689bcd22 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt @@ -0,0 +1,274 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"awk" +"{print $1}" +"/root/mpi_rack_hostfile" + +### 11 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n \"no_proxy\": \"127.0.0.1,127.0.0.1\",\n \"MASTER_ADDR\": \"127.0.0.1\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"4" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_next" +"get_qwen3_next_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"5120" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"10" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"512" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking" +"--ref-load" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_torch_dist" +"--load" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_miles/" +"--save" +"/frozen/checkpoints/Qwen3-Next-80B-A3B-Thinking_miles/" +"--save-interval" +"20" +"--prompt-data" +"/frozen/checkpoints/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"gspo" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--kl-coef" +"0.00" +"--entropy-coef" +"0.00" +"--eps-clip" +"4e-4" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"4" +"--context-parallel-size" +"2" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/frozen/checkpoints/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.8" +"--sglang-ep-size" +"8" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"--sglang-speculative-algorithm" +"EAGLE" +"--sglang-speculative-num-steps" +"2" +"--sglang-speculative-eagle-topk" +"1" +"--sglang-speculative-num-draft-tokens" +"3" +"--sglang-enable-draft-weights-cpu-backup" +"--sglang-max-running-requests" +"512" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-token-dispatcher-type" +"flex" +"--moe-enable-deepep" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt new file mode 100644 index 0000000000..53c86221e6 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt @@ -0,0 +1,209 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"24" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"17408" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" +"--hf-checkpoint" +"/root/Qwen3.5-27B" +"--ref-load" +"/root/Qwen3.5-27B_torch_dist" +"--load" +"/root/Qwen3.5-27B_miles/" +"--save" +"/root/Qwen3.5-27B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.5" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt new file mode 100644 index 0000000000..042f63869f --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt @@ -0,0 +1,289 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" +"--hf-checkpoint" +"/root/Qwen3.5-35B-A3B" +"--ref-load" +"/root/Qwen3.5-35B-A3B_torch_dist" +"--load" +"/root/Qwen3.5-35B-A3B_miles/" +"--save" +"/root/Qwen3.5-35B-A3B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"1" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"8" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"8" +"--sglang-mem-fraction-static" +"0.7" +"--sglang-ep-size" +"8" +"--sglang-cuda-graph-bs" +"1" +"2" +"4" +"8" +"16" +"24" +"32" +"40" +"48" +"56" +"64" +"72" +"80" +"88" +"96" +"104" +"112" +"120" +"128" +"136" +"144" +"152" +"160" +"168" +"176" +"184" +"192" +"200" +"208" +"216" +"224" +"232" +"240" +"248" +"256" +"--sglang-speculative-algorithm" +"EAGLE" +"--sglang-speculative-num-steps" +"2" +"--sglang-speculative-eagle-topk" +"1" +"--sglang-speculative-num-draft-tokens" +"3" +"--sglang-max-running-requests" +"512" +"--enable-mtp-training" +"--mtp-num-layers" +"1" +"--mtp-loss-scaling-factor" +"0.2" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" +"--moe-token-dispatcher-type" +"flex" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt new file mode 100644 index 0000000000..49b84e687b --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt @@ -0,0 +1,205 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"32" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9216" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" +"--hf-checkpoint" +"/root/Qwen3.5-4B" +"--ref-load" +"/root/Qwen3.5-4B_torch_dist" +"--load" +"/root/Qwen3.5-4B_miles/" +"--save" +"/root/Qwen3.5-4B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.7" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt new file mode 100644 index 0000000000..b44019d4a5 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt @@ -0,0 +1,206 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"32" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" +"--hf-checkpoint" +"/root/Qwen3.5-9B" +"--ref-load" +"/root/Qwen3.5-9B_torch_dist" +"--load" +"/root/Qwen3.5-9B_miles/" +"--save" +"/root/Qwen3.5-9B_miles/" +"--save-interval" +"20" +"--prompt-data" +"/root/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"2" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"9216" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/root/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.6" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt new file mode 100644 index 0000000000..e3ec1d8269 --- /dev/null +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt @@ -0,0 +1,209 @@ +# returncode: 0 + +### 0 +"pkill" +"-9" +"sglang" + +### 1 +"sleep" +"3" + +### 2 +"ray" +"stop" +"--force" + +### 3 +"pkill" +"-9" +"ray" + +### 4 +"pkill" +"-9" +"python" + +### 5 +"sleep" +"3" + +### 6 +"pkill" +"-9" +"ray" + +### 7 +"pkill" +"-9" +"python" + +### 8 +"nvidia-smi" +"topo" +"-m" + +### 9 +"ray" +"start" +"--head" +"--node-ip-address" +"127.0.0.1" +"--num-gpus" +"8" +"--disable-usage-stats" +"--dashboard-host=0.0.0.0" +"--dashboard-port=8265" + +### 10 +"ray" +"job" +"submit" +"--address=http://127.0.0.1:8265" +"--runtime-env-json={\n \"env_vars\": {\n \"PYTHONPATH\": \"/root/Megatron-LM/\",\n \"CUDA_DEVICE_MAX_CONNECTIONS\": \"1\",\n \"NCCL_NVLS_ENABLE\": \"0\"\n }\n}" +"--" +"python3" +"train.py" +"--actor-num-nodes" +"1" +"--actor-num-gpus-per-node" +"8" +"--colocate" +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"24" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"17408" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" +"--hf-checkpoint" +"/cluster_public/miles_data/models/Qwen3.6-27B" +"--ref-load" +"/cluster_public/miles_data/models/Qwen3.6-27B_torch_dist" +"--load" +"/frozen/checkpoints/checkpoints" +"--save" +"/frozen/checkpoints/checkpoints" +"--save-interval" +"20" +"--prompt-data" +"/cluster_public/miles_data/datasets/dapo-math-17k/dapo-math-17k.jsonl" +"--input-key" +"prompt" +"--label-key" +"label" +"--apply-chat-template" +"--rollout-shuffle" +"--rm-type" +"deepscaler" +"--num-rollout" +"3000" +"--rollout-batch-size" +"32" +"--n-samples-per-prompt" +"8" +"--rollout-max-response-len" +"8192" +"--rollout-temperature" +"1" +"--global-batch-size" +"256" +"--balance-data" +"--optimizer" +"adam" +"--lr" +"1e-6" +"--lr-decay-style" +"constant" +"--weight-decay" +"0.1" +"--adam-beta1" +"0.9" +"--adam-beta2" +"0.98" +"--optimizer-cpu-offload" +"--overlap-cpu-optimizer-d2h-h2d" +"--use-precision-aware-optimizer" +"--advantage-estimator" +"grpo" +"--use-kl-loss" +"--kl-loss-coef" +"0.00" +"--kl-loss-type" +"low_var_kl" +"--entropy-coef" +"0.00" +"--eps-clip" +"0.2" +"--eps-clip-high" +"0.28" +"--tensor-model-parallel-size" +"4" +"--sequence-parallel" +"--pipeline-model-parallel-size" +"1" +"--context-parallel-size" +"1" +"--expert-model-parallel-size" +"1" +"--expert-tensor-parallel-size" +"1" +"--recompute-granularity" +"full" +"--recompute-method" +"uniform" +"--recompute-num-layers" +"1" +"--use-dynamic-batch-size" +"--max-tokens-per-gpu" +"8192" +"--eval-interval" +"20" +"--eval-prompt-data" +"aime" +"/cluster_public/miles_data/datasets/aime-2024/aime-2024.jsonl" +"--n-samples-per-eval-prompt" +"16" +"--eval-max-response-len" +"16384" +"--eval-top-p" +"1" +"--rollout-num-gpus-per-engine" +"1" +"--sglang-mem-fraction-static" +"0.5" +"--attention-dropout" +"0.0" +"--hidden-dropout" +"0.0" +"--accumulate-allreduce-grads-in-fp32" +"--attention-softmax-in-fp32" +"--attention-backend" +"flash" From 7fd62690236d87189edcdbef794947f59a77b76f Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 10:41:09 +0800 Subject: [PATCH 06/18] Read the slurm allocation when the train config is built ExecuteTrainConfig.num_nodes read SLURM_JOB_NUM_NODES into a class-level default, so the value was fixed when command_utils was imported. A test that wants a deterministic launch command cannot undo that with monkeypatch, and a process that sets the variable after import does not see it either. A default_factory reads it at construction instead, but dataclass_cli copied the parameter's declared default straight into the click signature, and for a factory field that default is dataclasses' _HAS_DEFAULT_FACTORY sentinel, which click then type-casts: TypeError: int() argument must be ... not '_HAS_DEFAULT_FACTORY_CLASS' Every scripts/run_*.py exposes this config through that bridge. Resolve the factory when the signature is built, the way the argparse bridge already does. --- miles/utils/external_utils/command_utils.py | 4 ++-- miles/utils/typer_utils.py | 9 ++++++++- tests/fast/utils/test_command_utils.py | 10 ++++++++++ tests/fast/utils/test_typer_utils.py | 17 +++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index e76ff9be5a..01b76b34b3 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -9,7 +9,7 @@ import shlex import socket import time -from dataclasses import dataclass +from dataclasses import dataclass, field from functools import partial from pathlib import Path @@ -103,7 +103,7 @@ def fp8_cast_bf16(path_src, path_dst): @dataclass class ExecuteTrainConfig: cuda_core_dump: bool = False - num_nodes: int = int(os.environ.get("SLURM_JOB_NUM_NODES", "1")) + num_nodes: int = field(default_factory=lambda: int(os.environ.get("SLURM_JOB_NUM_NODES", "1"))) extra_env_vars: str = "" output_dir: str = "/root/shared_data" diff --git a/miles/utils/typer_utils.py b/miles/utils/typer_utils.py index 1e7c09d10c..dd0529d660 100644 --- a/miles/utils/typer_utils.py +++ b/miles/utils/typer_utils.py @@ -50,6 +50,13 @@ def cmd(args: MyArgs): ... return _wrap(func, env_var_prefix=env_var_prefix) +def _resolve_default(field: dataclasses.Field, param: inspect.Parameter) -> object: + """Call a default_factory now; click would otherwise type-cast dataclasses' sentinel.""" + if field.default_factory is not dataclasses.MISSING: + return field.default_factory() + return param.default + + def _wrap(func: _F, *, env_var_prefix: str) -> _F: hints: dict[str, type] = typing.get_type_hints(func) first_param_name: str = next(iter(inspect.signature(func).parameters)) @@ -79,7 +86,7 @@ def _wrap(func: _F, *, env_var_prefix: str) -> _F: resolved_type: type = resolved_hints.get(param.name, param.annotation) new_annotation = Annotated[resolved_type, typer.Option(**typer_kwargs)] - new_parameters.append(param.replace(annotation=new_annotation)) + new_parameters.append(param.replace(annotation=new_annotation, default=_resolve_default(field, param))) def wrapped(**kwargs: object) -> object: data: object = dataclass_cls(**kwargs) diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index d30c13049c..83e51b2db1 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -165,3 +165,13 @@ def test_rsync_simple_limits_itself_to_the_requested_node_count(monkeypatch): command_utils.rsync_simple("/src", "/dst", num_nodes=4) assert calls == [{"num_nodes": 4}] + + +class TestExecuteTrainConfig: + def test_num_nodes_reads_the_slurm_allocation_when_the_config_is_built(self, monkeypatch): + """A plain class-level default would bake in the allocation at import and ignore later changes.""" + monkeypatch.setenv("SLURM_JOB_NUM_NODES", "8") + assert command_utils.ExecuteTrainConfig().num_nodes == 8 + + monkeypatch.delenv("SLURM_JOB_NUM_NODES") + assert command_utils.ExecuteTrainConfig().num_nodes == 1 diff --git a/tests/fast/utils/test_typer_utils.py b/tests/fast/utils/test_typer_utils.py index 45991c22fc..94f03a3f38 100644 --- a/tests/fast/utils/test_typer_utils.py +++ b/tests/fast/utils/test_typer_utils.py @@ -730,6 +730,23 @@ def cmd(args: _SnakeArgs) -> None: assert result.exit_code == 0 assert "val=from_env" in result.stdout + def test_a_field_with_a_default_factory_is_usable_from_the_command_line(self) -> None: + """Click type-casts the declared default, so dataclasses' factory sentinel must never reach it.""" + + @dataclasses.dataclass + class _FactoryArgs: + count: int = dataclasses.field(default_factory=lambda: 7) + + app = typer.Typer() + + @app.command() + @dataclass_cli + def cmd(args: _FactoryArgs) -> None: + print(f"count={args.count}") + + assert "count=7" in runner.invoke(app, []).stdout + assert "count=9" in runner.invoke(app, ["--count", "9"]).stdout + # --------------------------------------------------------------------------- # import needed for signature inspection From de49808520815b3546db8c3fa9a3c73ee06fb1ad Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 15:04:36 +0800 Subject: [PATCH 07/18] Snapshot the commands and generated configs of every python launch script Squashed from: - Snapshot the commands built by every python launch script - Apply isort and black to the python launch script test - Reuse the shell harness sanitizer and snapshot helper - Move the python launcher snapshots into the shared tree too - Share the command recorder with the command_utils tests - Freeze the launcher environment that the snapshots actually depend on - Regenerate the launcher snapshots for the ray runtime unbuffering - Snapshot the config files a launcher generates, not just its commands - Record the generated precision config in the deepseek-v4 snapshots --- tests/fast/launch_scripts/py_harness.py | 151 ++++++++++++++++ tests/fast/launch_scripts/sh_harness.py | 8 +- .../launch_scripts/test_py_launch_scripts.py | 154 ++++++++++++++++ tests/fast/utils/command_recorder.py | 23 +++ tests/snapshots/README.md | 1 + .../amd/run_deepseek_v4.py/full_train.txt | 152 ++++++++++++++++ .../amd/run_deepseek_v4.py/prepare_cp.txt | 7 + .../run_deepseek_v4.py/prepare_download.txt | 16 ++ .../amd/run_deepseek_v4.py/prepare_single.txt | 14 ++ .../amd/run_deepseek_v4.py/prepare_spmd.txt | 10 ++ .../scripts/amd/run_deepseek_v4.py/train.txt | 109 ++++++++++++ .../amd/run_qwen3_30b_a3b.py/execute.txt | 90 ++++++++++ .../amd/run_qwen3_30b_a3b.py/prepare.txt | 22 +++ .../py/scripts/run_deepseek.py/train.txt | 144 +++++++++++++++ .../run_deepseek_v32.py/full_train.txt | 135 ++++++++++++++ .../scripts/run_deepseek_v32.py/prepare.txt | 36 ++++ .../run_deepseek_v32.py/prepare_cp.txt | 7 + .../prepare_megatron_ckpt.txt | 14 ++ .../py/scripts/run_deepseek_v32.py/train.txt | 98 +++++++++++ .../scripts/run_deepseek_v4.py/full_train.txt | 164 ++++++++++++++++++ .../scripts/run_deepseek_v4.py/prepare_cp.txt | 7 + .../run_deepseek_v4.py/prepare_download.txt | 16 ++ .../run_deepseek_v4.py/prepare_mxfp8.txt | 0 .../run_deepseek_v4.py/prepare_single.txt | 14 ++ .../run_deepseek_v4.py/prepare_spmd.txt | 10 ++ .../py/scripts/run_deepseek_v4.py/train.txt | 121 +++++++++++++ .../run_gemma_4_26b_a4b.py/full_train.txt | 102 +++++++++++ .../run_gemma_4_26b_a4b.py/prepare.txt | 11 ++ .../scripts/run_gemma_4_26b_a4b.py/train.txt | 90 ++++++++++ .../scripts/run_gemma_4_31b.py/full_train.txt | 98 +++++++++++ .../py/scripts/run_gemma_4_31b.py/prepare.txt | 11 ++ .../py/scripts/run_gemma_4_31b.py/train.txt | 86 +++++++++ .../scripts/run_glm45_355b_a32b.py/train.txt | 133 ++++++++++++++ .../py/scripts/run_glm47_flash.py/execute.txt | 91 ++++++++++ .../py/scripts/run_glm47_flash.py/prepare.txt | 22 +++ .../full_train.txt | 114 ++++++++++++ .../run_glm5_1_744b_a40b_lora.py/prepare.txt | 11 ++ .../run_glm5_1_744b_a40b_lora.py/train.txt | 102 +++++++++++ .../run_glm5_2_744b_a40b.py/full_train.txt | 133 ++++++++++++++ .../run_glm5_2_744b_a40b.py/prepare.txt | 27 +++ .../run_glm5_2_744b_a40b.py/prepare_cp.txt | 7 + .../scripts/run_glm5_2_744b_a40b.py/train.txt | 97 +++++++++++ .../full_train.txt | 114 ++++++++++++ .../run_glm5_2_744b_a40b_lora.py/prepare.txt | 11 ++ .../run_glm5_2_744b_a40b_lora.py/train.txt | 102 +++++++++++ .../run_glm5_744b_a40b.py/full_train.txt | 132 ++++++++++++++ .../scripts/run_glm5_744b_a40b.py/prepare.txt | 26 +++ .../run_glm5_744b_a40b.py/prepare_cp.txt | 7 + .../scripts/run_glm5_744b_a40b.py/train.txt | 97 +++++++++++ .../py/scripts/run_inkling.py/full_train.txt | 92 ++++++++++ .../py/scripts/run_inkling.py/prepare_cp.txt | 3 + .../py/scripts/run_inkling.py/train.txt | 92 ++++++++++ .../run_joy_ai_llm_flash.py/execute.txt | 81 +++++++++ .../run_joy_ai_llm_flash.py/prepare.txt | 22 +++ .../py/scripts/run_kimi_k25.py/full_train.txt | 105 +++++++++++ .../py/scripts/run_kimi_k25.py/prepare.txt | 16 ++ .../py/scripts/run_kimi_k25.py/train.txt | 88 ++++++++++ .../py/scripts/run_mcore_fsdp.py/execute.txt | 74 ++++++++ .../py/scripts/run_mcore_fsdp.py/prepare.txt | 26 +++ .../execute.txt | 70 ++++++++ .../prepare.txt | 16 ++ .../full_train.txt | 96 ++++++++++ .../prepare.txt | 11 ++ .../train.txt | 84 +++++++++ .../run_qwen3_0_6b_fsdp.py/execute.txt | 72 ++++++++ .../run_qwen3_0_6b_fsdp.py/prepare.txt | 16 ++ .../scripts/run_qwen3_30b_a3b.py/execute.txt | 89 ++++++++++ .../scripts/run_qwen3_30b_a3b.py/prepare.txt | 22 +++ .../run_qwen3_30b_a3b_fsdp.py/execute.txt | 73 ++++++++ .../run_qwen3_30b_a3b_fsdp.py/prepare.txt | 16 ++ .../py/scripts/run_qwen3_4b.py/execute.txt | 88 ++++++++++ .../py/scripts/run_qwen3_4b.py/prepare.txt | 22 +++ .../full_train.txt | 93 ++++++++++ .../run_qwen3_5_35b_a3b_lora.py/prepare.txt | 11 ++ .../run_qwen3_5_35b_a3b_lora.py/train.txt | 81 +++++++++ .../execute.txt | 91 ++++++++++ .../prepare.txt | 22 +++ .../run_qwen3_6_35b_a3b_mtp.py/execute.txt | 84 +++++++++ .../run_qwen3_6_35b_a3b_mtp.py/prepare.txt | 22 +++ 79 files changed, 4821 insertions(+), 4 deletions(-) create mode 100644 tests/fast/launch_scripts/py_harness.py create mode 100644 tests/fast/launch_scripts/test_py_launch_scripts.py create mode 100644 tests/fast/utils/command_recorder.py create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_download.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_single.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_download.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_mxfp8.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_single.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt create mode 100644 tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt diff --git a/tests/fast/launch_scripts/py_harness.py b/tests/fast/launch_scripts/py_harness.py new file mode 100644 index 0000000000..661ce00086 --- /dev/null +++ b/tests/fast/launch_scripts/py_harness.py @@ -0,0 +1,151 @@ +import ast +import importlib.util +import inspect +import re +import sys +from collections.abc import Iterator +from contextlib import contextmanager +from dataclasses import dataclass +from pathlib import Path +from types import ModuleType + +from tests.fast.launch_scripts.sh_harness import REPO_ROOT, sanitize +from tests.fast.utils.command_recorder import record_commands + +import miles.utils.external_utils.command_utils as command_utils + +FROZEN_RUN_ID = "260101-000000-000" + +_FROZEN_ENV = { + "MASTER_ADDR": "127.0.0.1", + "MILES_SCRIPT_ENABLE_RAY_SUBMIT": "1", + "PYTHONPATH": "/frozen/pythonpath", + "WANDB_API_KEY": "frozen-wandb-api-key", +} + +_CLEARED_ENV = ( + "CUDA_VISIBLE_DEVICES", + "GITHUB_COMMIT_NAME", + "GLOO_SOCKET_IFNAME", + "KEEP_MOE_LORA", + "MILES_SCRIPT_EXTERNAL_RAY", + "NCCL_DEBUG", + "NCCL_DEBUG_FILE", + "NCCL_NVLS_ENABLE", + "NCCL_SOCKET_IFNAME", + "NO_PROXY", + "OPTIMIZER_CPU_OFFLOAD", + "RAY_ADDRESS", + "SLURM_JOB_NUM_NODES", +) + + +@dataclass(frozen=True) +class Recording: + commands: list[str] + pseudo_files: list[str] + + +@dataclass(frozen=True) +class PyLaunchScript: + path: Path + entrypoints: tuple[str, ...] + + @property + def rel(self) -> str: + return self.path.relative_to(REPO_ROOT).as_posix() + + +def iter_py_launch_scripts() -> list[PyLaunchScript]: + paths = sorted((REPO_ROOT / "scripts").rglob("run_*.py")) + return [PyLaunchScript(path=path, entrypoints=tuple(_entrypoint_names(path))) for path in paths] + + +def freeze_environment(monkeypatch) -> None: + for key, value in _FROZEN_ENV.items(): + monkeypatch.setenv(key, value) + for key in _CLEARED_ENV: + monkeypatch.delenv(key, raising=False) + + +def install_command_recorder(monkeypatch) -> Recording: + recording = Recording(commands=record_commands(monkeypatch), pseudo_files=[]) + + def fake_save_to_temp_file(text: str, ext: str) -> str: + recording.pseudo_files.append(text) + return f"/frozen/pseudo_file_{len(recording.pseudo_files)}.{ext}" + + monkeypatch.setattr(command_utils, "create_run_id", lambda: FROZEN_RUN_ID) + monkeypatch.setattr(command_utils, "save_to_temp_file", fake_save_to_temp_file) + + return recording + + +def import_launch_script(path: Path) -> ModuleType: + name = "miles_launch_script_" + path.relative_to(REPO_ROOT).with_suffix("").as_posix().replace("/", "_") + spec = importlib.util.spec_from_file_location(name, path) + assert spec is not None and spec.loader is not None + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + try: + spec.loader.exec_module(module) + finally: + del sys.modules[name] + return module + + +@contextmanager +def host_filesystem_frozen(sandbox: Path) -> Iterator[None]: + """Launchers skip work whose artifact already exists, so only the checkout and the sandbox may be visible. + + Without this the recording depends on which checkpoints the machine happens to carry, and on + python 3.11 a `/root` path the user cannot stat raises PermissionError instead of reporting + absence. The checkout stays visible because a launcher legitimately resolves its own model args + script out of it. + """ + visible_roots = (sandbox, REPO_ROOT) + real_exists = Path.exists + + def exists(self: Path, **kwargs: object) -> bool: + if any(self == root or self.is_relative_to(root) for root in visible_roots): + return real_exists(self, **kwargs) + return False + + Path.exists = exists + try: + yield + finally: + Path.exists = real_exists + + +def call_entrypoint(module: ModuleType, name: str, overrides: dict[str, object], sandbox: Path) -> None: + entrypoint = getattr(module, name) + first = next(iter(inspect.signature(entrypoint).parameters.values()), None) + with host_filesystem_frozen(sandbox): + if first is not None and first.name == "args": + entrypoint(module.ScriptArgs(**overrides)) + else: + entrypoint(**overrides) + + +def format_recording(recording: Recording, sandbox: Path) -> str: + """The generated config files are the training recipe, so a snapshot that omits them proves little.""" + lines = [] + for index, command in enumerate(recording.commands): + lines.append(f"### {index}") + lines.append(re.sub(r" (?=--)", "\n ", sanitize(command, sandbox=sandbox))) + lines.append("") + for index, content in enumerate(recording.pseudo_files, start=1): + lines.append(f"### pseudo file {index}") + lines.append(sanitize(content, sandbox=sandbox)) + lines.append("") + return "\n".join(lines) + + +def _entrypoint_names(path: Path) -> list[str]: + tree = ast.parse(path.read_text()) + return [ + node.name + for node in tree.body + if isinstance(node, ast.FunctionDef) and not node.name.startswith("_") and node.name != "main" + ] diff --git a/tests/fast/launch_scripts/sh_harness.py b/tests/fast/launch_scripts/sh_harness.py index 11bf959fb5..c3069e8f70 100644 --- a/tests/fast/launch_scripts/sh_harness.py +++ b/tests/fast/launch_scripts/sh_harness.py @@ -163,8 +163,8 @@ def run_launch_script( return LaunchScriptRun( invocations=invocations, - stdout=_sanitize(stdout, sandbox=sandbox), - stderr=_sanitize(stderr, sandbox=sandbox), + stdout=sanitize(stdout, sandbox=sandbox), + stderr=sanitize(stderr, sandbox=sandbox), returncode=process.returncode, ) @@ -241,8 +241,8 @@ def _parse_capture(raw: str, sandbox: Path) -> list[list[str]]: """Order by pid, not by append order: a `&` child appends whenever it gets scheduled.""" records = [record.split(_ARG_SEPARATOR) for record in raw.split(_RECORD_SEPARATOR) if record != ""] records.sort(key=lambda record: int(record[0])) - return [[_sanitize(arg, sandbox=sandbox) for arg in record[1:]] for record in records] + return [[sanitize(arg, sandbox=sandbox) for arg in record[1:]] for record in records] -def _sanitize(text: str, sandbox: Path) -> str: +def sanitize(text: str, sandbox: Path) -> str: return text.replace(str(sandbox), SANDBOX_PLACEHOLDER).replace(str(REPO_ROOT), REPO_ROOT_PLACEHOLDER) diff --git a/tests/fast/launch_scripts/test_py_launch_scripts.py b/tests/fast/launch_scripts/test_py_launch_scripts.py new file mode 100644 index 0000000000..ee8ae09ab9 --- /dev/null +++ b/tests/fast/launch_scripts/test_py_launch_scripts.py @@ -0,0 +1,154 @@ +import json +from collections.abc import Callable +from pathlib import Path + +import pytest + +from tests.fast.launch_scripts.py_harness import ( + call_entrypoint, + format_recording, + freeze_environment, + host_filesystem_frozen, + import_launch_script, + install_command_recorder, + iter_py_launch_scripts, +) +from tests.fast.launch_scripts.sh_harness import REPO_ROOT, assert_matches_snapshot + +_SNAPSHOT_DIR = REPO_ROOT / "tests" / "snapshots" / "launch_scripts" / "py" + +_SCRIPTS_IMPORTABLE_ONLY_UNDER_THE_NPU_PATCH = {"scripts/run_qwen3_4b_npu.py"} + + +def _glm_checkpoint(sandbox: Path, model_name: str, num_layers: int) -> dict[str, object]: + model_dir = sandbox / "models" + (model_dir / model_name).mkdir(parents=True) + (model_dir / model_name / "config.json").write_text( + json.dumps( + { + "model_type": "glm_moe_dsa", + "architectures": ["GlmMoeDsaForCausalLM"], + "num_hidden_layers": num_layers, + } + ) + ) + return {"model_dir": str(model_dir)} + + +def _nemotron_checkpoint(sandbox: Path) -> dict[str, object]: + model_dir = sandbox / "models" + checkpoint = model_dir / "NVIDIA-Nemotron-3-Nano-4B-BF16" + checkpoint.mkdir(parents=True) + (checkpoint / "config.json").write_text( + json.dumps( + { + "model_type": "nemotron_h", + "auto_map": {"AutoConfig": "configuration_nemotron_h.NemotronHConfig"}, + } + ) + ) + return {"model_dir": str(model_dir)} + + +_SCRIPTS_WHOSE_DEFAULTS_ARE_UNSUPPORTED: dict[str, Callable[[Path], dict[str, object]]] = { + "scripts/run_deepseek_v4.py": lambda sandbox: {"model_name": "DeepSeek-V4-Flash-FP8-4layer"}, + "scripts/run_glm45_355b_a32b.py": lambda sandbox: {"hardware": "GB200"}, + "scripts/run_glm5_744b_a40b.py": lambda sandbox: _glm_checkpoint(sandbox, "GLM-5", 78), + "scripts/run_glm5_2_744b_a40b.py": lambda sandbox: _glm_checkpoint(sandbox, "GLM-5.2", 78), + "scripts/run_inkling.py": lambda sandbox: {"model_name": "Inkling-4layer"}, + "scripts/run_nemotron_3_nano_4b_fsdp.py": _nemotron_checkpoint, + "scripts/run_nemotron_3_ultra_550b_a55b.py": lambda sandbox: { + "model_name": "NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer" + }, +} + +_ENTRYPOINTS_DISABLED_BY_THEIR_OWN_DEFAULTS = {("scripts/run_deepseek_v4.py", "prepare_mxfp8")} + +_SCRIPTS = [ + script for script in iter_py_launch_scripts() if script.rel not in _SCRIPTS_IMPORTABLE_ONLY_UNDER_THE_NPU_PATCH +] +_CASES = [(script.rel, entrypoint) for script in _SCRIPTS for entrypoint in script.entrypoints] + + +@pytest.fixture(params=_CASES, ids=[f"{rel}::{entrypoint}" for rel, entrypoint in _CASES]) +def recorded(request, monkeypatch, tmp_path): + rel, entrypoint = request.param + freeze_environment(monkeypatch) + recording = install_command_recorder(monkeypatch) + module = import_launch_script(REPO_ROOT / rel) + call_entrypoint( + module, + entrypoint, + _SCRIPTS_WHOSE_DEFAULTS_ARE_UNSUPPORTED.get(rel, lambda sandbox: {})(tmp_path), + sandbox=tmp_path, + ) + return rel, entrypoint, recording, tmp_path + + +class TestEveryLauncherEntrypoint: + def test_commands_match_snapshot(self, recorded): + """Every launcher entrypoint must build exactly the recorded shell commands.""" + rel, entrypoint, recording, sandbox = recorded + snapshot = _SNAPSHOT_DIR / rel / f"{entrypoint}.txt" + + assert_matches_snapshot(snapshot, format_recording(recording, sandbox=sandbox), f"{rel}::{entrypoint}") + + def test_entrypoint_issues_commands(self, recorded): + """An entrypoint that silently does nothing is a broken launcher, not a passing test.""" + rel, entrypoint, recording, _ = recorded + if (rel, entrypoint) in _ENTRYPOINTS_DISABLED_BY_THEIR_OWN_DEFAULTS: + assert not recording.commands + else: + assert recording.commands + + +class TestHostFilesystemIsFrozen: + def test_paths_outside_the_checkout_and_the_sandbox_report_absence(self, tmp_path): + """A launcher that can see the host's checkpoints skips work, so the snapshot would follow the machine.""" + inside = tmp_path / "checkpoint.json" + inside.write_text("{}") + + with host_filesystem_frozen(tmp_path): + assert inside.exists() + assert not Path("/root/models/some-checkpoint/model.safetensors.index.json").exists() + + def test_the_checkout_stays_visible(self, tmp_path): + """A launcher resolves its own model args script out of the checkout, so hiding it breaks every launcher.""" + with host_filesystem_frozen(tmp_path): + assert (REPO_ROOT / "pyproject.toml").exists() + assert (REPO_ROOT / "scripts" / "models").exists() + + def test_an_unreadable_parent_reports_absence_instead_of_raising(self, tmp_path): + """python 3.11 raises PermissionError from exists(), which is how the CPU runner's /root broke this.""" + unreadable = tmp_path / "unreadable" + unreadable.mkdir() + unreadable.chmod(0o000) + try: + with host_filesystem_frozen(tmp_path / "sandbox"): + assert not (unreadable / "model.safetensors.index.json").exists() + finally: + unreadable.chmod(0o700) + + +class TestDiscovery: + def test_all_py_launch_scripts_are_discovered(self): + """Guards against the discovery glob silently going empty.""" + assert len(_SCRIPTS) > 15 + + def test_every_discovered_launcher_is_covered_except_the_one_this_checkout_cannot_import(self): + """A denylist that nobody rechecks only grows; name the survivors so the count cannot drift.""" + discovered = {script.rel for script in iter_py_launch_scripts()} + + assert discovered - {script.rel for script in _SCRIPTS} == _SCRIPTS_IMPORTABLE_ONLY_UNDER_THE_NPU_PATCH + + @pytest.mark.parametrize("rel", sorted(_SCRIPTS_IMPORTABLE_ONLY_UNDER_THE_NPU_PATCH)) + def test_the_uncovered_launcher_really_is_uncoverable_here(self, rel): + """Once the NPU patch is upstreamed this fails, forcing the exclusion out instead of letting it rot.""" + with pytest.raises(ImportError, match="execute_train_npu"): + import_launch_script(REPO_ROOT / rel) + + def test_execute_train_config_defaults_are_not_taken_from_a_slurm_allocation(self, monkeypatch): + """SLURM_JOB_NUM_NODES is read at import time, so a stale allocation would skew every snapshot.""" + import miles.utils.external_utils.command_utils as command_utils + + assert command_utils.ExecuteTrainConfig().num_nodes == 1 diff --git a/tests/fast/utils/command_recorder.py b/tests/fast/utils/command_recorder.py new file mode 100644 index 0000000000..1746f16db2 --- /dev/null +++ b/tests/fast/utils/command_recorder.py @@ -0,0 +1,23 @@ +import miles.utils.external_utils.command_utils as command_utils +import miles.utils.misc as misc + + +def record_commands(monkeypatch) -> list[str]: + """Replace every command-executing helper with a recorder and return the list it appends to.""" + commands: list[str] = [] + + def fake_exec_command(cmd: str, capture_output: bool = False) -> str | None: + commands.append(cmd) + return "0" if capture_output else None + + def fake_exec_command_all_ray_node( + cmd: str, capture_output: bool = False, num_nodes: int | None = None + ) -> list[str | None]: + commands.append(f"[all_ray_node num_nodes={num_nodes}] {cmd}") + return ["0"] + + for module in (command_utils, misc): + monkeypatch.setattr(module, "exec_command", fake_exec_command, raising=False) + monkeypatch.setattr(module, "exec_command_all_ray_node", fake_exec_command_all_ray_node, raising=False) + + return commands diff --git a/tests/snapshots/README.md b/tests/snapshots/README.md index 3e181c7373..ceb20f2f83 100644 --- a/tests/snapshots/README.md +++ b/tests/snapshots/README.md @@ -6,6 +6,7 @@ generated: never edit a file by hand, regenerate it and review the diff. | Directory | Produced by | Contains | | --- | --- | --- | | `launch_scripts/sh/` | `tests/fast/launch_scripts/test_sh_launch_scripts.py` | every external command each `scripts/**.sh` and `examples/**.sh` launcher issues, including the full `ray job submit` argv | +| `launch_scripts/py/` | `tests/fast/launch_scripts/test_py_launch_scripts.py` | every shell command each `scripts/run_*.py` entrypoint builds | Regenerate after an intentional change: diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt new file mode 100644 index 0000000000..c12b362f2c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt @@ -0,0 +1,152 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download sgl-project/DeepSeek-V4-Flash-FP8 + --local-dir /root/models/DeepSeek-V4-Flash-FP8 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 5 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 6 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V4-Flash-FP8 + --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-bf16/ + +### 7 +source /scripts/models/deepseek-v4-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-bf16 + --save /root/models/DeepSeek-V4-Flash-FP8_torch_dist + --expert-tensor-parallel-size 1 + --context-parallel-size 1 + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 8 + +### 8 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 9 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 10 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 11 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HACK_FLASHMLA_BACKEND": "unified_kv_triton", "SGLANG_OPT_USE_COMPRESSOR_V2": "true", "SGLANG_OPT_USE_TILELANG_INDEXER": "true", "SGLANG_OPT_USE_JIT_NORM": "true", "SGLANG_OPT_USE_FUSED_COMPRESS": "true", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "AITER_BF16_FP8_MOE_BOUND": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8 + --ref-load /root/models/DeepSeek-V4-Flash-FP8_torch_dist + --load /root/models/260101-000000-000/checkpoints + --save /root/models/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-temperature 0.8 + --num-steps-per-rollout 1 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 8192 + --apply-chat-template-kwargs '{"thinking_mode":"thinking"}' + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --use-precision-aware-optimizer + --overlap-cpu-optimizer-d2h-h2d + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v4 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --max-tokens-per-gpu 2048 + --eval-interval 20 + --eval-top-p 0.7 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 4096 + --rollout-num-gpus-per-engine 4 + --sglang-tp-size 4 + --sglang-dp-size 1 + --sglang-ep-size 4 + --router-health-success-threshold 1 + --router-health-check-interval-secs 15 + --router-health-failure-threshold 40 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --update-weight-buffer-size 1073741824 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --train-memory-margin-bytes 3221225472 + --sglang-mem-fraction-static 0.5 + --sglang-watchdog-timeout 1800 + --accumulate-allreduce-grads-in-fp32 + --model-name deepseekv4 + --qkv-format bshd + --moe-router-freeze-gate + --freeze-e-score-correction-bias + --rollout-health-check-interval 300 + --rollout-health-check-timeout 300 + --colocate + --use-fault-tolerance + --use-rollout-routing-replay + --deterministic-mode + --transformer-impl transformer_engine + --bf16 + --fp8-format e4m3 + --fp8-recipe blockwise + --train-env-vars '{"NVTE_FP8_BLOCK_SCALING_FP32_SCALES":"1"}' + --no-gradient-accumulation-fusion diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt new file mode 100644 index 0000000000..837cbaa156 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt @@ -0,0 +1,7 @@ +### 0 +[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8_torch_dist && rsync -a + --info=progress2 /root/models/DeepSeek-V4-Flash-FP8_torch_dist/ /root/models/DeepSeek-V4-Flash-FP8_torch_dist + +### 1 +[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8 && rsync -a + --info=progress2 /root/models/DeepSeek-V4-Flash-FP8/ /root/models/DeepSeek-V4-Flash-FP8 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_download.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_download.txt new file mode 100644 index 0000000000..ea690c600b --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_download.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download sgl-project/DeepSeek-V4-Flash-FP8 + --local-dir /root/models/DeepSeek-V4-Flash-FP8 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_single.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_single.txt new file mode 100644 index 0000000000..72f28a464c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_single.txt @@ -0,0 +1,14 @@ +### 0 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 1 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 2 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V4-Flash-FP8 + --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-bf16/ diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt new file mode 100644 index 0000000000..d8521befd5 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt @@ -0,0 +1,10 @@ +### 0 +source /scripts/models/deepseek-v4-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-bf16 + --save /root/models/DeepSeek-V4-Flash-FP8_torch_dist + --expert-tensor-parallel-size 1 + --context-parallel-size 1 + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt new file mode 100644 index 0000000000..bab1b53696 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt @@ -0,0 +1,109 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HACK_FLASHMLA_BACKEND": "unified_kv_triton", "SGLANG_OPT_USE_COMPRESSOR_V2": "true", "SGLANG_OPT_USE_TILELANG_INDEXER": "true", "SGLANG_OPT_USE_JIT_NORM": "true", "SGLANG_OPT_USE_FUSED_COMPRESS": "true", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "AITER_BF16_FP8_MOE_BOUND": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint None + --ref-load /root/models/DeepSeek-V4-Flash-FP8_torch_dist + --load /root/models/260101-000000-000/checkpoints + --save /root/models/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-temperature 0.8 + --num-steps-per-rollout 1 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 8192 + --apply-chat-template-kwargs '{"thinking_mode":"thinking"}' + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --use-precision-aware-optimizer + --overlap-cpu-optimizer-d2h-h2d + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v4 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --max-tokens-per-gpu 2048 + --eval-interval 20 + --eval-top-p 0.7 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 4096 + --rollout-num-gpus-per-engine 4 + --sglang-tp-size 4 + --sglang-dp-size 1 + --sglang-ep-size 4 + --router-health-success-threshold 1 + --router-health-check-interval-secs 15 + --router-health-failure-threshold 40 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --update-weight-buffer-size 1073741824 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --train-memory-margin-bytes 3221225472 + --sglang-mem-fraction-static 0.5 + --sglang-watchdog-timeout 1800 + --accumulate-allreduce-grads-in-fp32 + --model-name deepseekv4 + --qkv-format bshd + --moe-router-freeze-gate + --freeze-e-score-correction-bias + --rollout-health-check-interval 300 + --rollout-health-check-timeout 300 + --colocate + --use-fault-tolerance + --use-rollout-routing-replay + --deterministic-mode + --transformer-impl transformer_engine + --bf16 + --fp8-format e4m3 + --fp8-recipe blockwise + --train-env-vars '{"NVTE_FP8_BLOCK_SCALING_FP32_SCALES":"1"}' + --no-gradient-accumulation-fusion diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt new file mode 100644 index 0000000000..16cf596613 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt @@ -0,0 +1,90 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B/ + --ref-load /root/models/Qwen3-30B-A3B_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_qwen3_30b_a3b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --tensor-model-parallel-size 1 + --sequence-parallel + --pipeline-model-parallel-size 2 + --context-parallel-size 2 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --max-tokens-per-gpu 16384 + --eval-interval 20 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 1 + --rollout-num-gpus-per-engine 2 + --sglang-mem-fraction-static 0.7 + --sglang-max-running-requests 512 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt new file mode 100644 index 0000000000..76254f6091 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Qwen/Qwen3-30B-A3B + --local-dir /root/models/Qwen3-30B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/qwen3-30B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B + --save /root/models/Qwen3-30B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt new file mode 100644 index 0000000000..8cff96ff4c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt @@ -0,0 +1,144 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download deepseek-ai/DeepSeek-V3 + --local-dir /root/models/DeepSeek-V3 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V3 + --output-bf16-hf-path /root/models/DeepSeek-V3-bf16/ + +### 5 +[all_ray_node num_nodes=None] source /scripts/models/deepseek-v3.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3-bf16 + --save /root/models/DeepSeek-V3_torch_dist + --tensor-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --pipeline-model-parallel-size 8 + --expert-model-parallel-size 4 + --decoder-first-pipeline-num-layers 7 + --decoder-last-pipeline-num-layers 6 + +### 6 +[all_ray_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3_torch_dist && rsync -a + --info=progress2 /root/models/DeepSeek-V3_torch_dist/ /root/local_data/DeepSeek-V3_torch_dist + +### 7 +[all_ray_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3 && rsync -a + --info=progress2 /root/models/DeepSeek-V3/ /root/local_data/DeepSeek-V3 + +### 8 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 9 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 10 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 11 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v3.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/local_data/DeepSeek-V3 + --ref-load /root/local_data/DeepSeek-V3_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 128 + --n-samples-per-prompt 8 + --rollout-temperature 1 + --num-steps-per-rollout 4 + --balance-data + --over-sampling-batch-size 256 + --dynamic-sampling-filter-path miles.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 32768 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 1 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 4 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --eval-interval 20 + --eval-top-p 1 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 32768 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.7 + --sglang-tp-size 4 + --sglang-ep-size 4 + --sglang-enable-dp-attention + --sglang-dp-size 1 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-moe-a2a-backend deepep + --sglang-deepep-mode low_latency + --sglang-server-concurrency 1024 + --sglang-max-running-requests 256 + --sglang-chunked-prefill-size 1024 + --sglang-cuda-graph-max-bs 256 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --update-weight-buffer-size 4294967296 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt new file mode 100644 index 0000000000..aaedbcbade --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt @@ -0,0 +1,135 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download deepseek-ai/DeepSeek-V3.2 + --local-dir /root/models/DeepSeek-V3.2 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V3.2 + --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ + +### 5 +[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 + --save /root/models/DeepSeek-V3.2_torch_dist + --tensor-model-parallel-size 4 + --expert-model-parallel-size 16 + --pipeline-model-parallel-size 6 + --decoder-last-pipeline-num-layers 13 + --expert-tensor-parallel-size 1 + +### 6 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 7 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 8 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 9 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v32.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_NSA_FORCE_MLA": "1", "SGLANG_NSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3.2/ + --ref-load /root/models/DeepSeek-V3.2_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v32 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 4 + --decoder-last-pipeline-num-layers 13 + --context-parallel-size 1 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --sglang-mem-fraction-static 0.8 + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-kv-cache-dtype bf16 + --sglang-page-size 64 + --rollout-num-gpus-per-engine 8 + --sglang-moe-runner-backend flashinfer_trtllm_routed + --sglang-tp-size 8 + --sglang-dp-size 8 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-cuda-graph-max-bs 256 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes None + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --rollout-num-gpus None + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt new file mode 100644 index 0000000000..1e98750b4f --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt @@ -0,0 +1,36 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download deepseek-ai/DeepSeek-V3.2 + --local-dir /root/models/DeepSeek-V3.2 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V3.2 + --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ + +### 5 +[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 + --save /root/models/DeepSeek-V3.2_torch_dist + --tensor-model-parallel-size 4 + --expert-model-parallel-size 16 + --pipeline-model-parallel-size 6 + --decoder-last-pipeline-num-layers 13 + --expert-tensor-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt new file mode 100644 index 0000000000..4f8b361312 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt @@ -0,0 +1,7 @@ +### 0 +[all_ray_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2_torch_dist && rsync -a + --info=progress2 /root/models/DeepSeek-V3.2_torch_dist/ /root/models/DeepSeek-V3.2_torch_dist + +### 1 +[all_ray_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2 && rsync -a + --info=progress2 /root/models/DeepSeek-V3.2/ /root/models/DeepSeek-V3.2 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt new file mode 100644 index 0000000000..43bf5f5aaa --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt @@ -0,0 +1,14 @@ +### 0 +[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 + --save /root/models/DeepSeek-V3.2_torch_dist + --tensor-model-parallel-size 4 + --expert-model-parallel-size 16 + --pipeline-model-parallel-size 6 + --decoder-last-pipeline-num-layers 13 + --expert-tensor-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt new file mode 100644 index 0000000000..4e459895d3 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt @@ -0,0 +1,98 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v32.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_NSA_FORCE_MLA": "1", "SGLANG_NSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V3.2/ + --ref-load /root/models/DeepSeek-V3.2_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v32 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 4 + --decoder-last-pipeline-num-layers 13 + --context-parallel-size 1 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --sglang-mem-fraction-static 0.8 + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-kv-cache-dtype bf16 + --sglang-page-size 64 + --rollout-num-gpus-per-engine 8 + --sglang-moe-runner-backend flashinfer_trtllm_routed + --sglang-tp-size 8 + --sglang-dp-size 8 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-cuda-graph-max-bs 256 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes None + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --rollout-num-gpus None + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt new file mode 100644 index 0000000000..529be32c53 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt @@ -0,0 +1,164 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Pinaster/DeepSeek-V4-Flash-FP8-4layer + --local-dir /root/models/DeepSeek-V4-Flash-FP8-4layer + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 5 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 6 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V4-Flash-FP8-4layer + --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16/ + +### 7 +source /scripts/models/deepseek-v4-flash-4layer.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16 + --save /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist + --expert-tensor-parallel-size 1 + --context-parallel-size 1 + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 1 + +### 8 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 9 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 10 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 11 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash-4layer.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "SGLANG_DG_CACHE_DIR_PER_PROCESS": "1", "SGLANG_OPT_FP8_WO_A_GEMM": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer + --ref-load /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist + --load /root/models/260101-000000-000/checkpoints + --save /root/models/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-temperature 0.8 + --num-steps-per-rollout 1 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 4096 + --apply-chat-template-kwargs '{"thinking_mode":"thinking"}' + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --use-precision-aware-optimizer + --overlap-cpu-optimizer-d2h-h2d + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v4 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --max-tokens-per-gpu 2048 + --eval-interval 20 + --eval-top-p 0.7 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 4096 + --rollout-num-gpus-per-engine 4 + --sglang-fp8-gemm-backend auto + --sglang-moe-runner-backend auto + --sglang-tp-size 4 + --sglang-dp-size 1 + --sglang-ep-size 4 + --router-health-success-threshold 1 + --router-health-check-interval-secs 15 + --router-health-failure-threshold 40 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --update-weight-buffer-size 1073741824 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --train-memory-margin-bytes 3221225472 + --sglang-mem-fraction-static 0.7 + --accumulate-allreduce-grads-in-fp32 + --model-name deepseekv4 + --qkv-format bshd + --moe-router-freeze-gate + --freeze-e-score-correction-bias + --rollout-health-check-interval 300 + --rollout-health-check-timeout 300 + --colocate + --use-fault-tolerance + --use-rollout-routing-replay + --deterministic-mode + --transformer-impl transformer_engine + --bf16 + --fp8-format e4m3 + --fp8-recipe blockwise + --te-precision-config-file /frozen/pseudo_file_1.yaml + +### pseudo file 1 +configs: + bf16: + transformer_engine_config_type: "TEQuantizationParams" + training_recipe: {} +matchers: + dsa_indexer_weights_proj_bf16: + type: "glob" + enabled: true + pattern: "*.self_attention.indexer.linear_weights_proj" + config: "bf16" diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt new file mode 100644 index 0000000000..da0a706663 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt @@ -0,0 +1,7 @@ +### 0 +[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist && rsync -a + --info=progress2 /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist/ /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist + +### 1 +[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer && rsync -a + --info=progress2 /root/models/DeepSeek-V4-Flash-FP8-4layer/ /root/models/DeepSeek-V4-Flash-FP8-4layer diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_download.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_download.txt new file mode 100644 index 0000000000..db9ae58d7e --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_download.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Pinaster/DeepSeek-V4-Flash-FP8-4layer + --local-dir /root/models/DeepSeek-V4-Flash-FP8-4layer + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_mxfp8.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_mxfp8.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_single.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_single.txt new file mode 100644 index 0000000000..0ab5ff31d9 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_single.txt @@ -0,0 +1,14 @@ +### 0 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 1 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 2 +python /tools/fp8_cast_bf16.py + --input-fp8-hf-path /root/models/DeepSeek-V4-Flash-FP8-4layer + --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16/ diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt new file mode 100644 index 0000000000..7c23cc53bc --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt @@ -0,0 +1,10 @@ +### 0 +source /scripts/models/deepseek-v4-flash-4layer.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16 + --save /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist + --expert-tensor-parallel-size 1 + --context-parallel-size 1 + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt new file mode 100644 index 0000000000..f1b2b1c74b --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt @@ -0,0 +1,121 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash-4layer.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "SGLANG_DG_CACHE_DIR_PER_PROCESS": "1", "SGLANG_OPT_FP8_WO_A_GEMM": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer + --ref-load /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist + --load /root/models/260101-000000-000/checkpoints + --save /root/models/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-temperature 0.8 + --num-steps-per-rollout 1 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 4096 + --apply-chat-template-kwargs '{"thinking_mode":"thinking"}' + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --use-precision-aware-optimizer + --overlap-cpu-optimizer-d2h-h2d + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_deepseek_v4 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --max-tokens-per-gpu 2048 + --eval-interval 20 + --eval-top-p 0.7 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 4096 + --rollout-num-gpus-per-engine 4 + --sglang-fp8-gemm-backend auto + --sglang-moe-runner-backend auto + --sglang-tp-size 4 + --sglang-dp-size 1 + --sglang-ep-size 4 + --router-health-success-threshold 1 + --router-health-check-interval-secs 15 + --router-health-failure-threshold 40 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --update-weight-buffer-size 1073741824 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --train-memory-margin-bytes 3221225472 + --sglang-mem-fraction-static 0.7 + --accumulate-allreduce-grads-in-fp32 + --model-name deepseekv4 + --qkv-format bshd + --moe-router-freeze-gate + --freeze-e-score-correction-bias + --rollout-health-check-interval 300 + --rollout-health-check-timeout 300 + --colocate + --use-fault-tolerance + --use-rollout-routing-replay + --deterministic-mode + --transformer-impl transformer_engine + --bf16 + --fp8-format e4m3 + --fp8-recipe blockwise + --te-precision-config-file /frozen/pseudo_file_1.yaml + +### pseudo file 1 +configs: + bf16: + transformer_engine_config_type: "TEQuantizationParams" + training_recipe: {} +matchers: + dsa_indexer_weights_proj_bf16: + type: "glob" + enabled: true + pattern: "*.self_attention.indexer.linear_weights_proj" + config: "bf16" diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt new file mode 100644 index 0000000000..84324ace64 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt @@ -0,0 +1,102 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download google/gemma-4-26B-A4B-it + --local-dir /root/models/gemma-4-26B-A4B-it + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-26b-a4b-it.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/gemma-4-26B-A4B-it + --ref-load /root/models/gemma-4-26B-A4B-it + --megatron-to-hf-mode bridge + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type gemma_math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 256 + --rollout-temperature 1 + --global-batch-size 256 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_gemma_4_26b_a4b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.55 + --sglang-attention-backend triton + --sglang-moe-runner-backend triton + --sglang-disable-custom-all-reduce + --sglang-disable-cuda-graph + --sglang-disable-overlap-schedule + --sglang-disable-radix-cache + --no-offload-train + --no-offload-rollout + --use-rollout-routing-replay + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --no-gradient-accumulation-fusion + --no-check-for-nan-in-loss-and-grad + --attention-softmax-in-fp32 + --attention-backend unfused + --qkv-format bshd + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/prepare.txt new file mode 100644 index 0000000000..998cfec69d --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download google/gemma-4-26B-A4B-it + --local-dir /root/models/gemma-4-26B-A4B-it + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt new file mode 100644 index 0000000000..17e9602c44 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt @@ -0,0 +1,90 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-26b-a4b-it.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/gemma-4-26B-A4B-it + --ref-load /root/models/gemma-4-26B-A4B-it + --megatron-to-hf-mode bridge + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type gemma_math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 256 + --rollout-temperature 1 + --global-batch-size 256 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_gemma_4_26b_a4b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.55 + --sglang-attention-backend triton + --sglang-moe-runner-backend triton + --sglang-disable-custom-all-reduce + --sglang-disable-cuda-graph + --sglang-disable-overlap-schedule + --sglang-disable-radix-cache + --no-offload-train + --no-offload-rollout + --use-rollout-routing-replay + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --no-gradient-accumulation-fusion + --no-check-for-nan-in-loss-and-grad + --attention-softmax-in-fp32 + --attention-backend unfused + --qkv-format bshd + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt new file mode 100644 index 0000000000..e385bda2a6 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt @@ -0,0 +1,98 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download google/gemma-4-31B-it + --local-dir /root/models/gemma-4-31B-it + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-31b-it.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/gemma-4-31B-it + --ref-load /root/models/gemma-4-31B-it + --megatron-to-hf-mode bridge + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type gemma_math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 256 + --rollout-temperature 1 + --global-batch-size 256 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_gemma_4_31b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 512 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.5 + --sglang-attention-backend triton + --sglang-disable-custom-all-reduce + --sglang-disable-cuda-graph + --sglang-disable-overlap-schedule + --sglang-disable-radix-cache + --no-offload-train + --no-offload-rollout + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --no-gradient-accumulation-fusion + --no-check-for-nan-in-loss-and-grad + --attention-softmax-in-fp32 + --attention-backend unfused + --qkv-format bshd + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/prepare.txt new file mode 100644 index 0000000000..eebd5c6321 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download google/gemma-4-31B-it + --local-dir /root/models/gemma-4-31B-it + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt new file mode 100644 index 0000000000..58f0d09dbc --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt @@ -0,0 +1,86 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-31b-it.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/gemma-4-31B-it + --ref-load /root/models/gemma-4-31B-it + --megatron-to-hf-mode bridge + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type gemma_math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 256 + --rollout-temperature 1 + --global-batch-size 256 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_gemma_4_31b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 512 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.5 + --sglang-attention-backend triton + --sglang-disable-custom-all-reduce + --sglang-disable-cuda-graph + --sglang-disable-overlap-schedule + --sglang-disable-radix-cache + --no-offload-train + --no-offload-rollout + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --no-gradient-accumulation-fusion + --no-check-for-nan-in-loss-and-grad + --attention-softmax-in-fp32 + --attention-backend unfused + --qkv-format bshd + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt new file mode 100644 index 0000000000..b709dc8343 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt @@ -0,0 +1,133 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download zai-org/GLM-4.5 + --local-dir /root/models/GLM-4.5 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +hf download + --repo-type dataset zhuzilin/aime-2025 + --local-dir /root/datasets/aime-2025 + +### 5 +[all_ray_node num_nodes=None] source /scripts/models/glm4.5-355B-A32B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.5 + --save /root/models/GLM-4.5_torch_dist + +### 6 +[all_ray_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5_torch_dist && rsync -a + --info=progress2 /root/models/GLM-4.5_torch_dist/ /root/local_data/GLM-4.5_torch_dist + +### 7 +[all_ray_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5 && rsync -a + --info=progress2 /root/models/GLM-4.5/ /root/local_data/GLM-4.5 + +### 8 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 9 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 10 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 11 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm4.5-355B-A32B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/local_data/GLM-4.5 + --ref-load /root/local_data/GLM-4.5_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 10 + --save-retain-interval 10 + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-temperature 1 + --num-steps-per-rollout 1 + --balance-data + --rollout-stop-token-ids 151329 151336 151338 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --rollout-max-response-len 8192 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 1e-4 + --eps-clip-high 2e-4 + --use-tis + --use-wandb + --wandb-project miles-run_glm45_355b_a32b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 16384 + --eval-interval 20 + --eval-top-p 1 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 8 + --eval-max-response-len 8192 + --rollout-num-gpus-per-engine 4 + --sglang-mem-fraction-static 0.7 + --sglang-tp-size 4 + --sglang-chunked-prefill-size 8192 + --sglang-attention-backend trtllm_mha + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details + --router-health-success-threshold 1 + --router-health-check-interval-secs 15 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt new file mode 100644 index 0000000000..83666320ac --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt @@ -0,0 +1,91 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm4.7-flash.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.7-Flash + --ref-load /root/models/GLM-4.7-Flash_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_glm47_flash + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --eval-prompt-data aime24 /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-temperature 0.6 + --eval-top-p 0.95 + --rollout-num-gpus-per-engine 1 + --sglang-mem-fraction-static 0.7 + --sglang-speculative-algorithm EAGLE + --sglang-speculative-num-steps 2 + --sglang-speculative-eagle-topk 1 + --sglang-speculative-num-draft-tokens 3 + --use-rollout-routing-replay + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt new file mode 100644 index 0000000000..db4971d4a9 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download zai-org/GLM-4.7-Flash + --local-dir /root/models/GLM-4.7-Flash + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/glm4.7-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.7-Flash + --save /root/models/GLM-4.7-Flash_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt new file mode 100644 index 0000000000..95f8b536a2 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt @@ -0,0 +1,114 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download jybsuper/GLM-5.1-6layer + --local-dir /root/models/GLM-5.1-6layer + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.1-744B-A40B_6layer_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.1-6layer + --megatron-to-hf-mode bridge + --dsa-attention-backend tilelang + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj,q_a_proj,kv_a_proj_with_mqa,q_b_proj,kv_b_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 1 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 16 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-rollout-routing-replay + --use-wandb + --wandb-project miles-run_glm5_1_744b_a40b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --qkv-format thd + --micro-batch-size 1 + --rollout-num-gpus-per-engine 2 + --sglang-mem-fraction-static 0.5 + --sglang-enable-dp-attention + --sglang-ep-size 2 + --sglang-dp-size 2 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 64 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 4096 + --sglang-watchdog-timeout 3600 + --sglang-moe-runner-backend triton + --sglang-disable-shared-experts-fusion + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --calculate-per-token-loss + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/prepare.txt new file mode 100644 index 0000000000..58a0166a6c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download jybsuper/GLM-5.1-6layer + --local-dir /root/models/GLM-5.1-6layer + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt new file mode 100644 index 0000000000..7ed4f93fd0 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt @@ -0,0 +1,102 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.1-744B-A40B_6layer_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.1-6layer + --megatron-to-hf-mode bridge + --dsa-attention-backend tilelang + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj,q_a_proj,kv_a_proj_with_mqa,q_b_proj,kv_b_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 1 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 16 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-rollout-routing-replay + --use-wandb + --wandb-project miles-run_glm5_1_744b_a40b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --qkv-format thd + --micro-batch-size 1 + --rollout-num-gpus-per-engine 2 + --sglang-mem-fraction-static 0.5 + --sglang-enable-dp-attention + --sglang-ep-size 2 + --sglang-dp-size 2 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 64 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 4096 + --sglang-watchdog-timeout 3600 + --sglang-moe-runner-backend triton + --sglang-disable-shared-experts-fusion + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --calculate-per-token-loss + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt new file mode 100644 index 0000000000..9df4de9279 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt @@ -0,0 +1,133 @@ +### 0 +mkdir -p /models /root/datasets + +### 1 +hf download zai-org/GLM-5.2 + --local-dir /models/GLM-5.2 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +[all_ray_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /models/GLM-5.2 + --save /models/GLM-5.2_torch_dist + --tensor-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --pipeline-model-parallel-size 4 + --expert-model-parallel-size 2 + --decoder-first-pipeline-num-layers 18 + --decoder-last-pipeline-num-layers 20 + +### 4 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a + --info=progress2 /models/GLM-5.2_torch_dist/ /root/models/GLM-5.2_torch_dist + +### 5 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a + --info=progress2 /models/GLM-5.2/ /root/models/GLM-5.2 + +### 6 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 7 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 8 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 9 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.2 + --ref-load /root/models/GLM-5.2_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 64 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-tis + --tis-clip-low 0.5 + --tis-clip 2.0 + --use-wandb + --wandb-project miles-run_glm5_2_744b_a40b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --data-pad-size-multiplier 1024 + --log-probs-chunk-size 16384 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-router-policy consistent_hashing + --sglang-kv-cache-dtype fp8_e4m3 + --sglang-nsa-decode-backend flashmla_kv + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 32 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --rematerialize-param-from-master-weight + --moe-enable-deepep + --moe-token-dispatcher-type flex diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt new file mode 100644 index 0000000000..abe63c5f53 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt @@ -0,0 +1,27 @@ +### 0 +mkdir -p /models /root/datasets + +### 1 +hf download zai-org/GLM-5.2 + --local-dir /models/GLM-5.2 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +[all_ray_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /models/GLM-5.2 + --save /models/GLM-5.2_torch_dist + --tensor-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --pipeline-model-parallel-size 4 + --expert-model-parallel-size 2 + --decoder-first-pipeline-num-layers 18 + --decoder-last-pipeline-num-layers 20 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt new file mode 100644 index 0000000000..a03fe20a31 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt @@ -0,0 +1,7 @@ +### 0 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a + --info=progress2 /models/GLM-5.2_torch_dist/ /root/models/GLM-5.2_torch_dist + +### 1 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a + --info=progress2 /models/GLM-5.2/ /root/models/GLM-5.2 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt new file mode 100644 index 0000000000..b37f83ca52 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt @@ -0,0 +1,97 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.2 + --ref-load /root/models/GLM-5.2_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 64 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-tis + --tis-clip-low 0.5 + --tis-clip 2.0 + --use-wandb + --wandb-project miles-run_glm5_2_744b_a40b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --data-pad-size-multiplier 1024 + --log-probs-chunk-size 16384 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-router-policy consistent_hashing + --sglang-kv-cache-dtype fp8_e4m3 + --sglang-nsa-decode-backend flashmla_kv + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 32 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --rematerialize-param-from-master-weight + --moe-enable-deepep + --moe-token-dispatcher-type flex diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt new file mode 100644 index 0000000000..3f46dc356e --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt @@ -0,0 +1,114 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download Pinaster/GLM-5.2_5layer + --local-dir /root/models/GLM-5.2_5layer + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B_5layer_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.2_5layer + --megatron-to-hf-mode bridge + --dsa-attention-backend tilelang + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj,q_a_proj,kv_a_proj_with_mqa,q_b_proj,kv_b_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 1 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 16 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-rollout-routing-replay + --use-wandb + --wandb-project miles-run_glm5_2_744b_a40b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --qkv-format thd + --micro-batch-size 1 + --rollout-num-gpus-per-engine 2 + --sglang-mem-fraction-static 0.5 + --sglang-enable-dp-attention + --sglang-ep-size 2 + --sglang-dp-size 2 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 64 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 4096 + --sglang-watchdog-timeout 3600 + --sglang-moe-runner-backend triton + --sglang-disable-shared-experts-fusion + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --calculate-per-token-loss + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/prepare.txt new file mode 100644 index 0000000000..f7b956cd4b --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download Pinaster/GLM-5.2_5layer + --local-dir /root/models/GLM-5.2_5layer + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt new file mode 100644 index 0000000000..1af8cd6a87 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt @@ -0,0 +1,102 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B_5layer_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5.2_5layer + --megatron-to-hf-mode bridge + --dsa-attention-backend tilelang + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj,q_a_proj,kv_a_proj_with_mqa,q_b_proj,kv_b_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 1 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 16 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-rollout-routing-replay + --use-wandb + --wandb-project miles-run_glm5_2_744b_a40b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --qkv-format thd + --micro-batch-size 1 + --rollout-num-gpus-per-engine 2 + --sglang-mem-fraction-static 0.5 + --sglang-enable-dp-attention + --sglang-ep-size 2 + --sglang-dp-size 2 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-attention-backend nsa + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 64 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 4096 + --sglang-watchdog-timeout 3600 + --sglang-moe-runner-backend triton + --sglang-disable-shared-experts-fusion + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --calculate-per-token-loss + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt new file mode 100644 index 0000000000..5a2e94380c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt @@ -0,0 +1,132 @@ +### 0 +mkdir -p /models /root/datasets + +### 1 +hf download zai-org/GLM-5 + --local-dir /models/GLM-5 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +[all_ray_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /models/GLM-5 + --save /models/GLM-5_torch_dist + --tensor-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --pipeline-model-parallel-size 4 + --expert-model-parallel-size 32 + --decoder-last-pipeline-num-layers 18 + +### 4 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a + --info=progress2 /models/GLM-5_torch_dist/ /root/models/GLM-5_torch_dist + +### 5 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a + --info=progress2 /models/GLM-5/ /root/models/GLM-5 + +### 6 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 7 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 8 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 9 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5-744B-A40B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5 + --ref-load /root/models/GLM-5_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 64 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_glm5_744b_a40b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 16384 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.70 + --sglang-enable-dp-attention + --sglang-ep-size 8 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-kv-cache-dtype bf16 + --sglang-attention-backend nsa + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 256 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --rematerialize-param-from-master-weight + --moe-enable-deepep + --moe-token-dispatcher-type flex diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt new file mode 100644 index 0000000000..0f15caaeda --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt @@ -0,0 +1,26 @@ +### 0 +mkdir -p /models /root/datasets + +### 1 +hf download zai-org/GLM-5 + --local-dir /models/GLM-5 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +[all_ray_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 + --master-addr {{master_addr}} + --master-port 23456 + --nnodes={{nnodes}} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /models/GLM-5 + --save /models/GLM-5_torch_dist + --tensor-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --pipeline-model-parallel-size 4 + --expert-model-parallel-size 32 + --decoder-last-pipeline-num-layers 18 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt new file mode 100644 index 0000000000..dc829cee17 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt @@ -0,0 +1,7 @@ +### 0 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a + --info=progress2 /models/GLM-5_torch_dist/ /root/models/GLM-5_torch_dist + +### 1 +[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a + --info=progress2 /models/GLM-5/ /root/models/GLM-5 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt new file mode 100644 index 0000000000..00b09e03d6 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt @@ -0,0 +1,97 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5-744B-A40B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5 + --ref-load /root/models/GLM-5_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 64 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_glm5_744b_a40b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 16384 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.70 + --sglang-enable-dp-attention + --sglang-ep-size 8 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-lm-head + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-kv-cache-dtype bf16 + --sglang-attention-backend nsa + --sglang-page-size 64 + --sglang-cuda-graph-max-bs 256 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --rematerialize-param-from-master-weight + --moe-enable-deepep + --moe-token-dispatcher-type flex diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt new file mode 100644 index 0000000000..adef4b4812 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt @@ -0,0 +1,92 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/inkling.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1", "SGLANG_OPT_USE_INKLING_FUSED_AR_SCONV_NORM": "false", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "MILES_SGLANG_DUMMY_LOAD": "0", "SGLANG_SERVER_ENGINE_ROLLOUT_RETURN_LOGPROB": "1", "RAY_memory_monitor_refresh_ms": "0", "NCCL_MNNVL_ENABLE": "1", "NCCL_RAS_ENABLE": "0", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Inkling-4layer + --load /root/models/Inkling-4layer_torch_dist + --model-name inkling + --megatron-to-hf-mode raw + --no-load-optim + --no-load-rng + --finetune + --input-key prompt + --label-key label + --rollout-shuffle + --rm-type math + --num-rollout 100 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 4096 + --rollout-temperature 1 + --global-batch-size 64 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --apply-chat-template + --advantage-estimator grpo + --entropy-coef 0.0 + --eps-clip 0.2 + --eps-clip-high 0.28 + --eps-clip-c 3.0 + --use-tis + --use-rollout-routing-replay + --optimizer adam + --lr 1e-06 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --use-distributed-optimizer + --no-check-for-nan-in-loss-and-grad + --accumulate-allreduce-grads-in-fp32 + --offload-train-target disk + --offload-train-disk-dir /tmp/train_offload + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --rollout-num-gpus-per-engine 16 + --sglang-mem-fraction-static 0.6 + --sglang-max-running-requests 64 + --sglang-max-total-tokens 327680 + --sglang-attention-backend fa4 + --sglang-moe-runner-backend triton + --sglang-mamba-scheduler-strategy extra_buffer + --sglang-enable-multimodal + --sglang-context-length 8192 + --sglang-disable-custom-all-reduce + --transformer-impl transformer_engine + --bf16 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --no-bias-dropout-fusion + --distributed-timeout-minutes 30 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate + --use-wandb + --wandb-project miles-run_inkling + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt new file mode 100644 index 0000000000..81b73042bf --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt @@ -0,0 +1,3 @@ +### 0 +[all_ray_node num_nodes=None] mkdir -p /root/models/Inkling-4layer_torch_dist && rsync -a + --info=progress2 /root/models/Inkling-4layer_torch_dist/ /root/models/Inkling-4layer_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt new file mode 100644 index 0000000000..adef4b4812 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt @@ -0,0 +1,92 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/inkling.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1", "SGLANG_OPT_USE_INKLING_FUSED_AR_SCONV_NORM": "false", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "MILES_SGLANG_DUMMY_LOAD": "0", "SGLANG_SERVER_ENGINE_ROLLOUT_RETURN_LOGPROB": "1", "RAY_memory_monitor_refresh_ms": "0", "NCCL_MNNVL_ENABLE": "1", "NCCL_RAS_ENABLE": "0", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Inkling-4layer + --load /root/models/Inkling-4layer_torch_dist + --model-name inkling + --megatron-to-hf-mode raw + --no-load-optim + --no-load-rng + --finetune + --input-key prompt + --label-key label + --rollout-shuffle + --rm-type math + --num-rollout 100 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 4096 + --rollout-temperature 1 + --global-batch-size 64 + --balance-data + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --apply-chat-template + --advantage-estimator grpo + --entropy-coef 0.0 + --eps-clip 0.2 + --eps-clip-high 0.28 + --eps-clip-c 3.0 + --use-tis + --use-rollout-routing-replay + --optimizer adam + --lr 1e-06 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --use-distributed-optimizer + --no-check-for-nan-in-loss-and-grad + --accumulate-allreduce-grads-in-fp32 + --offload-train-target disk + --offload-train-disk-dir /tmp/train_offload + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --micro-batch-size 1 + --rollout-num-gpus-per-engine 16 + --sglang-mem-fraction-static 0.6 + --sglang-max-running-requests 64 + --sglang-max-total-tokens 327680 + --sglang-attention-backend fa4 + --sglang-moe-runner-backend triton + --sglang-mamba-scheduler-strategy extra_buffer + --sglang-enable-multimodal + --sglang-context-length 8192 + --sglang-disable-custom-all-reduce + --transformer-impl transformer_engine + --bf16 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --attention-softmax-in-fp32 + --no-bias-dropout-fusion + --distributed-timeout-minutes 30 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 4 + --colocate + --use-wandb + --wandb-project miles-run_inkling + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt new file mode 100644 index 0000000000..66bf8c6467 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt @@ -0,0 +1,81 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/joyai-llm-flash.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/JoyAI-LLM-Flash/ + --ref-load /root/models/JoyAI-LLM-Flash_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_joy_ai_llm_flash + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 4 + --expert-tensor-parallel-size 1 + --sglang-mem-fraction-static 0.7 + --sglang-attention-backend trtllm_mla + --rollout-num-gpus-per-engine 1 + --sglang-cuda-graph-max-bs 256 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend auto + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --num-gpus-per-node 8 + --rollout-num-gpus 4 + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt new file mode 100644 index 0000000000..306cf1e0ec --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download jdopensource/JoyAI-LLM-Flash + --local-dir /root/models/JoyAI-LLM-Flash + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/joyai-llm-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/JoyAI-LLM-Flash + --save /root/models/JoyAI-LLM-Flash_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt new file mode 100644 index 0000000000..ff3ca5b01f --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt @@ -0,0 +1,105 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download moonshotai/Kimi-K2.5 + --local-dir /root/models/Kimi-K2.5 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +python /tools/convert_kimi_int4_to_bf16.py + --model-dir /root/models/Kimi-K2.5 + --output-dir /root/models/Kimi-K2.5-bf16 + +### 4 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 5 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 6 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 7 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/kimi-k2-thinking.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "NCCL_TIMEOUT": "3600", "OPEN_TRAINING_INT4_FAKE_QAT_FLAG": "1", "OPEN_TRAINING_INT4_GROUP_SIZE": "32", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Kimi-K2.5 + --ref-load /root/models/Kimi-K2.5-bf16 + --megatron-to-hf-mode bridge + --model-name kimi_k25 + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 256 + --use-dynamic-global-batch-size + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --use-distributed-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_kimi_k25 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-server-concurrency 1024 + --use-rollout-routing-replay + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --no-check-for-nan-in-loss-and-grad + --colocate + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/prepare.txt new file mode 100644 index 0000000000..5f8eb4a1f3 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/prepare.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download moonshotai/Kimi-K2.5 + --local-dir /root/models/Kimi-K2.5 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +python /tools/convert_kimi_int4_to_bf16.py + --model-dir /root/models/Kimi-K2.5 + --output-dir /root/models/Kimi-K2.5-bf16 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt new file mode 100644 index 0000000000..19ad8247eb --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt @@ -0,0 +1,88 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/kimi-k2-thinking.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "NCCL_TIMEOUT": "3600", "OPEN_TRAINING_INT4_FAKE_QAT_FLAG": "1", "OPEN_TRAINING_INT4_GROUP_SIZE": "32", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Kimi-K2.5 + --ref-load /root/models/Kimi-K2.5-bf16 + --megatron-to-hf-mode bridge + --model-name kimi_k25 + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 2 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1 + --global-batch-size 256 + --use-dynamic-global-batch-size + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --use-distributed-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_kimi_k25 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-server-concurrency 1024 + --use-rollout-routing-replay + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --no-check-for-nan-in-loss-and-grad + --colocate + --update-weight-buffer-size 2147483648 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/execute.txt new file mode 100644 index 0000000000..0dda2fb57b --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/execute.txt @@ -0,0 +1,74 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py + --hf-checkpoint /root/models/Qwen3-4B-Instruct-2507 + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type math + --num-rollout 3000 + --rollout-batch-size 64 + --n-samples-per-prompt 16 + --rollout-max-response-len 32768 + --rollout-temperature 1 + --global-batch-size 1024 + --eval-interval 20 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 32768 + --eval-top-p 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 1 + --sglang-mem-fraction-static 0.75 + --sglang-decode-log-interval 1000 + --sglang-chunked-prefill-size 4096 + --train-backend fsdp + --update-weight-buffer-size 536870912 + --gradient-checkpointing + --attn-implementation flash_attention_2 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --colocate + --train-env-vars '{"PYTORCH_CUDA_ALLOC_CONF":"expandable_segments:True"}' + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details + --use-wandb + --wandb-project miles-dev-megatron-fsdp + --wandb-group qwen3-4B-fsdp-noref diff --git a/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/prepare.txt new file mode 100644 index 0000000000..04e7640824 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_mcore_fsdp.py/prepare.txt @@ -0,0 +1,26 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Qwen/Qwen3-4B-Instruct-2507 + --local-dir /root/models/Qwen3-4B-Instruct-2507 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +hf download + --repo-type dataset zyzshishui0627/gpqa_diamond + --local-dir /root/datasets/gpqa_diamond + +### 5 +hf download + --repo-type dataset zyzshishui0627/IFBench + --local-dir /root/datasets/IFBench diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/execute.txt new file mode 100644 index 0000000000..58956cfa8d --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/execute.txt @@ -0,0 +1,70 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py + --hf-checkpoint /models/NVIDIA-Nemotron-3-Nano-4B-BF16 + --ref-load /models/NVIDIA-Nemotron-3-Nano-4B-BF16 + --prompt-data /root/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type deepscaler + --num-rollout 100 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 4096 + --rollout-temperature 1 + --global-batch-size 256 + --eval-interval 10 + --eval-prompt-data aime /root/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 4096 + --eval-top-p 1 + --use-kl-loss + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --use-wandb + --wandb-project miles-fsdp-curve + --wandb-group nemotron-3-nano-4B-fsdp-dapo4k + --rollout-num-gpus-per-engine 1 + --sglang-decode-log-interval 1000 + --sglang-mem-fraction-static 0.7 + --train-backend fsdp + --update-weight-buffer-size 536870912 + --gradient-checkpointing + --attn-implementation flash_attention_2 + --train-env-vars '{"PYTORCH_CUDA_ALLOC_CONF":"expandable_segments:True"}' + --use-dynamic-batch-size + --max-tokens-per-gpu 9216 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --colocate + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/prepare.txt new file mode 100644 index 0000000000..4b6bb81ec0 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_nano_4b_fsdp.py/prepare.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /models + +### 1 +hf download nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16 + --local-dir /models/NVIDIA-Nemotron-3-Nano-4B-BF16 + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/aime-2024 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt new file mode 100644 index 0000000000..bb68d87dba --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt @@ -0,0 +1,96 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --local-dir /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --ref-load /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --megatron-to-hf-mode bridge + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 50 + --no-save-optim + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 30 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 128 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_nemotron_3_ultra_550b_a55b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --log-probs-chunk-size 128 + --rollout-num-gpus-per-engine 8 + --sglang-ep-size 8 + --sglang-dp-size 2 + --sglang-enable-dp-attention + --sglang-mem-fraction-static 0.6 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend auto + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --rollout-num-gpus 8 + --dump-details /root/shared_data/260101-000000-000/dump_details diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/prepare.txt new file mode 100644 index 0000000000..66b6d41ca5 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --local-dir /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt new file mode 100644 index 0000000000..99d3f6320c --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt @@ -0,0 +1,84 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --ref-load /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer + --megatron-to-hf-mode bridge + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 50 + --no-save-optim + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 30 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 128 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_nemotron_3_ultra_550b_a55b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 1 + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --log-probs-chunk-size 128 + --rollout-num-gpus-per-engine 8 + --sglang-ep-size 8 + --sglang-dp-size 2 + --sglang-enable-dp-attention + --sglang-mem-fraction-static 0.6 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend auto + --colocate + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --rollout-num-gpus 8 + --dump-details /root/shared_data/260101-000000-000/dump_details diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/execute.txt new file mode 100644 index 0000000000..27ca245ffb --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/execute.txt @@ -0,0 +1,72 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py + --hf-checkpoint /root/models/Qwen3-0.6B + --ref-load /root/models/Qwen3-0.6B + --prompt-data /root/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type deepscaler + --num-rollout 100 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 4096 + --rollout-temperature 1 + --global-batch-size 256 + --eval-interval 10 + --eval-prompt-data aime /root/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 4096 + --eval-top-p 1 + --use-kl-loss + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --use-wandb + --wandb-project miles-fsdp-curve + --wandb-group qwen3-0.6B-fsdp-dapo4k + --rollout-num-gpus-per-engine 1 + --sglang-decode-log-interval 1000 + --sglang-mem-fraction-static 0.75 + --sglang-attention-backend fa3 + --sglang-chunked-prefill-size 4096 + --train-backend fsdp + --update-weight-buffer-size 536870912 + --gradient-checkpointing + --attn-implementation flash_attention_3 + --train-env-vars '{"PYTORCH_CUDA_ALLOC_CONF":"expandable_segments:True"}' + --use-dynamic-batch-size + --max-tokens-per-gpu 9216 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --colocate + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/prepare.txt new file mode 100644 index 0000000000..db7e9deea3 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_0_6b_fsdp.py/prepare.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /root/models + +### 1 +hf download Qwen/Qwen3-0.6B + --local-dir /root/models/Qwen3-0.6B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/aime-2024 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt new file mode 100644 index 0000000000..ec94532cfd --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt @@ -0,0 +1,89 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B/ + --ref-load /root/models/Qwen3-30B-A3B_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_qwen3_30b_a3b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 32768 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --eval-interval 20 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 1 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-cuda-graph-max-bs 512 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --num-gpus-per-node 8 + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details + --actor-num-gpus-per-node 8 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt new file mode 100644 index 0000000000..76254f6091 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Qwen/Qwen3-30B-A3B + --local-dir /root/models/Qwen3-30B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/qwen3-30B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B + --save /root/models/Qwen3-30B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/execute.txt new file mode 100644 index 0000000000..95dc02b268 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/execute.txt @@ -0,0 +1,73 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 4 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py + --hf-checkpoint /root/models/Qwen3-30B-A3B + --ref-load /root/models/Qwen3-30B-A3B + --prompt-data /root/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --balance-data + --rm-type deepscaler + --num-rollout 100 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 4096 + --rollout-temperature 1 + --global-batch-size 256 + --eval-interval 10 + --eval-prompt-data aime /root/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 4096 + --eval-top-p 1 + --use-kl-loss + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --use-wandb + --wandb-project miles-fsdp-curve + --wandb-group qwen3-30B-A3B-fsdp-dapo4k + --rollout-num-gpus-per-engine 1 + --sglang-decode-log-interval 1000 + --sglang-mem-fraction-static 0.75 + --sglang-attention-backend fa3 + --sglang-chunked-prefill-size 4096 + --train-backend fsdp + --update-weight-buffer-size 536870912 + --gradient-checkpointing + --attn-implementation flash_attention_3 + --train-env-vars '{"PYTORCH_CUDA_ALLOC_CONF":"expandable_segments:True"}' + --fsdp-cpu-offload + --use-dynamic-batch-size + --max-tokens-per-gpu 9216 + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --colocate + --use-fault-tolerance diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/prepare.txt new file mode 100644 index 0000000000..e59c8717f0 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b_fsdp.py/prepare.txt @@ -0,0 +1,16 @@ +### 0 +mkdir -p /root/models + +### 1 +hf download Qwen/Qwen3-30B-A3B + --local-dir /root/models/Qwen3-30B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/aime-2024 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt new file mode 100644 index 0000000000..d7553165a4 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt @@ -0,0 +1,88 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-4B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-4B + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --load /root/models/Qwen3-4B_torch_dist + --ref-load /root/models/Qwen3-4B_torch_dist + --save-retain-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --use-wandb + --wandb-project miles-run_qwen3_4b + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --use-dynamic-batch-size + --max-tokens-per-gpu 9216 + --eval-interval 20 + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 1 + --rollout-num-gpus-per-engine 1 + --sglang-chunked-prefill-size 4096 + --sglang-mem-fraction-static 0.7 + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 4 + --cp-comm-type a2a + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --train-memory-margin-bytes 3221225472 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate + --use-fault-tolerance + --dump-details /root/shared_data/260101-000000-000/dump_details diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt new file mode 100644 index 0000000000..e0a453fe6b --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Qwen/Qwen3-4B + --local-dir /root/models/Qwen3-4B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/qwen3-4B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-4B + --save /root/models/Qwen3-4B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt new file mode 100644 index 0000000000..a72d043fea --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt @@ -0,0 +1,93 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download Qwen/Qwen3.5-35B-A3B + --local-dir /root/models/Qwen3.5-35B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k + +### 3 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 4 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 5 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 6 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.5-35B-A3B + --megatron-to-hf-mode bridge + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "language_model.decoder.layers.*.self_attention.linear_qkv,language_model.decoder.layers.*.self_attention.linear_proj,language_model.decoder.layers.*.mlp.experts.linear_fc1,language_model.decoder.layers.*.mlp.experts.linear_fc2,language_model.decoder.layers.*.mlp.shared_experts.linear_fc1,language_model.decoder.layers.*.mlp.shared_experts.linear_fc2,language_model.decoder.layers.*.self_attention.in_proj,language_model.decoder.layers.*.self_attention.out_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 10 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 64 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_qwen3_5_35b_a3b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --qkv-format bshd + --micro-batch-size 1 + --max-tokens-per-gpu 4096 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.4 + --sglang-dtype bfloat16 + --sglang-decode-log-interval 1000 + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --update-weight-buffer-size 536870912 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/prepare.txt new file mode 100644 index 0000000000..574994dfe5 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/prepare.txt @@ -0,0 +1,11 @@ +### 0 +mkdir -p /root/datasets /root/models + +### 1 +hf download Qwen/Qwen3.5-35B-A3B + --local-dir /root/models/Qwen3.5-35B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/gsm8k + --local-dir /root/datasets/gsm8k diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt new file mode 100644 index 0000000000..a4e7216fed --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt @@ -0,0 +1,81 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B_lora.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.5-35B-A3B + --megatron-to-hf-mode bridge + --lora-rank 16 + --lora-alpha 32 + --lora-dropout 0.0 + --target-modules "language_model.decoder.layers.*.self_attention.linear_qkv,language_model.decoder.layers.*.self_attention.linear_proj,language_model.decoder.layers.*.mlp.experts.linear_fc1,language_model.decoder.layers.*.mlp.experts.linear_fc2,language_model.decoder.layers.*.mlp.shared_experts.linear_fc1,language_model.decoder.layers.*.mlp.shared_experts.linear_fc2,language_model.decoder.layers.*.self_attention.in_proj,language_model.decoder.layers.*.self_attention.out_proj" + --experts-shared-outer-loras + --no-gradient-accumulation-fusion + --lora-base-cpu-backup + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type math + --num-rollout 10 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 512 + --rollout-temperature 1.0 + --global-batch-size 64 + --prompt-data /root/datasets/gsm8k/train.parquet + --input-key messages + --optimizer adam + --lr 1e-5 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_qwen3_5_35b_a3b_lora + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --qkv-format bshd + --micro-batch-size 1 + --max-tokens-per-gpu 4096 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.4 + --sglang-dtype bfloat16 + --sglang-decode-log-interval 1000 + --sglang-max-lora-rank 16 + --sglang-lora-backend triton + --save-interval 1 + --save /personal/checkpoints/260101-000000-000 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --update-weight-buffer-size 536870912 + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt new file mode 100644 index 0000000000..abc49ff53e --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt @@ -0,0 +1,91 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_SPEC_V2": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.5-35B-A3B + --ref-load /root/models/Qwen3.5-35B-A3B_torch_dist + --load /root/shared_data/260101-000000-000/checkpoints + --save /root/shared_data/260101-000000-000/checkpoints + --save-interval 20 + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 3000 + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 16384 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-run_qwen3_5_35b_a3b_mtp_cp2_ep8 + --wandb-group 260101-000000-000 + --wandb-key 'frozen-wandb-api-key' + --disable-wandb-random-suffix + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 2 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --log-probs-chunk-size 4096 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-cuda-graph-bs 1 2 4 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128 136 144 152 160 168 176 184 192 200 208 216 224 232 240 248 256 + --sglang-speculative-algorithm EAGLE + --sglang-speculative-num-steps 2 + --sglang-speculative-eagle-topk 1 + --sglang-speculative-num-draft-tokens 3 + --sglang-mamba-scheduler-strategy extra_buffer + --enable-mtp-training + --mtp-num-layers 1 + --mtp-loss-scaling-factor 0.2 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --moe-token-dispatcher-type flex + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt new file mode 100644 index 0000000000..080f66d974 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +hf download Qwen/Qwen3.5-35B-A3B + --local-dir /root/models/Qwen3.5-35B-A3B + +### 2 +hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/qwen3.5-35B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.5-35B-A3B + --save /root/models/Qwen3.5-35B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt new file mode 100644 index 0000000000..c0d20eaf53 --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt @@ -0,0 +1,84 @@ +### 0 +pkill -9 sglang; sleep 3; ray stop + --force; pkill -9 ray; pkill -9 miles; sleep 3; pkill -9 ray; pkill -9 miles; pkill -9 redis; true; + +### 1 +export PYTHONUNBUFFERED=1 && ray start + --head + --node-ip-address 127.0.0.1 + --num-gpus 8 + --disable-usage-stats + +### 2 +nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l + +### 3 +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.6-35B-A3B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_SPEC_V2": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' + -- python3 /train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.6-35B-A3B + --ref-load /root/models/Qwen3.6-35B-A3B_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 10 + --rollout-batch-size 8 + --n-samples-per-prompt 2 + --rollout-max-response-len 1024 + --rollout-temperature 1 + --global-batch-size 16 + --balance-data + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --tensor-model-parallel-size 1 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128 + --sglang-speculative-algorithm EAGLE + --sglang-speculative-num-steps 2 + --sglang-speculative-eagle-topk 1 + --sglang-speculative-num-draft-tokens 3 + --sglang-max-running-requests 256 + --sglang-mamba-scheduler-strategy extra_buffer + --enable-mtp-training + --mtp-num-layers 1 + --mtp-loss-scaling-factor 0.2 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --moe-token-dispatcher-type flex + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --num-gpus-per-node 8 + --colocate diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt new file mode 100644 index 0000000000..1699858b4f --- /dev/null +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt @@ -0,0 +1,22 @@ +### 0 +mkdir -p /root/models /root/datasets + +### 1 +test -e /root/models/Qwen3.6-35B-A3B || hf download Qwen/Qwen3.6-35B-A3B + --local-dir /root/models/Qwen3.6-35B-A3B + +### 2 +test -e /root/datasets/dapo-math-17k || hf download + --repo-type dataset zhuzilin/dapo-math-17k + --local-dir /root/datasets/dapo-math-17k + +### 3 +test -e /root/datasets/aime-2024 || hf download + --repo-type dataset zhuzilin/aime-2024 + --local-dir /root/datasets/aime-2024 + +### 4 +source /scripts/models/qwen3.6-35B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3.6-35B-A3B + --save /root/models/Qwen3.6-35B-A3B_torch_dist From 0675ed78477e24fcf8ca3cee3cd2da456a162406 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 14:37:21 +0800 Subject: [PATCH 08/18] Cover the public surface of command_utils with unit tests Squashed from: - Cover the public surface of command_utils with unit tests - Group the command_utils tests by the function under test - Close the gaps that let the command_utils tests pass on broken behaviour - Keep the command_utils tests in one file --- tests/fast/utils/test_command_utils.py | 674 ++++++++++++++++++++----- 1 file changed, 548 insertions(+), 126 deletions(-) diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 83e51b2db1..726ef403af 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -3,175 +3,597 @@ import shlex import pytest +from tests.fast.utils.command_recorder import record_commands import miles.utils.external_utils.command_utils as command_utils -def test_convert_checkpoint_preserves_source_paths(monkeypatch, tmp_path): - commands = [] - monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") - monkeypatch.setattr(command_utils, "exec_command", commands.append) +@pytest.fixture +def commands(monkeypatch): + recorded = record_commands(monkeypatch) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + for name in ("MILES_SCRIPT_EXTERNAL_RAY", "RAY_ADDRESS", "NCCL_NVLS_ENABLE", "WANDB_API_KEY"): + monkeypatch.delenv(name, raising=False) + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setenv("MASTER_ADDR", "127.0.0.1") + return recorded - command_utils.convert_checkpoint( - model_name="model", - megatron_model_type="model_type", - num_gpus_per_node=1, - dir_dst=str(tmp_path), - megatron_path="/megatron", - ) - expected = os.pathsep.join([str(command_utils.repo_base_dir), "/megatron", "/sglang", "/existing"]) - assert f"PYTHONPATH={shlex.quote(expected)} " in commands[0] +def _runtime_env(submit_command): + arg = next(arg for arg in shlex.split(submit_command) if arg.startswith("--runtime-env-json=")) + return json.loads(arg.split("=", 1)[1])["env_vars"] -def test_execute_train_exports_unbuffered_python_to_ray(monkeypatch): - """Ray start and job submit must export the correctly spelled PYTHONUNBUFFERED.""" - commands = [] - monkeypatch.delenv("MILES_SCRIPT_EXTERNAL_RAY", raising=False) - monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) - monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) +class TestExecuteTrainConfig: + def test_num_nodes_reads_the_slurm_allocation_when_the_config_is_built(self, monkeypatch): + """A plain class-level default would bake in the allocation at import and ignore later changes.""" + monkeypatch.setenv("SLURM_JOB_NUM_NODES", "8") + assert command_utils.ExecuteTrainConfig().num_nodes == 8 - command_utils.execute_train( - train_args="", - num_gpus_per_node=1, - megatron_model_type="model_type", - ) + monkeypatch.delenv("SLURM_JOB_NUM_NODES") + assert command_utils.ExecuteTrainConfig().num_nodes == 1 - exports = [command for command in commands if "export PYTHONUNBUFFERED" in command] - assert len(exports) == 2 - assert not any("PYTHONBUFFERED" in command for command in commands) - assert all("export PYTHONUNBUFFERED=1 &&" in command for command in exports) +class TestConvertCheckpoint: + def test_preserves_source_paths_on_the_pythonpath(self, monkeypatch, tmp_path): + """The converter runs out-of-process, so miles and megatron must be on its PYTHONPATH.""" + commands = [] + monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + + command_utils.convert_checkpoint( + model_name="model", + megatron_model_type="model_type", + num_gpus_per_node=1, + dir_dst=str(tmp_path), + megatron_path="/megatron", + ) -def test_execute_train_unbuffers_the_ray_workers_too(monkeypatch): - """An export only reaches the submitting client; the ray workers read the runtime environment.""" - commands = [] - monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") - monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) - monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + expected = os.pathsep.join([str(command_utils.repo_base_dir), "/megatron", "/sglang", "/existing"]) + assert f"PYTHONPATH={shlex.quote(expected)} " in commands[0] + + def test_defaults_the_hf_checkpoint_to_the_model_name(self, commands, tmp_path): + """Callers that only pass a model name get /root/models/ as the source.""" + command_utils.convert_checkpoint( + model_name="Qwen3-4B", megatron_model_type="qwen3-4B", num_gpus_per_node=8, dir_dst=str(tmp_path) + ) - command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="model_type") + assert "--hf-checkpoint /root/models/Qwen3-4B " in commands[0] + assert f"--save {tmp_path}/Qwen3-4B_torch_dist " in commands[0] - runtime_env_arg = next(arg for arg in shlex.split(commands[-1]) if arg.startswith("--runtime-env-json=")) - assert json.loads(runtime_env_arg.split("=", 1)[1])["env_vars"]["PYTHONUNBUFFERED"] == "1" + def test_an_explicit_hf_checkpoint_wins_over_the_default(self, commands, tmp_path): + """Callers converting a checkpoint that does not live under /root/models must be honoured.""" + command_utils.convert_checkpoint( + model_name="Qwen3-4B", + megatron_model_type="qwen3-4B", + num_gpus_per_node=8, + dir_dst=str(tmp_path), + hf_checkpoint="/elsewhere/Qwen3-4B", + ) + assert "--hf-checkpoint /elsewhere/Qwen3-4B " in commands[0] + assert "/root/models" not in commands[0] -def test_execute_train_preserves_source_paths_in_ray_runtime(monkeypatch): - commands = [] - monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") - monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") - monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) - monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + def test_skips_an_already_released_destination(self, commands, tmp_path): + """A tracker file reading 'release' means the conversion already finished.""" + dst = tmp_path / "Qwen3-4B_torch_dist" + dst.mkdir() + (dst / "latest_checkpointed_iteration.txt").write_text("release\n") - command_utils.execute_train( - train_args="", - num_gpus_per_node=1, - megatron_model_type="model_type", - megatron_path="/megatron", - extra_env_vars={"PYTHONPATH": "/custom:/sglang", "QUOTED_VALUE": "it's preserved"}, - ) + command_utils.convert_checkpoint( + model_name="Qwen3-4B", megatron_model_type="qwen3-4B", num_gpus_per_node=8, dir_dst=str(tmp_path) + ) - submit_command = commands[-1] - runtime_env_arg = next(arg for arg in shlex.split(submit_command) if arg.startswith("--runtime-env-json=")) - runtime_env = json.loads(runtime_env_arg.split("=", 1)[1]) - expected = os.pathsep.join([str(command_utils.repo_base_dir), "/megatron", "/custom", "/sglang", "/existing"]) - assert runtime_env["env_vars"]["PYTHONPATH"] == expected - assert runtime_env["env_vars"]["QUOTED_VALUE"] == "it's preserved" + assert commands == [] + def test_reruns_when_the_tracker_holds_an_iteration(self, commands, tmp_path): + """Only the literal 'release' marker counts as done; an iteration number does not.""" + dst = tmp_path / "Qwen3-4B_torch_dist" + dst.mkdir() + (dst / "latest_checkpointed_iteration.txt").write_text("42") + + command_utils.convert_checkpoint( + model_name="Qwen3-4B", megatron_model_type="qwen3-4B", num_gpus_per_node=8, dir_dst=str(tmp_path) + ) + + assert len(commands) == 1 + + def test_multinode_uses_torchrun_rendezvous_placeholders(self, commands, tmp_path): + """Multi-node conversion must template the placeholders exec_command_all_ray_node substitutes.""" + command_utils.convert_checkpoint( + model_name="Qwen3-4B", + megatron_model_type="qwen3-4B", + num_gpus_per_node=8, + multinode=True, + num_nodes=2, + dir_dst=str(tmp_path), + extra_args="--extra 1", + ) + + assert "--master-addr {{master_addr}}" in commands[0] + assert "--nnodes={{nnodes}}" in commands[0] + assert "--node-rank {{node_rank}}" in commands[0] + assert commands[0].endswith("--extra 1") + + def test_single_node_omits_the_rendezvous_placeholders(self, commands, tmp_path): + """A single-node conversion has nothing to rendezvous with.""" + command_utils.convert_checkpoint( + model_name="Qwen3-4B", megatron_model_type="qwen3-4B", num_gpus_per_node=8, dir_dst=str(tmp_path) + ) -def test_execute_train_runs_hook_after_ray_restart_and_before_submit(monkeypatch): - events = [] - monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "0") - monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", lambda command: events.append(("command", command))) - monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + assert "--master-addr" not in commands[0] + + +class TestRsyncSimple: + def test_limits_itself_to_the_requested_node_count(self, monkeypatch): + """prepare_cp asks for the training node count; forwarding it is the whole point of the argument.""" + calls = [] + monkeypatch.setattr(command_utils, "exec_command_all_ray_node", lambda cmd, **kwargs: calls.append(kwargs)) + + command_utils.rsync_simple("/src", "/dst", num_nodes=4) + + assert calls == [{"num_nodes": 4}] + + def test_creates_the_destination_before_copying(self, commands): + """rsync fails on a missing destination, so the mkdir has to precede it.""" + command_utils.rsync_simple("/src", "/dst") + + assert commands == ["[all_ray_node num_nodes=None] mkdir -p /dst && rsync -a --info=progress2 /src/ /dst"] + + +class TestHfDownloadDataset: + def test_strips_the_namespace_from_the_local_dir(self, commands): + """The local directory is named after the dataset, not after owner/dataset.""" + command_utils.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir="/data") + + assert commands == ["hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /data/dapo-math-17k"] + + +class TestFp8CastBf16: + def test_skips_when_the_output_index_already_exists(self, commands, tmp_path): + """A safetensors index in the destination means the cast already ran.""" + (tmp_path / "model.safetensors.index.json").write_text("{}") + + command_utils.fp8_cast_bf16("/src", str(tmp_path)) + + assert commands == [] + + def test_runs_when_the_output_is_absent(self, commands, tmp_path): + """Without the index file the cast must actually be invoked.""" + command_utils.fp8_cast_bf16("/src", str(tmp_path)) + + assert "--input-fp8-hf-path /src " in commands[0] + assert f"--output-bf16-hf-path {tmp_path} " in commands[0] + + +class TestStartMooncakeMaster: + def test_reuses_a_ready_server(self, monkeypatch): + """An already listening master must not be restarted out from under its clients.""" + commands = [] + waits = [] + monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: True) + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr( + command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs)) + ) + + command_utils.start_mooncake_master() + + assert commands == [] + assert waits == [] + + def test_restarts_and_waits_until_ready(self, monkeypatch, tmp_path): + """A dead master is replaced and the caller blocks until the new one answers.""" + commands = [] + waits = [] + log_path = tmp_path / "mooncake master.log" + monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr( + command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs)) + ) + + command_utils.start_mooncake_master(rpc_port=50151, metrics_port=50152, timeout=12, log_path=log_path) + + assert len(commands) == 1 + assert "pkill -x mooncake_master" in commands[0] + assert "mooncake_master --rpc_port 50151 --metrics_port 50152" in commands[0] + assert f"> {shlex.quote(str(log_path))} 2>&1 &" in commands[0] + assert waits == [(("127.0.0.1", 50151), {"timeout": 12})] + + def test_reports_the_log_when_startup_fails(self, monkeypatch, tmp_path): + """The log is the only clue about why the master refused to come up.""" + log_path = tmp_path / "mooncake_master.log" + log_path.write_text("bind failed\nfatal startup error\n") + commands = [] + monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) + monkeypatch.setattr(command_utils, "exec_command", commands.append) + + def fail_wait(*args, **kwargs): + raise RuntimeError("not ready") + + monkeypatch.setattr(command_utils, "wait_for_server_ready", fail_wait) + + with pytest.raises(RuntimeError, match="fatal startup error"): + command_utils.start_mooncake_master(log_path=log_path) + + assert len(commands) == 2 + assert all("pkill -x mooncake_master" in command for command in commands) + + +class TestExecuteTrain: + def test_exports_unbuffered_python_to_ray(self, monkeypatch): + """Ray start and job submit must export the correctly spelled PYTHONUNBUFFERED.""" + commands = [] + monkeypatch.delenv("MILES_SCRIPT_EXTERNAL_RAY", raising=False) + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + + command_utils.execute_train( + train_args="", + num_gpus_per_node=1, + megatron_model_type="model_type", + ) + + exports = [command for command in commands if "export PYTHONUNBUFFERED" in command] + assert len(exports) == 2 + assert not any("PYTHONBUFFERED" in command for command in commands) + assert all("export PYTHONUNBUFFERED=1 &&" in command for command in exports) + + def test_unbuffers_the_ray_workers_too(self, monkeypatch): + """An export only reaches the submitting client; the ray workers read the runtime environment.""" + commands = [] + monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + + command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="model_type") + + runtime_env_arg = next(arg for arg in shlex.split(commands[-1]) if arg.startswith("--runtime-env-json=")) + assert json.loads(runtime_env_arg.split("=", 1)[1])["env_vars"]["PYTHONUNBUFFERED"] == "1" + + def test_preserves_source_paths_in_the_ray_runtime(self, monkeypatch): + """A caller-supplied PYTHONPATH must be prepended to, not replace, the checkouts miles needs.""" + commands = [] + monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") + monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") + monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) + + command_utils.execute_train( + train_args="", + num_gpus_per_node=1, + megatron_model_type="model_type", + megatron_path="/megatron", + extra_env_vars={"PYTHONPATH": "/custom:/sglang", "QUOTED_VALUE": "it's preserved"}, + ) + + submit_command = commands[-1] + runtime_env_arg = next(arg for arg in shlex.split(submit_command) if arg.startswith("--runtime-env-json=")) + runtime_env = json.loads(runtime_env_arg.split("=", 1)[1]) + expected = os.pathsep.join([str(command_utils.repo_base_dir), "/megatron", "/custom", "/sglang", "/existing"]) + assert runtime_env["env_vars"]["PYTHONPATH"] == expected + assert runtime_env["env_vars"]["QUOTED_VALUE"] == "it's preserved" + + def test_rejects_fsdp_with_a_megatron_model_type(self, commands): + """FSDP runs have no megatron model config, so a model type means the launcher is confused.""" + with pytest.raises(AssertionError): + command_utils.execute_train( + train_args="--train-backend fsdp", num_gpus_per_node=8, megatron_model_type="qwen" + ) + + def test_rejects_megatron_without_a_model_type(self, commands): + """Without a model type the submitted job would carry no architecture flags at all.""" + with pytest.raises(AssertionError): + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type=None) + + def test_starts_a_local_ray_cluster_by_default(self, commands): + """Without MILES_SCRIPT_EXTERNAL_RAY the launcher owns the ray cluster lifecycle.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert "ray stop --force; " in commands[0] + assert "ray start --head --node-ip-address 127.0.0.1 --num-gpus 8 --disable-usage-stats" in commands[1] + + def test_leaves_an_external_ray_cluster_alone(self, commands, monkeypatch): + """With an external cluster we must neither stop nor start ray.""" + monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert not any("ray stop" in command or "ray start" in command for command in commands) + assert not any("pkill -9 ray" in command for command in commands) + + def test_runs_the_callback_before_submitting(self, commands): + """before_ray_job_submit exists to prepare state the job will read.""" + command_utils.execute_train( + train_args="", + num_gpus_per_node=8, + megatron_model_type="qwen3-4B", + before_ray_job_submit=lambda: commands.append("CALLBACK"), + ) + + assert commands.index("CALLBACK") < len(commands) - 1 + assert "ray start --head" in commands[commands.index("CALLBACK") - 1] + assert "ray job submit" in commands[-1] + + def test_can_skip_the_ray_job_submit(self, commands, monkeypatch): + """Preparation-only runs disable the submit but still clean up and start ray.""" + monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "0") + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert not any("ray job submit" in command for command in commands) + + def test_sources_the_model_config_and_expands_model_args(self, commands): + """The megatron model type is turned into a `source` plus a ${MODEL_ARGS[@]} expansion.""" + command_utils.execute_train(train_args="--x 1", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + submit = commands[-1] + assert f'source "{command_utils.repo_base_dir}/scripts/models/qwen3-4B.sh" && ' in submit + assert "${MODEL_ARGS[@]}" in submit + assert submit.endswith("--x 1") + + def test_omits_the_model_source_for_fsdp(self, commands): + """FSDP has no megatron model config to source.""" + command_utils.execute_train(train_args="--train-backend fsdp", num_gpus_per_node=8, megatron_model_type=None) + + assert "scripts/models/" not in commands[-1] + assert "${MODEL_ARGS[@]}" not in commands[-1] + + def test_drops_cuda_device_max_connections_for_fsdp(self, commands): + """Pinning it to 1 breaks computation/communication overlap on FSDP.""" + command_utils.execute_train(train_args="--train-backend fsdp", num_gpus_per_node=8, megatron_model_type=None) + + assert "CUDA_DEVICE_MAX_CONNECTIONS" not in _runtime_env(commands[-1]) + + def test_pins_cuda_device_max_connections_for_megatron(self, commands): + """Megatron requires the serialized copy engine ordering.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert _runtime_env(commands[-1])["CUDA_DEVICE_MAX_CONNECTIONS"] == "1" + + def test_derives_nvls_from_nvlink_detection(self, commands, monkeypatch): + """NCCL_NVLS_ENABLE follows the detected topology when it is not preset.""" + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: True) + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert _runtime_env(commands[-1])["NCCL_NVLS_ENABLE"] == "1" + + def test_lets_the_environment_override_nvls(self, commands, monkeypatch): + """An explicit NCCL_NVLS_ENABLE wins over topology detection.""" + monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: True) + monkeypatch.setenv("NCCL_NVLS_ENABLE", "0") + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert _runtime_env(commands[-1])["NCCL_NVLS_ENABLE"] == "0" + + def test_forwards_selected_nccl_variables_only_when_present(self, commands, monkeypatch): + """Optional debug knobs are passed through, and absent ones must not appear as empty strings.""" + monkeypatch.setenv("NCCL_SOCKET_IFNAME", "eth0") + monkeypatch.delenv("NCCL_DEBUG", raising=False) + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + runtime_env = _runtime_env(commands[-1]) + assert runtime_env["NCCL_SOCKET_IFNAME"] == "eth0" + assert "NCCL_DEBUG" not in runtime_env + + def test_bypasses_the_proxy_for_the_master_node(self, commands, monkeypatch): + """Routing intra-cluster traffic through a proxy hangs the job.""" + monkeypatch.setenv("MASTER_ADDR", "10.0.0.1") - command_utils.execute_train( - train_args="", - num_gpus_per_node=1, - megatron_model_type="model_type", - before_ray_job_submit=lambda: events.append(("hook", None)), + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + runtime_env = _runtime_env(commands[-1]) + assert runtime_env["no_proxy"] == "127.0.0.1,10.0.0.1" + assert runtime_env["MASTER_ADDR"] == "10.0.0.1" + + def test_enables_cuda_core_dumps_on_request(self, commands): + """The core dump knobs only appear when the config asks for them.""" + config = command_utils.ExecuteTrainConfig(cuda_core_dump=True, output_dir="/out") + + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B", config=config) + + runtime_env = _runtime_env(commands[-1]) + assert runtime_env["CUDA_ENABLE_COREDUMP_ON_EXCEPTION"] == "1" + assert runtime_env["CUDA_COREDUMP_FILE"] == "/out/cuda_coredump_%h.%p.%t" + + def test_omits_cuda_core_dumps_by_default(self, commands): + """Core dumps are expensive, so they must stay off unless asked for.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert "CUDA_ENABLE_COREDUMP_ON_EXCEPTION" not in _runtime_env(commands[-1]) + + def test_lets_config_extra_env_vars_win_over_the_argument(self, commands): + """The CLI-supplied overrides are applied last so an operator can always override a script.""" + config = command_utils.ExecuteTrainConfig(extra_env_vars="MY_VAR=from_config") + + command_utils.execute_train( + train_args="", + num_gpus_per_node=8, + megatron_model_type="qwen3-4B", + extra_env_vars={"MY_VAR": "from_argument", "OTHER": "kept"}, + config=config, + ) + + runtime_env = _runtime_env(commands[-1]) + assert runtime_env["MY_VAR"] == "from_config" + assert runtime_env["OTHER"] == "kept" + + def test_addresses_the_local_dashboard_unless_ray_address_is_set(self, commands, monkeypatch): + """RAY_ADDRESS already tells the ray CLI where to go; passing --address too would conflict.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + assert '--address="http://127.0.0.1:8265"' in commands[-1] + + monkeypatch.setenv("RAY_ADDRESS", "http://10.0.0.1:8265") + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + assert "--address=" not in commands[-1] + + def test_resolves_a_relative_train_script_against_the_repo(self, commands): + """Launchers pass train.py, which only makes sense relative to the checkout.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B") + + assert f"-- python3 {command_utils.repo_base_dir}/train.py " in commands[-1] + + def test_keeps_an_absolute_train_script(self, commands): + """An absolute path is already unambiguous and must not be rewritten.""" + command_utils.execute_train( + train_args="", num_gpus_per_node=8, megatron_model_type="qwen3-4B", train_script="/opt/train.py" + ) + + assert "-- python3 /opt/train.py " in commands[-1] + + +class TestParseExtraEnvVars: + @pytest.mark.parametrize( + "text, expected", + [ + ('{"A": "1", "B": "2"}', {"A": "1", "B": "2"}), + ("A=1 B=2", {"A": "1", "B": "2"}), + ("", {}), + (" ", {}), + ], ) + def test_accepts_json_and_shell_style(self, text, expected): + """Operators pass either a JSON object or plain KEY=VALUE pairs.""" + assert command_utils._parse_extra_env_vars(text) == expected - assert [event[0] for event in events] == ["command", "command", "hook", "command"] - assert "pkill -9 sglang" in events[0][1] - assert "ray start --head" in events[1][1] - assert "ray job submit" in events[3][1] +class TestCheckHasNvlink: + @pytest.fixture + def nvlink_probe(self, monkeypatch): + def install(output: str) -> list[bool]: + captured = [] -def test_start_mooncake_master_reuses_ready_server(monkeypatch): - commands = [] - waits = [] - monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: True) - monkeypatch.setattr(command_utils, "exec_command", commands.append) - monkeypatch.setattr(command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs))) + def fake_exec_command(cmd: str, capture_output: bool = False) -> str: + captured.append(capture_output) + return output - command_utils.start_mooncake_master() + monkeypatch.setattr(command_utils, "exec_command", fake_exec_command) + return captured - assert commands == [] - assert waits == [] + return install + def test_reports_true_when_links_are_counted(self, nvlink_probe): + """A non-zero NVLink count from nvidia-smi means NVLink is present.""" + captured = nvlink_probe("4\n") -def test_start_mooncake_master_restarts_and_waits_until_ready(monkeypatch, tmp_path): - commands = [] - waits = [] - log_path = tmp_path / "mooncake master.log" - monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) - monkeypatch.setattr(command_utils, "exec_command", commands.append) - monkeypatch.setattr(command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs))) + assert command_utils.check_has_nvlink() is True + assert captured == [True] - command_utils.start_mooncake_master(rpc_port=50151, metrics_port=50152, timeout=12, log_path=log_path) + def test_reports_false_without_links(self, nvlink_probe): + """Without capture_output the real helper returns None and int(None) would abort the launch.""" + captured = nvlink_probe("0\n") - assert len(commands) == 1 - assert "pkill -x mooncake_master" in commands[0] - assert "mooncake_master --rpc_port 50151 --metrics_port 50152" in commands[0] - assert f"> {shlex.quote(str(log_path))} 2>&1 &" in commands[0] - assert waits == [(("127.0.0.1", 50151), {"timeout": 12})] + assert command_utils.check_has_nvlink() is False + assert captured == [True] -def test_start_mooncake_master_reports_log_when_startup_fails(monkeypatch, tmp_path): - log_path = tmp_path / "mooncake_master.log" - log_path.write_text("bind failed\nfatal startup error\n") - commands = [] - monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) - monkeypatch.setattr(command_utils, "exec_command", commands.append) +class TestGetDefaultWandbArgs: + def test_is_empty_without_an_api_key(self, monkeypatch): + """Unconfigured wandb must not inject half-populated flags.""" + monkeypatch.delenv("WANDB_API_KEY", raising=False) - def fail_wait(*args, **kwargs): - raise RuntimeError("not ready") + assert command_utils.get_default_wandb_args("tests/fast/utils/test_thing.py") == "" - monkeypatch.setattr(command_utils, "wait_for_server_ready", fail_wait) + def test_names_the_project_after_the_test_file(self, monkeypatch): + """The project name is how runs are found later, so it tracks the test file.""" + monkeypatch.setenv("WANDB_API_KEY", "secret") + monkeypatch.delenv("GITHUB_COMMIT_NAME", raising=False) - with pytest.raises(RuntimeError, match="fatal startup error"): - command_utils.start_mooncake_master(log_path=log_path) + args = command_utils.get_default_wandb_args("tests/e2e/megatron/test_qwen3_4b.py", run_id="RUNID") - assert len(commands) == 2 - assert all("pkill -x mooncake_master" in command for command in commands) + assert "--use-wandb " in args + assert "--wandb-project miles-test_qwen3_4b " in args + assert "--wandb-group RUNID " in args + assert "--wandb-key 'secret' " in args + def test_qualifies_a_short_test_name_with_its_directory(self, monkeypatch): + """Short stems like 'run.py' are ambiguous on their own.""" + monkeypatch.setenv("WANDB_API_KEY", "secret") -@pytest.mark.parametrize("hardware", ["H100", "GB200", "GB300", "MI350X", "MI355X"]) -def test_every_supported_hardware_declares_its_gpus_per_node(hardware): - """A launcher whose default hardware is missing here raises KeyError before doing anything.""" - assert command_utils.NUM_GPUS_OF_HARDWARE[hardware] > 0 + args = command_utils.get_default_wandb_args("tests/e2e/megatron/run.py", run_id="RUNID") + assert "--wandb-project miles-megatron_run " in args -def test_rsync_simple_limits_itself_to_the_requested_node_count(monkeypatch): - """prepare_cp asks for the training node count; forwarding it is the whole point of the argument.""" - calls = [] - monkeypatch.setattr(command_utils, "exec_command_all_ray_node", lambda cmd, **kwargs: calls.append(kwargs)) + def test_decorates_the_group_with_commit_and_prefix(self, monkeypatch): + """CI runs need the commit in the group name, and callers may add their own prefix.""" + monkeypatch.setenv("WANDB_API_KEY", "secret") + monkeypatch.setenv("GITHUB_COMMIT_NAME", "abc123") - command_utils.rsync_simple("/src", "/dst", num_nodes=4) + args = command_utils.get_default_wandb_args("tests/e2e/megatron/test_qwen3_4b.py", "myprefix", run_id="RUNID") - assert calls == [{"num_nodes": 4}] + assert "--wandb-group myprefix_RUNID_abc123 " in args -class TestExecuteTrainConfig: - def test_num_nodes_reads_the_slurm_allocation_when_the_config_is_built(self, monkeypatch): - """A plain class-level default would bake in the allocation at import and ignore later changes.""" - monkeypatch.setenv("SLURM_JOB_NUM_NODES", "8") - assert command_utils.ExecuteTrainConfig().num_nodes == 8 +class TestCreateRunId: + def test_is_a_timestamp_with_a_random_suffix(self): + """Concurrent runs on one machine must not collide on the run id.""" + date_part, time_part, random_part = command_utils.create_run_id().split("-") - monkeypatch.delenv("SLURM_JOB_NUM_NODES") - assert command_utils.ExecuteTrainConfig().num_nodes == 1 + assert len(date_part) == 6 and date_part.isdigit() + assert len(time_part) == 6 and time_part.isdigit() + assert len(random_part) == 3 and random_part.isdigit() + + def test_varies_within_the_same_second(self): + """Runs launched together in one second must not share a wandb group or dump directory.""" + suffixes = {command_utils.create_run_id().split("-")[2] for _ in range(50)} + + assert len(suffixes) > 1 + + +class TestGetBoolEnvVar: + @pytest.mark.parametrize( + "value, expected", + [("true", True), ("TRUE", True), ("1", True), ("false", False), ("0", False), ("maybe", False)], + ) + def test_understands_the_usual_spellings(self, monkeypatch, value, expected): + """Anything not recognizably truthy is treated as false rather than raising.""" + monkeypatch.setenv("SOME_FLAG", value) + + assert command_utils.get_bool_env_var("SOME_FLAG") is expected + + def test_falls_back_to_the_supplied_default(self, monkeypatch): + """An unset variable takes the default, which is itself parsed as a string.""" + monkeypatch.delenv("SOME_FLAG", raising=False) + + assert command_utils.get_bool_env_var("SOME_FLAG") is False + assert command_utils.get_bool_env_var("SOME_FLAG", "1") is True + + +class TestGetEnvEnableInfiniteRun: + def test_defaults_to_off(self, monkeypatch): + """Infinite runs must be opt-in; a stuck CI job is expensive.""" + monkeypatch.delenv("MILES_TEST_ENABLE_INFINITE_RUN", raising=False) + assert command_utils.get_env_enable_infinite_run() is False + + monkeypatch.setenv("MILES_TEST_ENABLE_INFINITE_RUN", "true") + assert command_utils.get_env_enable_infinite_run() is True + + +class TestSaveToTempFile: + def test_writes_the_content_and_returns_a_unique_path(self): + """Config text handed to a subprocess has to exist on disk under a collision-free name.""" + first = command_utils.save_to_temp_file("hello: world", "yaml") + second = command_utils.save_to_temp_file("hello: world", "yaml") + + assert first != second + assert first.endswith(".yaml") + with open(first) as f: + assert f.read() == "hello: world" + + +class TestHardwareTables: + @pytest.mark.parametrize("hardware", ["H100", "GB200", "GB300", "MI350X", "MI355X"]) + def test_every_supported_hardware_declares_its_gpus_per_node(self, hardware): + """A launcher whose default hardware is missing here raises KeyError before doing anything.""" + assert command_utils.NUM_GPUS_OF_HARDWARE[hardware] > 0 + + def test_every_hardware_with_a_generation_also_has_a_gpu_count(self): + """Every launcher reads the GPU count, while only some read the generation.""" + assert command_utils.GENERATION_HARDWARE.keys() <= command_utils.NUM_GPUS_OF_HARDWARE.keys() From e3a1b0bf522564ec77e19aeb972cf69b73ecc5e1 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 15:17:34 +0800 Subject: [PATCH 09/18] Rename exec_command by the resource its command needs Squashed from: - Rename exec_command by the resource its command needs - Point the nvlink and single-node conversion tests at the gpu helper - Re-record the multi-node label the rename changed - Rename the last two exec_command call sites the split missed - Re-record the multi-node label in the rsync_simple test too --- docker/npu_patch/miles.patch | 6 +-- .../single_round/kimina_wrapper.py | 6 +-- .../formal_math/single_round/run.py | 4 +- .../formal_math/single_round/run_sft.py | 4 +- .../openenv/openenv_launch_common.py | 2 +- examples/experimental/verifiers/run.py | 2 +- .../run_qwen3_30b_a3b_fully_async.py | 4 +- .../run_qwen3_5_4b_fully_async_eval.py | 4 +- .../multi_turn/run_geo3k_vlm_multi_turn.py | 6 +-- .../random_async/run_random_async_3node.py | 6 +-- .../true_on_policy/run_simple.py | 4 +- .../true_on_policy/run_simple_amd_triton.py | 4 +- examples/multi_lora/run_multi_lora.py | 4 +- examples/retool_v2/run_retool_multi_turn.py | 14 +++---- .../run_megatron/cli/commands/compare.py | 4 +- .../run_megatron/cli/commands/run.py | 6 +-- miles/utils/external_utils/command_utils.py | 26 ++++++------- miles/utils/misc.py | 16 +++++--- .../utils/test_utils/session_verify_runner.py | 2 +- scripts/amd/run_deepseek_v4.py | 4 +- scripts/amd/run_qwen3_30b_a3b.py | 8 ++-- scripts/run_deepseek.py | 6 ++- scripts/run_deepseek_v32.py | 10 ++--- scripts/run_deepseek_v4.py | 6 +-- scripts/run_gemma_4_26b_a4b.py | 6 ++- scripts/run_gemma_4_31b.py | 6 ++- scripts/run_glm45_355b_a32b.py | 8 ++-- scripts/run_glm47_flash.py | 4 +- scripts/run_glm5_1_744b_a40b_lora.py | 4 +- scripts/run_glm5_2_744b_a40b.py | 8 ++-- scripts/run_glm5_2_744b_a40b_lora.py | 4 +- scripts/run_glm5_744b_a40b.py | 8 ++-- scripts/run_joy_ai_llm_flash.py | 8 ++-- scripts/run_kimi_k25.py | 8 ++-- scripts/run_mcore_fsdp.py | 4 +- scripts/run_nemotron_3_nano_4b_fsdp.py | 6 +-- scripts/run_nemotron_3_ultra_550b_a55b.py | 4 +- scripts/run_qwen3_0_6b_fsdp.py | 6 +-- scripts/run_qwen3_30b_a3b.py | 14 ++++--- scripts/run_qwen3_30b_a3b_fsdp.py | 6 +-- scripts/run_qwen3_4b.py | 8 ++-- scripts/run_qwen3_4b_npu.py | 6 +-- scripts/run_qwen3_5_35b_a3b_lora.py | 4 +- scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py | 4 +- scripts/run_qwen3_6_35b_a3b_mtp.py | 8 ++-- tests/e2e/ckpt/test_glm47_flash_ckpt.py | 6 +-- tests/e2e/ckpt/test_qwen3_4B_ckpt.py | 6 +-- tests/e2e/fsdp/r3/_common.py | 4 +- .../fsdp/test_qwen3_0.6B_fsdp_distributed.py | 4 +- .../test_qwen3_0.6B_megatron_fsdp_align.py | 4 +- .../test_qwen3_4B_fsdp_hybrid_shard_r2s2.py | 4 +- .../test_qwen3_4B_fsdp_hybrid_shard_r2s4.py | 4 +- .../fsdp/test_qwen3_4B_fsdp_true_on_policy.py | 4 +- tests/e2e/fsdp/test_qwen3_vl_4B_fsdp.py | 4 +- tests/e2e/ft/conftest_ft/execution.py | 4 +- .../conftest_ft/scenario_realistic_gsm8k.py | 4 +- tests/e2e/long/test_qwen2.5_0.5B_gsm8k.py | 4 +- .../e2e/long/test_qwen2.5_0.5B_gsm8k_async.py | 4 +- tests/e2e/long/test_qwen3_0.6B_verifiers.py | 12 +++--- tests/e2e/lora/test_lora_qwen2.5_0.5B.py | 6 +-- .../test_deepseek_v32_5layer_mxfp8.py | 6 +-- .../test_glm5_1_744b_a40b_6layer_lora_ci.py | 4 +- .../test_glm5_2_744b_a40b_5layer_ci.py | 2 +- .../test_glm5_2_744b_a40b_5layer_lora_ci.py | 4 +- .../test_glm5_744b_a40b_4layer_ci.py | 2 +- .../test_glm5_744b_a40b_4layer_r3.py | 2 +- .../test_gpt_oss_20b_moe_lora_ci.py | 10 +++-- .../test_inkling_small_4layer_ci.py | 4 +- .../test_inkling_small_4layer_lora_ci.py | 4 +- .../model_scripts/test_kimi_k25_2layer_ci.py | 2 +- .../test_nemotron_3_ultra_4layer_ci.py | 2 +- .../e2e/megatron/test_glm47_flash/_common.py | 4 +- .../test_glm5_2_744b_a40b_5layer_nvfp4.py | 8 ++-- .../megatron/test_mimo_7B_mtp_only_grad.py | 4 +- .../e2e/megatron/test_quick_start_glm4_9B.py | 4 +- .../megatron/test_qwen3_30B_A3B/_common.py | 8 ++-- tests/e2e/megatron/test_qwen3_30B_A3B_p2p.py | 4 +- .../e2e/megatron/test_qwen3_4B_disk_delta.py | 4 +- .../megatron/test_qwen3_4B_offload_disk.py | 4 +- .../test_qwen3_4B_offload_disk_stream.py | 4 +- tests/e2e/megatron/test_qwen3_4B_ppo.py | 4 +- .../megatron/test_qwen3_4B_variable_gbs.py | 4 +- .../test_qwen3_4b_fully_async_eval.py | 4 +- tests/e2e/megatron/test_qwen3_5_35B_A3B_cp.py | 4 +- .../test_qwen3_5_35B_A3B_mtp/_common.py | 4 +- .../megatron/test_qwen3_5_35b_a3b_lora_ci.py | 2 +- .../test_qwen3_0.6B_parallel_check.py | 4 +- .../e2e/sglang/test_r3_router_equivalence.py | 4 +- tests/e2e/sglang_config/test_sglang_config.py | 4 +- .../test_sglang_config_mixed_offload.py | 4 +- .../test_sglang_config_mixed_offload_ft.py | 4 +- tests/e2e/short/test_dumper.py | 6 +-- .../test_qwen2.5_0.5B_compact_rollout.py | 4 +- .../test_qwen2.5_0.5B_fully_async_eval.py | 4 +- .../test_qwen2.5_0.5B_gsm8k_async_short.py | 4 +- .../short/test_qwen2.5_0.5B_gsm8k_short.py | 4 +- .../e2e/short/test_qwen2.5_0.5B_opd_sglang.py | 6 +-- .../test_qwen3_0.6B_fsdp_colocated_2xGPU.py | 4 +- tests/e2e/short/test_run_megatron.py | 12 +++--- .../test_shell_script_hygiene.py | 37 ++++++++++++++----- tests/fast/utils/command_recorder.py | 9 +++-- .../run_megatron/cli/commands/test_compare.py | 22 +++++------ .../run_megatron/cli/commands/test_run.py | 4 +- tests/fast/utils/test_command_utils.py | 22 +++++------ .../amd/run_deepseek_v4.py/prepare_cp.txt | 4 +- .../py/scripts/run_deepseek.py/train.txt | 6 +-- .../run_deepseek_v32.py/full_train.txt | 2 +- .../scripts/run_deepseek_v32.py/prepare.txt | 2 +- .../run_deepseek_v32.py/prepare_cp.txt | 4 +- .../prepare_megatron_ckpt.txt | 2 +- .../scripts/run_deepseek_v4.py/prepare_cp.txt | 4 +- .../scripts/run_glm45_355b_a32b.py/train.txt | 6 +-- .../run_glm5_2_744b_a40b.py/full_train.txt | 6 +-- .../run_glm5_2_744b_a40b.py/prepare.txt | 2 +- .../run_glm5_2_744b_a40b.py/prepare_cp.txt | 4 +- .../run_glm5_744b_a40b.py/full_train.txt | 6 +-- .../scripts/run_glm5_744b_a40b.py/prepare.txt | 2 +- .../run_glm5_744b_a40b.py/prepare_cp.txt | 4 +- .../py/scripts/run_inkling.py/prepare_cp.txt | 2 +- tests/test_external_rollout.py | 4 +- 120 files changed, 370 insertions(+), 322 deletions(-) diff --git a/docker/npu_patch/miles.patch b/docker/npu_patch/miles.patch index 19af8a0c56..9b9a02d61d 100644 --- a/docker/npu_patch/miles.patch +++ b/docker/npu_patch/miles.patch @@ -364,7 +364,7 @@ index d016e01ac..08b4d6eff 100644 + train_backend_fsdp = "--train-backend fsdp" in train_args + assert train_backend_fsdp == (megatron_model_type is None) + -+ exec_command( ++ exec_command_cpu( + "pkill -9 sglang; " + "sleep 3; " + f"{'' if external_ray else 'ray stop --force; '}" @@ -381,7 +381,7 @@ index d016e01ac..08b4d6eff 100644 + ) + + if not external_ray: -+ exec_command( ++ exec_command_cpu( + # will prevent ray from buffering stdout/stderr + f"export PYTHONUNBUFFERED=1 && " + f"ray start --head --node-ip-address {master_addr} --disable-usage-stats " @@ -439,7 +439,7 @@ index d016e01ac..08b4d6eff 100644 + if megatron_model_type is not None + else "" + ) -+ exec_command( ++ exec_command_cpu( + f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " + f"{cmd_megatron_model_source}" + f'ray job submit --address="http://127.0.0.1:8265" ' diff --git a/examples/experimental/formal_math/single_round/kimina_wrapper.py b/examples/experimental/formal_math/single_round/kimina_wrapper.py index 1f400fa159..ffcaf227f7 100644 --- a/examples/experimental/formal_math/single_round/kimina_wrapper.py +++ b/examples/experimental/formal_math/single_round/kimina_wrapper.py @@ -8,7 +8,7 @@ from kimina_client import AsyncKiminaClient, CheckResponse from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy -from miles.utils.misc import exec_command, get_free_port +from miles.utils.misc import exec_command_cpu, get_free_port # TODO handle docker stop more gracefully later _KILL_PREVIOUS_KIMINA_DOCKER = bool(int(os.environ.get("MILES_KILL_PREVIOUS_KIMINA_DOCKER", "1"))) @@ -72,7 +72,7 @@ def _docker_start(port: int): docker_name = ( f"kimina_lean_server_auto_{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}-{random.randint(0, 1000000)}" ) - exec_command( + exec_command_cpu( "docker run " "-d " f"--name {docker_name} " @@ -99,7 +99,7 @@ def _wait_server_ready(base_url: str): def _docker_stop_all(): - exec_command( + exec_command_cpu( 'ids=$(docker ps -a --filter "name=kimina_lean_server_auto" -q); ' '[ -n "$ids" ] && docker stop $ids && docker rm $ids; ' "true" diff --git a/examples/experimental/formal_math/single_round/run.py b/examples/experimental/formal_math/single_round/run.py index 5ae17ba003..fd12930a1c 100644 --- a/examples/experimental/formal_math/single_round/run.py +++ b/examples/experimental/formal_math/single_round/run.py @@ -22,8 +22,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") if arg_ref_load is None: U.convert_checkpoint( model_name=MODEL_NAME, diff --git a/examples/experimental/formal_math/single_round/run_sft.py b/examples/experimental/formal_math/single_round/run_sft.py index f24f79e3a9..882e3ca711 100644 --- a/examples/experimental/formal_math/single_round/run_sft.py +++ b/examples/experimental/formal_math/single_round/run_sft.py @@ -12,8 +12,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/examples/experimental/openenv/openenv_launch_common.py b/examples/experimental/openenv/openenv_launch_common.py index c41f1dd1a0..40b7957f9b 100644 --- a/examples/experimental/openenv/openenv_launch_common.py +++ b/examples/experimental/openenv/openenv_launch_common.py @@ -267,7 +267,7 @@ def _sandbox_key_supply( get the provider key from their OWN environment (e.g. platform-injected) or from a file they can read (a dotfile, K8s Secret mount, or shared-FS path). The launcher forwards only the file PATH, never the value: worker - env rides ray's runtime_env, which exec_command echoes into driver logs + env rides ray's runtime_env, which exec_command_cpu echoes into driver logs and ray persists in job metadata, all in plaintext.""" key_file = Path(arg_path or default_path).expanduser() try: diff --git a/examples/experimental/verifiers/run.py b/examples/experimental/verifiers/run.py index 4756c7b213..6fc0e86e82 100644 --- a/examples/experimental/verifiers/run.py +++ b/examples/experimental/verifiers/run.py @@ -60,7 +60,7 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.hf_checkpoint}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.hf_checkpoint}") U.convert_checkpoint( model_name=args.model_name, megatron_model_type=args.megatron_model_type, diff --git a/examples/fully_async/run_qwen3_30b_a3b_fully_async.py b/examples/fully_async/run_qwen3_30b_a3b_fully_async.py index b0e69ba9b9..73f225aa8c 100644 --- a/examples/fully_async/run_qwen3_30b_a3b_fully_async.py +++ b/examples/fully_async/run_qwen3_30b_a3b_fully_async.py @@ -31,8 +31,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.convert_checkpoint( model_name=args.model_name, diff --git a/examples/fully_async/run_qwen3_5_4b_fully_async_eval.py b/examples/fully_async/run_qwen3_5_4b_fully_async_eval.py index d147849ab9..43e9b20e92 100644 --- a/examples/fully_async/run_qwen3_5_4b_fully_async_eval.py +++ b/examples/fully_async/run_qwen3_5_4b_fully_async_eval.py @@ -36,8 +36,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) U.convert_checkpoint( diff --git a/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py b/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py index 9c3809cb73..3bbc4ec0ea 100644 --- a/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py +++ b/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py @@ -30,11 +30,11 @@ def get_megatron_model_type(model_name: str) -> str: def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") data_missing = not os.path.exists(TRAIN_DATA_PATH) if data_missing: - U.exec_command(f"hf download --repo-type dataset {DATASET_NAME} --local-dir {DATA_ROOT}") + U.exec_command_cpu(f"hf download --repo-type dataset {DATASET_NAME} --local-dir {DATA_ROOT}") if not os.path.exists(TRAIN_DATA_PATH): raise FileNotFoundError(f"Dataset not found. Expected local dataset at {TRAIN_DATA_PATH}; ") diff --git a/examples/infra_features/random_async/run_random_async_3node.py b/examples/infra_features/random_async/run_random_async_3node.py index e30a6f8b82..36b7bae896 100644 --- a/examples/infra_features/random_async/run_random_async_3node.py +++ b/examples/infra_features/random_async/run_random_async_3node.py @@ -26,13 +26,13 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir}") - U.exec_command( + U.exec_command_cpu(f"mkdir -p {args.model_dir}") + U.exec_command_cpu( f'test "$(cat {args.model_dir}/{args.model_name}_torch_dist/latest_checkpointed_iteration.txt 2>/dev/null)" = release || ' f"test -e {args.model_dir}/{args.model_name} || " f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" ) - U.exec_command( + U.exec_command_cpu( f"test -e {args.model_dir}/{args.model_name}-FP8 || " f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8" ) diff --git a/examples/infra_features/true_on_policy/run_simple.py b/examples/infra_features/true_on_policy/run_simple.py index 7e317195de..1b81076b7f 100644 --- a/examples/infra_features/true_on_policy/run_simple.py +++ b/examples/infra_features/true_on_policy/run_simple.py @@ -13,8 +13,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/examples/infra_features/true_on_policy/run_simple_amd_triton.py b/examples/infra_features/true_on_policy/run_simple_amd_triton.py index 02ae661f6b..05509fd6c4 100644 --- a/examples/infra_features/true_on_policy/run_simple_amd_triton.py +++ b/examples/infra_features/true_on_policy/run_simple_amd_triton.py @@ -18,8 +18,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/examples/multi_lora/run_multi_lora.py b/examples/multi_lora/run_multi_lora.py index 701a05db93..417d14af65 100644 --- a/examples/multi_lora/run_multi_lora.py +++ b/examples/multi_lora/run_multi_lora.py @@ -75,8 +75,8 @@ def __post_init__(self): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.data_dir} {args.model_dir}") - U.exec_command(f"hf download Qwen/Qwen3-4B --local-dir {args.model_dir}/Qwen3-4B") + U.exec_command_cpu(f"mkdir -p {args.data_dir} {args.model_dir}") + U.exec_command_cpu(f"hf download Qwen/Qwen3-4B --local-dir {args.model_dir}/Qwen3-4B") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/gsm8k", data_dir=args.data_dir) diff --git a/examples/retool_v2/run_retool_multi_turn.py b/examples/retool_v2/run_retool_multi_turn.py index 1031eba790..421001d4ee 100644 --- a/examples/retool_v2/run_retool_multi_turn.py +++ b/examples/retool_v2/run_retool_multi_turn.py @@ -48,13 +48,13 @@ def _get_wandb_args() -> str: def prepare(args: ScriptArgs): - U.exec_command("mkdir -p /root/dapo-math-17k /root/aime-2024") - U.exec_command("hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/dapo-math-17k") - U.exec_command("hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-2024") + U.exec_command_cpu("mkdir -p /root/dapo-math-17k /root/aime-2024") + U.exec_command_cpu("hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/dapo-math-17k") + U.exec_command_cpu("hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-2024") if args.use_sft_model: - U.exec_command("mkdir -p /root/font-info") - U.exec_command(f"hf download font-info/qwen3-4b-sft-SGLang-RL --local-dir {args.hf_checkpoint}") + U.exec_command_cpu("mkdir -p /root/font-info") + U.exec_command_cpu(f"hf download font-info/qwen3-4b-sft-SGLang-RL --local-dir {args.hf_checkpoint}") U.convert_checkpoint( model_name="qwen3-4b-sft", megatron_model_type="qwen3-4B", @@ -63,8 +63,8 @@ def prepare(args: ScriptArgs): dir_dst="/root/font-info", ) else: - U.exec_command("mkdir -p /root/models") - U.exec_command("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") + U.exec_command_cpu("mkdir -p /root/models") + U.exec_command_cpu("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") U.convert_checkpoint( model_name="Qwen3-4B", megatron_model_type="qwen3-4B", diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/compare.py b/miles/utils/debug_utils/run_megatron/cli/commands/compare.py index 375c9c9fe7..7a5b9d95c7 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/compare.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/compare.py @@ -7,7 +7,7 @@ from miles.utils.debug_utils.run_megatron.cli.commands.args import CompareArgs from miles.utils.debug_utils.run_megatron.logprob_comparator import compare_logprobs -from miles.utils.misc import exec_command +from miles.utils.misc import exec_command_cpu from miles.utils.typer_utils import dataclass_cli @@ -66,7 +66,7 @@ def _run_activation_comparison(args: CompareArgs) -> bool: cmd_parts.extend([flag, str(value)]) try: - exec_command(" ".join(cmd_parts)) + exec_command_cpu(" ".join(cmd_parts)) return True except subprocess.CalledProcessError: print("[cli] Activation comparison failed", flush=True) diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/run.py b/miles/utils/debug_utils/run_megatron/cli/commands/run.py index f6ff771915..bad142ce0f 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/run.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/run.py @@ -19,7 +19,7 @@ build_worker_args, ) from miles.utils.debug_utils.run_megatron.worker.script_args import WorkerScriptArgs -from miles.utils.misc import exec_command +from miles.utils.misc import exec_command_cpu, exec_command_gpu from miles.utils.typer_utils import dataclass_cli @@ -83,7 +83,7 @@ def run_impl(args: RunArgs) -> None: nproc=parallel.nproc, worker_args=worker_args_str, ) - exec_command(f"{env_exports} && {cmd}") + exec_command_gpu(f"{env_exports} && {cmd}") print(f"[cli] Run completed. Output: {args.output_dir}", flush=True) @@ -97,7 +97,7 @@ def show_model_args( model_type: Annotated[str, typer.Option(help="Model type matching scripts/models/{model_type}.sh")], ) -> None: """Show the MODEL_ARGS for a given model type (debug helper).""" - output: str | None = exec_command( + output: str | None = exec_command_cpu( f'source "{resolve_model_script(model_type)}" && echo "${{MODEL_ARGS[@]}}"', capture_output=True, ) diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index 01b76b34b3..8d8e0bf149 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -14,10 +14,10 @@ from pathlib import Path from miles.utils.http_utils import wait_for_server_ready -from miles.utils.misc import exec_command, exec_command_all_ray_node +from miles.utils.misc import exec_command_cpu, exec_command_gpu, exec_command_multi_node from miles.utils.typer_utils import dataclass_cli -_ = exec_command, exec_command_all_ray_node, dataclass_cli +_ = exec_command_cpu, exec_command_gpu, exec_command_multi_node, dataclass_cli repo_base_dir = Path(os.path.abspath(__file__)).resolve().parents[3] @@ -57,9 +57,9 @@ def convert_checkpoint( ) if multinode: - fn = partial(exec_command_all_ray_node, num_nodes=num_nodes) + fn = partial(exec_command_multi_node, num_nodes=num_nodes) else: - fn = exec_command + fn = exec_command_gpu pythonpath = shlex.quote(_pythonpath_with_sources(megatron_path)) fn( f"source {repo_base_dir}/scripts/models/{megatron_model_type}.sh && " @@ -76,14 +76,14 @@ def convert_checkpoint( def rsync_simple(path_src: str, path_dst: str, num_nodes: int | None = None): - exec_command_all_ray_node( + exec_command_multi_node( f"mkdir -p {path_dst} && rsync -a --info=progress2 {path_src}/ {path_dst}", num_nodes=num_nodes ) def hf_download_dataset(full_name: str, data_dir: str = "/root/datasets"): _, partial_name = full_name.split("/") - exec_command(f"hf download --repo-type dataset {full_name} --local-dir {data_dir}/{partial_name}") + exec_command_cpu(f"hf download --repo-type dataset {full_name} --local-dir {data_dir}/{partial_name}") def fp8_cast_bf16(path_src, path_dst): @@ -92,7 +92,7 @@ def fp8_cast_bf16(path_src, path_dst): print(f"fp8_cast_bf16 skip {path_dst} since {sentinel} exists") return - exec_command( + exec_command_gpu( f"python {repo_base_dir}/tools/fp8_cast_bf16.py " f"--input-fp8-hf-path {path_src} " f"--output-bf16-hf-path {path_dst} " @@ -130,7 +130,7 @@ def execute_train( train_backend_fsdp = "--train-backend fsdp" in train_args assert train_backend_fsdp == (megatron_model_type is None) - exec_command( + exec_command_cpu( "pkill -9 sglang; " "sleep 3; " f"{'' if external_ray else 'ray stop --force; '}" @@ -148,7 +148,7 @@ def execute_train( ) if not external_ray: - exec_command( + exec_command_cpu( # will prevent ray from buffering stdout/stderr f"export PYTHONUNBUFFERED=1 && " f"ray start --head --node-ip-address {master_addr} --num-gpus {num_gpus_per_node} --disable-usage-stats" @@ -199,7 +199,7 @@ def execute_train( if megatron_model_type is not None else "" ) - exec_command( + exec_command_cpu( f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " f"{cmd_megatron_model_source}" f"""ray job submit {'' if 'RAY_ADDRESS' in os.environ else '--address="http://127.0.0.1:8265" '}""" @@ -218,7 +218,7 @@ def _parse_extra_env_vars(text: str): def check_has_nvlink(): - output = exec_command("nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l", capture_output=True) + output = exec_command_gpu("nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l", capture_output=True) return int(output) > 0 @@ -312,7 +312,7 @@ def start_mooncake_master( log_path = Path(log_path) quoted_log_path = shlex.quote(str(log_path)) - exec_command( + exec_command_cpu( "pkill -x mooncake_master >/dev/null 2>&1 || true; " f"(setsid mooncake_master --rpc_port {rpc_port} --metrics_port {metrics_port} " f"> {quoted_log_path} 2>&1 &)" @@ -320,7 +320,7 @@ def start_mooncake_master( try: wait_for_server_ready(host, rpc_port, timeout=timeout) except RuntimeError as exc: - exec_command("pkill -x mooncake_master >/dev/null 2>&1 || true") + exec_command_cpu("pkill -x mooncake_master >/dev/null 2>&1 || true") try: log_lines = log_path.read_text(errors="replace").splitlines() log_tail = "\n".join(log_lines[-100:]) or "" diff --git a/miles/utils/misc.py b/miles/utils/misc.py index 8136b58868..48786f9a48 100644 --- a/miles/utils/misc.py +++ b/miles/utils/misc.py @@ -115,7 +115,15 @@ def clear_all_instances(): SingletonMeta._instances.clear() -def exec_command(cmd: str, capture_output: bool = False) -> str | None: +def exec_command_gpu(cmd: str, capture_output: bool = False) -> str | None: + return _exec_command(cmd, capture_output=capture_output) + + +def exec_command_cpu(cmd: str, capture_output: bool = False) -> str | None: + return _exec_command(cmd, capture_output=capture_output) + + +def _exec_command(cmd: str, capture_output: bool = False) -> str | None: print(f"EXEC: {cmd}", flush=True) try: @@ -138,12 +146,10 @@ def exec_command(cmd: str, capture_output: bool = False) -> str | None: @ray.remote(num_cpus=0.001) def _exec_command_on_node(cmd: str, capture_output: bool) -> str | None: - return exec_command(f"unset CUDA_VISIBLE_DEVICES; {cmd}", capture_output=capture_output) + return _exec_command(f"unset CUDA_VISIBLE_DEVICES; {cmd}", capture_output=capture_output) -def exec_command_all_ray_node( - cmd: str, capture_output: bool = False, num_nodes: int | None = None -) -> list[str | None]: +def exec_command_multi_node(cmd: str, capture_output: bool = False, num_nodes: int | None = None) -> list[str | None]: """Execute a shell command on every alive Ray node in parallel. Supported placeholders in `cmd` (replaced per-node before execution): diff --git a/miles/utils/test_utils/session_verify_runner.py b/miles/utils/test_utils/session_verify_runner.py index 3479f0eb8e..42e1445f33 100644 --- a/miles/utils/test_utils/session_verify_runner.py +++ b/miles/utils/test_utils/session_verify_runner.py @@ -120,7 +120,7 @@ def _ensure_model_downloaded(hf_checkpoint: str) -> str: short = hf_checkpoint.split("/")[-1] local_dir = os.path.join(LOCAL_MODELS_ROOT, short) os.makedirs(LOCAL_MODELS_ROOT, exist_ok=True) - U.exec_command(f"hf download {hf_checkpoint} --local-dir {local_dir}") + U.exec_command_cpu(f"hf download {hf_checkpoint} --local-dir {local_dir}") return local_dir diff --git a/scripts/amd/run_deepseek_v4.py b/scripts/amd/run_deepseek_v4.py index dd95553e04..f48bca7507 100644 --- a/scripts/amd/run_deepseek_v4.py +++ b/scripts/amd/run_deepseek_v4.py @@ -159,12 +159,12 @@ def _ensure_4layer_model_type(args: ScriptArgs): def _prepare_download(args: ScriptArgs): """Download HF checkpoint + task dataset. Idempotent: hf skips existing blobs.""" - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") # Only download if the user has NOT supplied a pre-existing checkpoint dir. # (prepare_single / train with --hf-checkpoint bypass this.) if args.hf_checkpoint is None: dest = f"{args.model_dir}/{args.model_name}" - U.exec_command(f"hf download {args.model_org}/{args.model_name} " f"--local-dir {dest}") + U.exec_command_cpu(f"hf download {args.model_org}/{args.model_name} " f"--local-dir {dest}") _ensure_4layer_model_type(args) _download_dataset(args) diff --git a/scripts/amd/run_qwen3_30b_a3b.py b/scripts/amd/run_qwen3_30b_a3b.py index 56cd8f2bb5..1857225eff 100644 --- a/scripts/amd/run_qwen3_30b_a3b.py +++ b/scripts/amd/run_qwen3_30b_a3b.py @@ -31,13 +31,15 @@ def __post_init__(self): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) if args.rollout_fp8: - U.exec_command(f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8") + U.exec_command_cpu( + f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8" + ) if not args.enable_megatron_bridge: U.convert_checkpoint( diff --git a/scripts/run_deepseek.py b/scripts/run_deepseek.py index adc972ba2b..28df700fd7 100644 --- a/scripts/run_deepseek.py +++ b/scripts/run_deepseek.py @@ -36,8 +36,10 @@ def __post_init__(self): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) match args.task: case "dapo_aime": U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) diff --git a/scripts/run_deepseek_v32.py b/scripts/run_deepseek_v32.py index cf5446ce8e..fde825e7f3 100644 --- a/scripts/run_deepseek_v32.py +++ b/scripts/run_deepseek_v32.py @@ -57,13 +57,13 @@ def __post_init__(self): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") if args.from_bf16_ckpt: - U.exec_command( + U.exec_command_cpu( f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}-bf16" ) else: - U.exec_command( + U.exec_command_cpu( f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) @@ -85,7 +85,7 @@ def _prepare_mxfp8_ckpt(args: ScriptArgs): extra_args += ( f" --extra-high-precision-layers-hf {' '.join(DEFAULT_MXFP8_EXTRA_HIGH_PRECISION_LAYERS_HF)} " ) - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_mxfp8.py --model-dir {args.model_dir}/{args.model_name}-bf16 " f"--save-dir {args.model_dir}/{args.model_name}-MXFP8 " f"{extra_args} " @@ -95,7 +95,7 @@ def _prepare_mxfp8_ckpt(args: ScriptArgs): def _prepare_fp8_ckpt(args: ScriptArgs): """Convert BF16 checkpoint to block-quant FP8 (for sglang rollout, no MXFP8).""" if args.rollout_fp8: - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_fp8.py " f"--model-dir {args.model_dir}/{args.model_name}-bf16 " f"--save-dir {args.model_dir}/{args.model_name}-FP8 " diff --git a/scripts/run_deepseek_v4.py b/scripts/run_deepseek_v4.py index 83aae5d768..283800d6cd 100644 --- a/scripts/run_deepseek_v4.py +++ b/scripts/run_deepseek_v4.py @@ -217,12 +217,12 @@ def _ensure_4layer_model_type(args: ScriptArgs): def _prepare_download(args: ScriptArgs): """Download HF checkpoint + task dataset. Idempotent: hf skips existing blobs.""" - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") # Only download if the user has NOT supplied a pre-existing checkpoint dir. # (prepare_single / train with --hf-checkpoint bypass this.) if args.hf_checkpoint is None: dest = f"{args.model_dir}/{args.model_name}" - U.exec_command(f"hf download {args.model_org}/{args.model_name} " f"--local-dir {dest}") + U.exec_command_cpu(f"hf download {args.model_org}/{args.model_name} " f"--local-dir {dest}") _ensure_4layer_model_type(args) _download_dataset(args) @@ -260,7 +260,7 @@ def _prepare_mxfp8(args: ScriptArgs): if not args.rollout_mxfp8: return assert _is_blackwell(args), "rollout_mxfp8 requires Blackwell (B200/B300/GB200/GB300)" - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_mxfp8.py " f"--model-dir {args.model_dir}/{args.bf16_name} " f"--save-dir {args.model_dir}/{args.mxfp8_name} " diff --git a/scripts/run_gemma_4_26b_a4b.py b/scripts/run_gemma_4_26b_a4b.py index 45498bc367..f654badc13 100644 --- a/scripts/run_gemma_4_26b_a4b.py +++ b/scripts/run_gemma_4_26b_a4b.py @@ -42,8 +42,10 @@ def __post_init__(self): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) if args.enable_eval: U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) diff --git a/scripts/run_gemma_4_31b.py b/scripts/run_gemma_4_31b.py index 84129b56c7..8e8f40a67a 100644 --- a/scripts/run_gemma_4_31b.py +++ b/scripts/run_gemma_4_31b.py @@ -45,8 +45,10 @@ def __post_init__(self): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) if args.enable_eval: U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) diff --git a/scripts/run_glm45_355b_a32b.py b/scripts/run_glm45_355b_a32b.py index c01daa9afc..aa8b9f79c1 100644 --- a/scripts/run_glm45_355b_a32b.py +++ b/scripts/run_glm45_355b_a32b.py @@ -40,8 +40,10 @@ class ScriptArgs(U.ExecuteTrainConfig): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) match args.task: case "dapo_aime": U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) @@ -59,7 +61,7 @@ def _convert_hf_to_fp8(args: ScriptArgs): if Path(path_output).exists(): return - U.exec_command( + U.exec_command_gpu( "python tools/convert_hf_to_fp8.py " f"--model-dir {args.model_dir}/{args.model_name} " f"--save-dir {path_output} " diff --git a/scripts/run_glm47_flash.py b/scripts/run_glm47_flash.py index 02a3870f1e..673b2513de 100644 --- a/scripts/run_glm47_flash.py +++ b/scripts/run_glm47_flash.py @@ -24,8 +24,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command( + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( f"hf download {args.model_org}/{args.model_name} " f"--local-dir {args.model_dir}/{args.model_name}" ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) diff --git a/scripts/run_glm5_1_744b_a40b_lora.py b/scripts/run_glm5_1_744b_a40b_lora.py index b440b21330..101bf412bd 100644 --- a/scripts/run_glm5_1_744b_a40b_lora.py +++ b/scripts/run_glm5_1_744b_a40b_lora.py @@ -159,10 +159,10 @@ def _download_dataset(args: ScriptArgs): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.data_dir} {args.model_dir}") + U.exec_command_cpu(f"mkdir -p {args.data_dir} {args.model_dir}") repo = _HF_REPO.get(args.model_name) if repo is not None: - U.exec_command(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") _download_dataset(args) diff --git a/scripts/run_glm5_2_744b_a40b.py b/scripts/run_glm5_2_744b_a40b.py index e65f48805b..83210322ed 100644 --- a/scripts/run_glm5_2_744b_a40b.py +++ b/scripts/run_glm5_2_744b_a40b.py @@ -162,7 +162,7 @@ def _convert_to_fp8(args: ScriptArgs): if sentinel.exists(): print(f"_convert_to_fp8 skip {dst} since {sentinel} exists") return - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_fp8.py " f"--model-dir {src} --save-dir {dst} " f"--strategy block --block-size 128 128 " @@ -171,8 +171,10 @@ def _convert_to_fp8(args: ScriptArgs): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) diff --git a/scripts/run_glm5_2_744b_a40b_lora.py b/scripts/run_glm5_2_744b_a40b_lora.py index 3af391f5b1..892275a027 100644 --- a/scripts/run_glm5_2_744b_a40b_lora.py +++ b/scripts/run_glm5_2_744b_a40b_lora.py @@ -172,10 +172,10 @@ def _download_dataset(args: ScriptArgs): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.data_dir} {args.model_dir}") + U.exec_command_cpu(f"mkdir -p {args.data_dir} {args.model_dir}") repo = _HF_REPO.get(args.model_name) if repo is not None: - U.exec_command(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") _download_dataset(args) diff --git a/scripts/run_glm5_744b_a40b.py b/scripts/run_glm5_744b_a40b.py index 62a7b3f49e..4aed90317b 100644 --- a/scripts/run_glm5_744b_a40b.py +++ b/scripts/run_glm5_744b_a40b.py @@ -149,7 +149,7 @@ def _convert_to_fp8(args: ScriptArgs): """Convert HF checkpoint to FP8 (block quantization). Megatron still uses bf16.""" src = f"{args.model_dir}/{args.model_name}" dst = f"{args.model_dir}/{args.model_name}_fp8" - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_fp8.py " f"--model-dir {src} --save-dir {dst} " f"--strategy block --block-size 128 128" @@ -157,8 +157,10 @@ def _convert_to_fp8(args: ScriptArgs): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) diff --git a/scripts/run_joy_ai_llm_flash.py b/scripts/run_joy_ai_llm_flash.py index 217f6d9fed..b604e09f61 100644 --- a/scripts/run_joy_ai_llm_flash.py +++ b/scripts/run_joy_ai_llm_flash.py @@ -79,13 +79,15 @@ def __post_init__(self): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) if args.rollout_mxfp8: - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_mxfp8.py --model-dir {args.model_dir}/{args.model_name} " f"--save-dir {args.model_dir}/{args.model_name}-MXFP8 " f"--num-layers-at-start-in-bf16 {args.mxfp8_num_layers_at_start_in_bf16} " diff --git a/scripts/run_kimi_k25.py b/scripts/run_kimi_k25.py index 2b6249af8a..589c540f20 100644 --- a/scripts/run_kimi_k25.py +++ b/scripts/run_kimi_k25.py @@ -84,8 +84,10 @@ def _bf16_ref_dir(args: ScriptArgs) -> str: def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu( + f"hf download {args.model_org}/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" + ) U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) if args.enable_eval: U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) @@ -93,7 +95,7 @@ def _prepare_download(args: ScriptArgs): def _convert_to_bf16(args: ScriptArgs): """Dequantize the INT4 checkpoint to a BF16 reference for the Megatron bridge.""" - U.exec_command( + U.exec_command_gpu( f"python {U.repo_base_dir}/tools/convert_kimi_int4_to_bf16.py " f"--model-dir {args.model_dir}/{args.model_name} " f"--output-dir {_bf16_ref_dir(args)} " diff --git a/scripts/run_mcore_fsdp.py b/scripts/run_mcore_fsdp.py index 4023591aa0..daca0ee6ef 100644 --- a/scripts/run_mcore_fsdp.py +++ b/scripts/run_mcore_fsdp.py @@ -38,8 +38,8 @@ def __post_init__(self): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} " f"--local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} " f"--local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) U.hf_download_dataset("zyzshishui0627/gpqa_diamond", data_dir=args.data_dir) diff --git a/scripts/run_nemotron_3_nano_4b_fsdp.py b/scripts/run_nemotron_3_nano_4b_fsdp.py index d1d3a77dbf..d97a997ccc 100644 --- a/scripts/run_nemotron_3_nano_4b_fsdp.py +++ b/scripts/run_nemotron_3_nano_4b_fsdp.py @@ -49,8 +49,8 @@ def _strip_remote_code(model_path: str): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir}") - U.exec_command(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") + U.exec_command_cpu(f"mkdir -p {args.model_dir}") + U.exec_command_cpu(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) _strip_remote_code(f"{args.model_dir}/{MODEL_NAME}") @@ -105,7 +105,7 @@ def execute(args: ScriptArgs): "--adam-beta2 0.98 " ) - # No --wandb-key on purpose: exec_command prints the full command line, so the + # No --wandb-key on purpose: exec_command_cpu prints the full command line, so the # trainer must pick up WANDB_API_KEY from its inherited environment instead. wandb_args = ( f"--use-wandb --wandb-project {args.wandb_project} --wandb-group {WANDB_GROUP} " diff --git a/scripts/run_nemotron_3_ultra_550b_a55b.py b/scripts/run_nemotron_3_ultra_550b_a55b.py index 618bdf7b81..dff2322559 100755 --- a/scripts/run_nemotron_3_ultra_550b_a55b.py +++ b/scripts/run_nemotron_3_ultra_550b_a55b.py @@ -144,8 +144,8 @@ def _sglang_args(args: ScriptArgs) -> str: def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {args.model_org}/{args.model_name} --local-dir {_hf_checkpoint(args)}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download {args.model_org}/{args.model_name} --local-dir {_hf_checkpoint(args)}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) if args.enable_eval: U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) diff --git a/scripts/run_qwen3_0_6b_fsdp.py b/scripts/run_qwen3_0_6b_fsdp.py index a0715e69ad..d3c2f010a0 100644 --- a/scripts/run_qwen3_0_6b_fsdp.py +++ b/scripts/run_qwen3_0_6b_fsdp.py @@ -29,8 +29,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir}") - U.exec_command(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") + U.exec_command_cpu(f"mkdir -p {args.model_dir}") + U.exec_command_cpu(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) @@ -84,7 +84,7 @@ def execute(args: ScriptArgs): "--adam-beta2 0.98 " ) - # No --wandb-key on purpose: exec_command prints the full command line, so the + # No --wandb-key on purpose: exec_command_cpu prints the full command line, so the # trainer must pick up WANDB_API_KEY from its inherited environment instead. wandb_args = ( f"--use-wandb --wandb-project {args.wandb_project} --wandb-group {WANDB_GROUP} " diff --git a/scripts/run_qwen3_30b_a3b.py b/scripts/run_qwen3_30b_a3b.py index 1023164278..57b65d8c76 100644 --- a/scripts/run_qwen3_30b_a3b.py +++ b/scripts/run_qwen3_30b_a3b.py @@ -57,16 +57,18 @@ def __post_init__(self): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) if args.rollout_fp8: - U.exec_command(f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8") + U.exec_command_cpu( + f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8" + ) if args.rollout_mxfp8: - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_mxfp8.py --model-dir {args.model_dir}/{args.model_name} " f"--save-dir {args.model_dir}/{args.model_name}-MXFP8 " f"{args.extra_args} " @@ -84,7 +86,7 @@ def prepare(args: ScriptArgs): }, } nvfp4_env_prefix = " ".join(f"{key}={value}" for key, value in nvfp4_env_vars.items()) + " " - U.exec_command( + U.exec_command_gpu( f"{nvfp4_env_prefix}" f"python tools/convert_hf_to_nvfp4.py --model-dir {args.model_dir}/{args.model_name} " f"--save-dir {args.model_dir}/{args.model_name}-NVFP4 " @@ -92,7 +94,7 @@ def prepare(args: ScriptArgs): ) if args.rollout_int4: - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_int4_direct.py --model-dir {args.model_dir}/{args.model_name} --save-dir {args.model_dir}/{args.model_name}-INT4" ) diff --git a/scripts/run_qwen3_30b_a3b_fsdp.py b/scripts/run_qwen3_30b_a3b_fsdp.py index 40f9ab0e53..5b06272d0a 100644 --- a/scripts/run_qwen3_30b_a3b_fsdp.py +++ b/scripts/run_qwen3_30b_a3b_fsdp.py @@ -35,8 +35,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir}") - U.exec_command(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") + U.exec_command_cpu(f"mkdir -p {args.model_dir}") + U.exec_command_cpu(f"hf download {HF_REPO} --local-dir {args.model_dir}/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) @@ -90,7 +90,7 @@ def execute(args: ScriptArgs): "--adam-beta2 0.98 " ) - # No --wandb-key on purpose: exec_command prints the full command line, so the + # No --wandb-key on purpose: exec_command_cpu prints the full command line, so the # trainer must pick up WANDB_API_KEY from its inherited environment instead. wandb_args = ( f"--use-wandb --wandb-project {args.wandb_project} --wandb-group {WANDB_GROUP} " diff --git a/scripts/run_qwen3_4b.py b/scripts/run_qwen3_4b.py index 261615cfbd..3df094a068 100644 --- a/scripts/run_qwen3_4b.py +++ b/scripts/run_qwen3_4b.py @@ -62,8 +62,8 @@ def __post_init__(self): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) @@ -72,7 +72,9 @@ def prepare(args: ScriptArgs): U.hf_download_dataset("zyzshishui0627/IFBench", data_dir=args.data_dir) if args.rollout_fp8: - U.exec_command(f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8") + U.exec_command_cpu( + f"hf download Qwen/{args.model_name}-FP8 --local-dir {args.model_dir}/{args.model_name}-FP8" + ) if (args.train_backend == "megatron") and not args.enable_megatron_bridge: U.convert_checkpoint( diff --git a/scripts/run_qwen3_4b_npu.py b/scripts/run_qwen3_4b_npu.py index f30c2b5fd0..952420daa0 100644 --- a/scripts/run_qwen3_4b_npu.py +++ b/scripts/run_qwen3_4b_npu.py @@ -25,11 +25,11 @@ def get_megatron_model_type(model_name: str) -> str: def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") data_missing = not os.path.exists(TRAIN_DATA_PATH) if data_missing: - U.exec_command(f"hf download --repo-type dataset {DATASET_NAME} --local-dir {DATA_ROOT}") + U.exec_command_cpu(f"hf download --repo-type dataset {DATASET_NAME} --local-dir {DATA_ROOT}") if not os.path.exists(TRAIN_DATA_PATH): raise FileNotFoundError(f"Dataset not found. Expected local dataset at {TRAIN_DATA_PATH}; ") diff --git a/scripts/run_qwen3_5_35b_a3b_lora.py b/scripts/run_qwen3_5_35b_a3b_lora.py index 47ce2a7566..1d3a6b2a15 100644 --- a/scripts/run_qwen3_5_35b_a3b_lora.py +++ b/scripts/run_qwen3_5_35b_a3b_lora.py @@ -141,10 +141,10 @@ def _download_dataset(args: ScriptArgs): def _prepare_download(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.data_dir} {args.model_dir}") + U.exec_command_cpu(f"mkdir -p {args.data_dir} {args.model_dir}") repo = _HF_REPO.get(args.model_name) if repo is not None: - U.exec_command(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"hf download {repo} --local-dir {args.model_dir}/{args.model_name}") _download_dataset(args) diff --git a/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py b/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py index d869897dbc..5add2ddbfe 100644 --- a/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py +++ b/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py @@ -25,8 +25,8 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.hf_download_dataset("zhuzilin/aime-2024", data_dir=args.data_dir) diff --git a/scripts/run_qwen3_6_35b_a3b_mtp.py b/scripts/run_qwen3_6_35b_a3b_mtp.py index ba3096bec5..17204079a2 100644 --- a/scripts/run_qwen3_6_35b_a3b_mtp.py +++ b/scripts/run_qwen3_6_35b_a3b_mtp.py @@ -48,18 +48,18 @@ class ScriptArgs(U.ExecuteTrainConfig): def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") # model path is a symlink to /cluster_public; skip download if already present - U.exec_command( + U.exec_command_cpu( f"test -e {args.model_dir}/{args.model_name} || " f"hf download Qwen/{args.model_name} --local-dir {args.model_dir}/{args.model_name}" ) # datasets are symlinked; skip if present - U.exec_command( + U.exec_command_cpu( f"test -e {args.data_dir}/dapo-math-17k || " f"hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir {args.data_dir}/dapo-math-17k" ) - U.exec_command( + U.exec_command_cpu( f"test -e {args.data_dir}/aime-2024 || " f"hf download --repo-type dataset zhuzilin/aime-2024 --local-dir {args.data_dir}/aime-2024" ) diff --git a/tests/e2e/ckpt/test_glm47_flash_ckpt.py b/tests/e2e/ckpt/test_glm47_flash_ckpt.py index 01aaf77579..41c7c10e53 100644 --- a/tests/e2e/ckpt/test_glm47_flash_ckpt.py +++ b/tests/e2e/ckpt/test_glm47_flash_ckpt.py @@ -27,9 +27,9 @@ def _get_latest_checkpointed_iteration() -> int: def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download zai-org/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") - U.exec_command(f"rm -rf /root/models/{MODEL_NAME}_miles") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download zai-org/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu(f"rm -rf /root/models/{MODEL_NAME}_miles") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/ckpt/test_qwen3_4B_ckpt.py b/tests/e2e/ckpt/test_qwen3_4B_ckpt.py index 62a530dc45..0c73b085f5 100644 --- a/tests/e2e/ckpt/test_qwen3_4B_ckpt.py +++ b/tests/e2e/ckpt/test_qwen3_4B_ckpt.py @@ -24,9 +24,9 @@ def _get_latest_checkpointed_iteration() -> int: def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") - U.exec_command(f"rm -rf /root/models/{MODEL_NAME}_miles") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu(f"rm -rf /root/models/{MODEL_NAME}_miles") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/fsdp/r3/_common.py b/tests/e2e/fsdp/r3/_common.py index 892b96a17b..adc0f92596 100644 --- a/tests/e2e/fsdp/r3/_common.py +++ b/tests/e2e/fsdp/r3/_common.py @@ -26,8 +26,8 @@ class CaseConfig: def prepare(case: CaseConfig) -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download {case.hf_repo} --local-dir /root/models/{case.model_name}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download {case.hf_repo} --local-dir /root/models/{case.model_name}") U.hf_download_dataset("zhuzilin/dapo-math-17k") diff --git a/tests/e2e/fsdp/test_qwen3_0.6B_fsdp_distributed.py b/tests/e2e/fsdp/test_qwen3_0.6B_fsdp_distributed.py index f681c52ef4..e2195bde3f 100644 --- a/tests/e2e/fsdp/test_qwen3_0.6B_fsdp_distributed.py +++ b/tests/e2e/fsdp/test_qwen3_0.6B_fsdp_distributed.py @@ -15,8 +15,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/fsdp/test_qwen3_0.6B_megatron_fsdp_align.py b/tests/e2e/fsdp/test_qwen3_0.6B_megatron_fsdp_align.py index 60595fdcb4..84c5202bf7 100644 --- a/tests/e2e/fsdp/test_qwen3_0.6B_megatron_fsdp_align.py +++ b/tests/e2e/fsdp/test_qwen3_0.6B_megatron_fsdp_align.py @@ -20,8 +20,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint( diff --git a/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s2.py b/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s2.py index 710ad23d53..867c849234 100644 --- a/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s2.py +++ b/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s2.py @@ -23,8 +23,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") diff --git a/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s4.py b/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s4.py index 5536b0c648..128a8fe922 100644 --- a/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s4.py +++ b/tests/e2e/fsdp/test_qwen3_4B_fsdp_hybrid_shard_r2s4.py @@ -17,8 +17,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") diff --git a/tests/e2e/fsdp/test_qwen3_4B_fsdp_true_on_policy.py b/tests/e2e/fsdp/test_qwen3_4B_fsdp_true_on_policy.py index 637acefd69..d76bdb11d2 100644 --- a/tests/e2e/fsdp/test_qwen3_4B_fsdp_true_on_policy.py +++ b/tests/e2e/fsdp/test_qwen3_4B_fsdp_true_on_policy.py @@ -17,8 +17,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/fsdp/test_qwen3_vl_4B_fsdp.py b/tests/e2e/fsdp/test_qwen3_vl_4B_fsdp.py index 125c1d06e1..9c10eebd37 100644 --- a/tests/e2e/fsdp/test_qwen3_vl_4B_fsdp.py +++ b/tests/e2e/fsdp/test_qwen3_vl_4B_fsdp.py @@ -18,8 +18,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset(DATASET_NAME) diff --git a/tests/e2e/ft/conftest_ft/execution.py b/tests/e2e/ft/conftest_ft/execution.py index c2ff98fd7b..801e61e820 100644 --- a/tests/e2e/ft/conftest_ft/execution.py +++ b/tests/e2e/ft/conftest_ft/execution.py @@ -36,8 +36,8 @@ def _get_hf_num_layers(model_path: str) -> int: def prepare(mode: FTTestMode) -> None: - U.exec_command(f"mkdir -p {_MODEL_DIR} {_DATA_DIR}") - U.exec_command(f"hf download {mode.model_hf_repo} --local-dir {_MODEL_DIR}/{mode.model_name}") + U.exec_command_cpu(f"mkdir -p {_MODEL_DIR} {_DATA_DIR}") + U.exec_command_cpu(f"hf download {mode.model_hf_repo} --local-dir {_MODEL_DIR}/{mode.model_name}") hf_model_path = f"{_MODEL_DIR}/{mode.model_name}" num_layers = _get_hf_num_layers(hf_model_path) diff --git a/tests/e2e/ft/conftest_ft/scenario_realistic_gsm8k.py b/tests/e2e/ft/conftest_ft/scenario_realistic_gsm8k.py index 5929d222d6..edbc70a373 100644 --- a/tests/e2e/ft/conftest_ft/scenario_realistic_gsm8k.py +++ b/tests/e2e/ft/conftest_ft/scenario_realistic_gsm8k.py @@ -77,8 +77,8 @@ def run_ci( def _prepare_gsm8k() -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{_MODEL_NAME} --local-dir /root/models/{_MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{_MODEL_NAME} --local-dir /root/models/{_MODEL_NAME}") U.convert_checkpoint( model_name=_MODEL_NAME, megatron_model_type=_MODEL_TYPE, diff --git a/tests/e2e/long/test_qwen2.5_0.5B_gsm8k.py b/tests/e2e/long/test_qwen2.5_0.5B_gsm8k.py index 37ddbfb616..42b1e10ecd 100644 --- a/tests/e2e/long/test_qwen2.5_0.5B_gsm8k.py +++ b/tests/e2e/long/test_qwen2.5_0.5B_gsm8k.py @@ -12,8 +12,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/long/test_qwen2.5_0.5B_gsm8k_async.py b/tests/e2e/long/test_qwen2.5_0.5B_gsm8k_async.py index 8a653edb26..c08099421e 100644 --- a/tests/e2e/long/test_qwen2.5_0.5B_gsm8k_async.py +++ b/tests/e2e/long/test_qwen2.5_0.5B_gsm8k_async.py @@ -13,8 +13,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/long/test_qwen3_0.6B_verifiers.py b/tests/e2e/long/test_qwen3_0.6B_verifiers.py index d0f8456f7c..2c0078c407 100644 --- a/tests/e2e/long/test_qwen3_0.6B_verifiers.py +++ b/tests/e2e/long/test_qwen3_0.6B_verifiers.py @@ -24,14 +24,14 @@ def prepare(): - U.exec_command(f"mkdir -p {MODEL_DIR} {RUN_DIR}") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") - U.exec_command( + U.exec_command_cpu(f"mkdir -p {MODEL_DIR} {RUN_DIR}") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") + U.exec_command_cpu( f"{sys.executable} -m pip install -r {U.repo_base_dir}/examples/experimental/verifiers/requirements.txt" ) - U.exec_command("uv tool install 'prime==0.6.19'") + U.exec_command_cpu("uv tool install 'prime==0.6.19'") if not VERIFIERS_DIR.exists(): - U.exec_command( + U.exec_command_cpu( f"git clone --depth 1 --branch v0.2.0 " f"https://github.com/PrimeIntellect-ai/verifiers.git {VERIFIERS_DIR}" ) @@ -40,7 +40,7 @@ def prepare(): RUN_DIR / "environments" / "code_golf_v1", dirs_exist_ok=True, ) - U.exec_command(f"cd {RUN_DIR} && prime --plain env install code-golf-v1") + U.exec_command_cpu(f"cd {RUN_DIR} && prime --plain env install code-golf-v1") U.convert_checkpoint( model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, diff --git a/tests/e2e/lora/test_lora_qwen2.5_0.5B.py b/tests/e2e/lora/test_lora_qwen2.5_0.5B.py index 94f8293eff..99f339842c 100644 --- a/tests/e2e/lora/test_lora_qwen2.5_0.5B.py +++ b/tests/e2e/lora/test_lora_qwen2.5_0.5B.py @@ -29,9 +29,9 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") - U.exec_command("hf download --repo-type dataset zhuzilin/gsm8k --local-dir /root/datasets/gsm8k") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("hf download --repo-type dataset zhuzilin/gsm8k --local-dir /root/datasets/gsm8k") def execute(): diff --git a/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py b/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py index 10288dda5a..c2697313a6 100644 --- a/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py +++ b/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py @@ -76,8 +76,8 @@ def prepare(): - U.exec_command(f"mkdir -p {MODEL_DIR} {DATA_DIR}") - U.exec_command(f"hf download {MODEL_ORG}/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") + U.exec_command_cpu(f"mkdir -p {MODEL_DIR} {DATA_DIR}") + U.exec_command_cpu(f"hf download {MODEL_ORG}/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=DATA_DIR) U.fp8_cast_bf16( @@ -85,7 +85,7 @@ def prepare(): path_dst=f"{MODEL_DIR}/{MODEL_NAME}-bf16/", ) - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_mxfp8.py " f"--model-dir {MODEL_DIR}/{MODEL_NAME}-bf16 " f"--save-dir {MODEL_DIR}/{MODEL_NAME}-MXFP8 " diff --git a/tests/e2e/megatron/model_scripts/test_glm5_1_744b_a40b_6layer_lora_ci.py b/tests/e2e/megatron/model_scripts/test_glm5_1_744b_a40b_6layer_lora_ci.py index 2f498784c3..9e35537c23 100644 --- a/tests/e2e/megatron/model_scripts/test_glm5_1_744b_a40b_6layer_lora_ci.py +++ b/tests/e2e/megatron/model_scripts/test_glm5_1_744b_a40b_6layer_lora_ci.py @@ -42,7 +42,7 @@ def _args(dsa: str, shared_outer: bool, virtual_experts: bool) -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) @@ -57,6 +57,6 @@ def execute(args: ScriptArgs): for name, dsa, shared_outer, virtual_experts in _CONFIGS: print(f"[glm5.1-lora-ci] ===== combo: {name} =====", flush=True) # fresh ray/sglang between combos - U.exec_command("ray stop --force || true; pkill -9 sglang || true; sleep 10") + U.exec_command_cpu("ray stop --force || true; pkill -9 sglang || true; sleep 10") execute(_args(dsa, shared_outer, virtual_experts)) print(f"[glm5.1-lora-ci] ===== combo PASSED: {name} =====", flush=True) diff --git a/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_ci.py b/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_ci.py index 4689b645ce..2d0cd6331f 100644 --- a/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_ci.py +++ b/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_ci.py @@ -45,7 +45,7 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) _validate_glm_checkpoint(args) if args.fp8_rollout: diff --git a/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_lora_ci.py b/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_lora_ci.py index 2987c00e39..553dfff127 100644 --- a/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_lora_ci.py +++ b/tests/e2e/megatron/model_scripts/test_glm5_2_744b_a40b_5layer_lora_ci.py @@ -42,7 +42,7 @@ def _args(dsa: str, shared_outer: bool, virtual_experts: bool) -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) @@ -57,6 +57,6 @@ def execute(args: ScriptArgs): for name, dsa, shared_outer, virtual_experts in _CONFIGS: print(f"[glm5.2-lora-ci] ===== combo: {name} =====", flush=True) # fresh ray/sglang between combos - U.exec_command("ray stop --force || true; pkill -9 sglang || true; sleep 10") + U.exec_command_cpu("ray stop --force || true; pkill -9 sglang || true; sleep 10") execute(_args(dsa, shared_outer, virtual_experts)) print(f"[glm5.2-lora-ci] ===== combo PASSED: {name} =====", flush=True) diff --git a/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_ci.py b/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_ci.py index e78d73404d..8b19d433e0 100644 --- a/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_ci.py +++ b/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_ci.py @@ -37,7 +37,7 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) _validate_glm_checkpoint(args) if args.fp8_rollout: diff --git a/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_r3.py b/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_r3.py index 916fc2399b..df4b73db60 100644 --- a/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_r3.py +++ b/tests/e2e/megatron/model_scripts/test_glm5_744b_a40b_4layer_r3.py @@ -54,7 +54,7 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) _validate_glm_checkpoint(args) _prepare_megatron_ckpt(args) diff --git a/tests/e2e/megatron/model_scripts/test_gpt_oss_20b_moe_lora_ci.py b/tests/e2e/megatron/model_scripts/test_gpt_oss_20b_moe_lora_ci.py index e36047cb0d..e24f964d51 100644 --- a/tests/e2e/megatron/model_scripts/test_gpt_oss_20b_moe_lora_ci.py +++ b/tests/e2e/megatron/model_scripts/test_gpt_oss_20b_moe_lora_ci.py @@ -24,9 +24,11 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download lmsys/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") - U.exec_command("hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/datasets/dapo-math-17k") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download lmsys/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu( + "hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/datasets/dapo-math-17k" + ) def execute(shared_outer: bool, virtual_experts: bool): @@ -123,6 +125,6 @@ def execute(shared_outer: bool, virtual_experts: bool): for name, shared_outer, virtual_experts in _CONFIGS: print(f"[gpt-oss-moe-lora-ci] ===== combo: {name} =====", flush=True) # fresh ray/sglang between combos - U.exec_command("ray stop --force || true; pkill -9 sglang || true; sleep 10") + U.exec_command_cpu("ray stop --force || true; pkill -9 sglang || true; sleep 10") execute(shared_outer, virtual_experts) print(f"[gpt-oss-moe-lora-ci] ===== combo PASSED: {name} =====", flush=True) diff --git a/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_ci.py b/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_ci.py index 3c65c9b4a8..3aa4c5a6ec 100644 --- a/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_ci.py +++ b/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_ci.py @@ -50,8 +50,8 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {_MODEL_ORG}/{args.model_name} --local-dir {args.hf_checkpoint}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download {_MODEL_ORG}/{args.model_name} --local-dir {args.hf_checkpoint}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.convert_checkpoint( model_name=args.model_name, diff --git a/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_lora_ci.py b/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_lora_ci.py index 5a0f83e790..0349b0f8e4 100644 --- a/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_lora_ci.py +++ b/tests/e2e/megatron/model_scripts/test_inkling_small_4layer_lora_ci.py @@ -49,8 +49,8 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.model_dir} {args.data_dir}") - U.exec_command(f"hf download {_MODEL_ORG}/{args.model_name} --local-dir {args.hf_checkpoint}") + U.exec_command_cpu(f"mkdir -p {args.model_dir} {args.data_dir}") + U.exec_command_cpu(f"hf download {_MODEL_ORG}/{args.model_name} --local-dir {args.hf_checkpoint}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=args.data_dir) U.convert_checkpoint( model_name=args.model_name, diff --git a/tests/e2e/megatron/model_scripts/test_kimi_k25_2layer_ci.py b/tests/e2e/megatron/model_scripts/test_kimi_k25_2layer_ci.py index 6df24b0876..87dcfbca7f 100644 --- a/tests/e2e/megatron/model_scripts/test_kimi_k25_2layer_ci.py +++ b/tests/e2e/megatron/model_scripts/test_kimi_k25_2layer_ci.py @@ -31,7 +31,7 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) _convert_to_bf16(args) diff --git a/tests/e2e/megatron/model_scripts/test_nemotron_3_ultra_4layer_ci.py b/tests/e2e/megatron/model_scripts/test_nemotron_3_ultra_4layer_ci.py index 7397443d05..45eedc4216 100644 --- a/tests/e2e/megatron/model_scripts/test_nemotron_3_ultra_4layer_ci.py +++ b/tests/e2e/megatron/model_scripts/test_nemotron_3_ultra_4layer_ci.py @@ -47,7 +47,7 @@ def _args() -> ScriptArgs: def prepare(args: ScriptArgs): - U.exec_command(f"mkdir -p {args.output_dir}") + U.exec_command_cpu(f"mkdir -p {args.output_dir}") _prepare_download(args) diff --git a/tests/e2e/megatron/test_glm47_flash/_common.py b/tests/e2e/megatron/test_glm47_flash/_common.py index e31844d1eb..b053b057be 100644 --- a/tests/e2e/megatron/test_glm47_flash/_common.py +++ b/tests/e2e/megatron/test_glm47_flash/_common.py @@ -27,8 +27,8 @@ class CaseConfig: def prepare(case: CaseConfig) -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download zai-org/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download zai-org/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py b/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py index b96eafad86..e223a201bb 100644 --- a/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py +++ b/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py @@ -132,14 +132,14 @@ def _validate_glm_checkpoint(): def prepare(): os.environ.update(NVFP4_ENV) - U.exec_command(f"mkdir -p {MODEL_DIR} {DATA_DIR}") - U.exec_command(f"hf download {MODEL_ORG}/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") + U.exec_command_cpu(f"mkdir -p {MODEL_DIR} {DATA_DIR}") + U.exec_command_cpu(f"hf download {MODEL_ORG}/{MODEL_NAME} --local-dir {MODEL_DIR}/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k", data_dir=DATA_DIR) _validate_glm_checkpoint() - U.exec_command(f"rm -rf {MODEL_DIR}/{MODEL_NAME}-NVFP4 {MODEL_DIR}/{MODEL_NAME}_torch_dist") + U.exec_command_cpu(f"rm -rf {MODEL_DIR}/{MODEL_NAME}-NVFP4 {MODEL_DIR}/{MODEL_NAME}_torch_dist") - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_nvfp4.py " f"--model-dir {MODEL_DIR}/{MODEL_NAME} " f"--save-dir {MODEL_DIR}/{MODEL_NAME}-NVFP4 " diff --git a/tests/e2e/megatron/test_mimo_7B_mtp_only_grad.py b/tests/e2e/megatron/test_mimo_7B_mtp_only_grad.py index c7d8dc3e98..9568953d96 100644 --- a/tests/e2e/megatron/test_mimo_7B_mtp_only_grad.py +++ b/tests/e2e/megatron/test_mimo_7B_mtp_only_grad.py @@ -24,8 +24,8 @@ def prepare(): """Download model and convert checkpoint with MTP layers.""" - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download XiaomiMiMo/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download XiaomiMiMo/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") # Convert checkpoint with MTP layers enabled diff --git a/tests/e2e/megatron/test_quick_start_glm4_9B.py b/tests/e2e/megatron/test_quick_start_glm4_9B.py index b419c2c5a6..dda7a635b2 100644 --- a/tests/e2e/megatron/test_quick_start_glm4_9B.py +++ b/tests/e2e/megatron/test_quick_start_glm4_9B.py @@ -16,8 +16,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command("hf download zai-org/GLM-Z1-9B-0414 --local-dir /root/models/GLM-Z1-9B-0414") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu("hf download zai-org/GLM-Z1-9B-0414 --local-dir /root/models/GLM-Z1-9B-0414") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/megatron/test_qwen3_30B_A3B/_common.py b/tests/e2e/megatron/test_qwen3_30B_A3B/_common.py index 6b76d4e8d8..215fec71fa 100644 --- a/tests/e2e/megatron/test_qwen3_30B_A3B/_common.py +++ b/tests/e2e/megatron/test_qwen3_30B_A3B/_common.py @@ -55,12 +55,12 @@ def __post_init__(self): def prepare(case: CaseConfig, *, need_fp8: bool, need_int4: bool, all_bridge: bool) -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command("hf download Qwen/Qwen3-30B-A3B --local-dir /root/models/Qwen3-30B-A3B") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu("hf download Qwen/Qwen3-30B-A3B --local-dir /root/models/Qwen3-30B-A3B") if need_fp8: - U.exec_command("hf download Qwen/Qwen3-30B-A3B-FP8 --local-dir /root/models/Qwen3-30B-A3B-FP8") + U.exec_command_cpu("hf download Qwen/Qwen3-30B-A3B-FP8 --local-dir /root/models/Qwen3-30B-A3B-FP8") if need_int4: - U.exec_command( + U.exec_command_gpu( f"python tools/convert_hf_to_int4_direct.py " f"--model-dir /root/models/{MODEL_NAME} " f"--save-dir /root/models/{MODEL_NAME}-INT4" diff --git a/tests/e2e/megatron/test_qwen3_30B_A3B_p2p.py b/tests/e2e/megatron/test_qwen3_30B_A3B_p2p.py index 98a73bc674..bc95039042 100644 --- a/tests/e2e/megatron/test_qwen3_30B_A3B_p2p.py +++ b/tests/e2e/megatron/test_qwen3_30B_A3B_p2p.py @@ -23,8 +23,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_4B_disk_delta.py b/tests/e2e/megatron/test_qwen3_4B_disk_delta.py index 6e0e17aa50..3ad1597ff0 100644 --- a/tests/e2e/megatron/test_qwen3_4B_disk_delta.py +++ b/tests/e2e/megatron/test_qwen3_4B_disk_delta.py @@ -21,8 +21,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_4B_offload_disk.py b/tests/e2e/megatron/test_qwen3_4B_offload_disk.py index 82ad5ecc1f..f2b142a494 100644 --- a/tests/e2e/megatron/test_qwen3_4B_offload_disk.py +++ b/tests/e2e/megatron/test_qwen3_4B_offload_disk.py @@ -34,8 +34,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_4B_offload_disk_stream.py b/tests/e2e/megatron/test_qwen3_4B_offload_disk_stream.py index 61e9d84fb6..0da0576c8d 100644 --- a/tests/e2e/megatron/test_qwen3_4B_offload_disk_stream.py +++ b/tests/e2e/megatron/test_qwen3_4B_offload_disk_stream.py @@ -42,8 +42,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_4B_ppo.py b/tests/e2e/megatron/test_qwen3_4B_ppo.py index a27d7d4f4f..8d9b78a8da 100644 --- a/tests/e2e/megatron/test_qwen3_4B_ppo.py +++ b/tests/e2e/megatron/test_qwen3_4B_ppo.py @@ -19,8 +19,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu("hf download Qwen/Qwen3-4B --local-dir /root/models/Qwen3-4B") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") diff --git a/tests/e2e/megatron/test_qwen3_4B_variable_gbs.py b/tests/e2e/megatron/test_qwen3_4B_variable_gbs.py index caf26404fd..44842b6061 100644 --- a/tests/e2e/megatron/test_qwen3_4B_variable_gbs.py +++ b/tests/e2e/megatron/test_qwen3_4B_variable_gbs.py @@ -18,8 +18,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_4b_fully_async_eval.py b/tests/e2e/megatron/test_qwen3_4b_fully_async_eval.py index 1336cd4f69..ac5d32d5d7 100644 --- a/tests/e2e/megatron/test_qwen3_4b_fully_async_eval.py +++ b/tests/e2e/megatron/test_qwen3_4b_fully_async_eval.py @@ -42,8 +42,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") U.convert_checkpoint( model_name=MODEL_NAME, diff --git a/tests/e2e/megatron/test_qwen3_5_35B_A3B_cp.py b/tests/e2e/megatron/test_qwen3_5_35B_A3B_cp.py index 2a0cf43f56..539cd980b9 100644 --- a/tests/e2e/megatron/test_qwen3_5_35B_A3B_cp.py +++ b/tests/e2e/megatron/test_qwen3_5_35B_A3B_cp.py @@ -24,8 +24,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) diff --git a/tests/e2e/megatron/test_qwen3_5_35B_A3B_mtp/_common.py b/tests/e2e/megatron/test_qwen3_5_35B_A3B_mtp/_common.py index a84a904e48..90a35d94c3 100644 --- a/tests/e2e/megatron/test_qwen3_5_35B_A3B_mtp/_common.py +++ b/tests/e2e/megatron/test_qwen3_5_35B_A3B_mtp/_common.py @@ -50,8 +50,8 @@ class CaseConfig: def prepare(case: CaseConfig) -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.hf_download_dataset("zhuzilin/aime-2024") U.convert_checkpoint( diff --git a/tests/e2e/megatron/test_qwen3_5_35b_a3b_lora_ci.py b/tests/e2e/megatron/test_qwen3_5_35b_a3b_lora_ci.py index ab1b14a5a5..a1f7b07578 100644 --- a/tests/e2e/megatron/test_qwen3_5_35b_a3b_lora_ci.py +++ b/tests/e2e/megatron/test_qwen3_5_35b_a3b_lora_ci.py @@ -51,6 +51,6 @@ def execute(args: ScriptArgs): for name, shared_outer, virtual_experts in _CONFIGS: print(f"[qwen3.5-lora-ci] ===== combo: {name} =====", flush=True) # fresh ray/sglang between combos - U.exec_command("ray stop --force || true; pkill -9 sglang || true; sleep 10") + U.exec_command_cpu("ray stop --force || true; pkill -9 sglang || true; sleep 10") execute(_args(shared_outer, virtual_experts)) print(f"[qwen3.5-lora-ci] ===== combo PASSED: {name} =====", flush=True) diff --git a/tests/e2e/precision/test_qwen3_0.6B_parallel_check.py b/tests/e2e/precision/test_qwen3_0.6B_parallel_check.py index a7d7c210e5..4c20c08ea3 100644 --- a/tests/e2e/precision/test_qwen3_0.6B_parallel_check.py +++ b/tests/e2e/precision/test_qwen3_0.6B_parallel_check.py @@ -20,8 +20,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/dapo-math-17k") U.convert_checkpoint( diff --git a/tests/e2e/sglang/test_r3_router_equivalence.py b/tests/e2e/sglang/test_r3_router_equivalence.py index 7700575a23..5ade9d0d43 100644 --- a/tests/e2e/sglang/test_r3_router_equivalence.py +++ b/tests/e2e/sglang/test_r3_router_equivalence.py @@ -120,9 +120,9 @@ def _get_config(model_family: str) -> ModelConfig: def prepare(model_family: str) -> None: cfg = _get_config(model_family) - U.exec_command("mkdir -p /root/models /root/datasets") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") if not Path(cfg.local_dir).exists(): - U.exec_command(f"hf download {cfg.hf_repo} --local-dir {cfg.local_dir}") + U.exec_command_cpu(f"hf download {cfg.hf_repo} --local-dir {cfg.local_dir}") if not Path(PROMPT_DATA_PATH).exists(): U.hf_download_dataset("zhuzilin/dapo-math-17k") diff --git a/tests/e2e/sglang_config/test_sglang_config.py b/tests/e2e/sglang_config/test_sglang_config.py index eeabe0c4df..b5a3bbc8fa 100644 --- a/tests/e2e/sglang_config/test_sglang_config.py +++ b/tests/e2e/sglang_config/test_sglang_config.py @@ -31,8 +31,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/sglang_config/test_sglang_config_mixed_offload.py b/tests/e2e/sglang_config/test_sglang_config_mixed_offload.py index f006473a27..f8636d2647 100644 --- a/tests/e2e/sglang_config/test_sglang_config_mixed_offload.py +++ b/tests/e2e/sglang_config/test_sglang_config_mixed_offload.py @@ -46,8 +46,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/sglang_config/test_sglang_config_mixed_offload_ft.py b/tests/e2e/sglang_config/test_sglang_config_mixed_offload_ft.py index a320c8a4fa..bfd05b53d5 100644 --- a/tests/e2e/sglang_config/test_sglang_config_mixed_offload_ft.py +++ b/tests/e2e/sglang_config/test_sglang_config_mixed_offload_ft.py @@ -43,8 +43,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_dumper.py b/tests/e2e/short/test_dumper.py index 3d0a05d791..5eb16bb267 100644 --- a/tests/e2e/short/test_dumper.py +++ b/tests/e2e/short/test_dumper.py @@ -87,11 +87,11 @@ def _resolve_mode(mode: str) -> tuple[str, str]: def prepare(dump_dir: str, mode: str) -> None: - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) - U.exec_command(f"rm -rf {dump_dir}") + U.exec_command_cpu(f"rm -rf {dump_dir}") megatron_yaml: str = MEGATRON_PATCHER_YAMLS["bshd" if mode.endswith("_bshd") else "thd"] Path(MEGATRON_SOURCE_PATCHER_CONFIG_PATH).write_text(megatron_yaml) diff --git a/tests/e2e/short/test_qwen2.5_0.5B_compact_rollout.py b/tests/e2e/short/test_qwen2.5_0.5B_compact_rollout.py index 671cacb5c7..ccdd621b8f 100644 --- a/tests/e2e/short/test_qwen2.5_0.5B_compact_rollout.py +++ b/tests/e2e/short/test_qwen2.5_0.5B_compact_rollout.py @@ -17,8 +17,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_qwen2.5_0.5B_fully_async_eval.py b/tests/e2e/short/test_qwen2.5_0.5B_fully_async_eval.py index 104c4de681..74633ebbb1 100644 --- a/tests/e2e/short/test_qwen2.5_0.5B_fully_async_eval.py +++ b/tests/e2e/short/test_qwen2.5_0.5B_fully_async_eval.py @@ -14,8 +14,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_async_short.py b/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_async_short.py index 13aab29d09..5040a72b63 100644 --- a/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_async_short.py +++ b/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_async_short.py @@ -15,8 +15,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_short.py b/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_short.py index ef1ac2cff7..8acc8472d9 100644 --- a/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_short.py +++ b/tests/e2e/short/test_qwen2.5_0.5B_gsm8k_short.py @@ -15,8 +15,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_qwen2.5_0.5B_opd_sglang.py b/tests/e2e/short/test_qwen2.5_0.5B_opd_sglang.py index 13b3ee0b2e..65da9cc1e5 100644 --- a/tests/e2e/short/test_qwen2.5_0.5B_opd_sglang.py +++ b/tests/e2e/short/test_qwen2.5_0.5B_opd_sglang.py @@ -21,8 +21,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") @@ -206,7 +206,7 @@ def launch_teacher(): if teacher_process: teacher_process.kill() teacher_process.wait() - U.exec_command("pkill -9 sglang; true") + U.exec_command_cpu("pkill -9 sglang; true") if __name__ == "__main__": diff --git a/tests/e2e/short/test_qwen3_0.6B_fsdp_colocated_2xGPU.py b/tests/e2e/short/test_qwen3_0.6B_fsdp_colocated_2xGPU.py index beb455d427..ea06c2bf38 100644 --- a/tests/e2e/short/test_qwen3_0.6B_fsdp_colocated_2xGPU.py +++ b/tests/e2e/short/test_qwen3_0.6B_fsdp_colocated_2xGPU.py @@ -15,8 +15,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/{MODEL_NAME} --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") diff --git a/tests/e2e/short/test_run_megatron.py b/tests/e2e/short/test_run_megatron.py index 46b5dfbecc..02701b0a8f 100644 --- a/tests/e2e/short/test_run_megatron.py +++ b/tests/e2e/short/test_run_megatron.py @@ -23,7 +23,7 @@ import miles.utils.external_utils.command_utils as U from miles.utils.debug_utils.run_megatron.cli.parallel_utils import ParallelConfig, parse_parallel_args -from miles.utils.misc import exec_command +from miles.utils.misc import exec_command_cpu, exec_command_gpu app: typer.Typer = typer.Typer() @@ -75,14 +75,14 @@ def _resolve_mode(mode: str) -> tuple[str, _ModeConfig]: def _prepare(dump_dir: Path, config: _ModeConfig) -> Path: """Download model, convert checkpoint, write source patcher config.""" - exec_command("mkdir -p /root/models") - exec_command(f"hf download {HF_REPO} --local-dir /root/models/{MODEL_NAME}") + exec_command_cpu("mkdir -p /root/models") + exec_command_cpu(f"hf download {HF_REPO} --local-dir /root/models/{MODEL_NAME}") U.convert_checkpoint( model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=min(NUM_GPUS, NUM_LAYERS), ) - exec_command(f"rm -rf {dump_dir}") + exec_command_cpu(f"rm -rf {dump_dir}") source_patcher_path: Path = _RUN_DIR / "megatron_source_patcher.yaml" yaml_content: str = ( @@ -129,7 +129,7 @@ def run( f"{target_extra_args_part}" f"--extra-args '{extra_args}'" ) - exec_command(cmd) + exec_command_gpu(cmd) @app.command() @@ -149,7 +149,7 @@ def compare( f"--baseline-dir {base / baseline_dir_name / 'standalone'} " f"--target-dir {base / target_dir_name / 'standalone'}" ) - exec_command(cmd) + exec_command_cpu(cmd) if __name__ == "__main__": diff --git a/tests/fast/launch_scripts/test_shell_script_hygiene.py b/tests/fast/launch_scripts/test_shell_script_hygiene.py index d04d1a0e25..22c4502e75 100644 --- a/tests/fast/launch_scripts/test_shell_script_hygiene.py +++ b/tests/fast/launch_scripts/test_shell_script_hygiene.py @@ -1,16 +1,33 @@ +import re + from tests.fast.launch_scripts.sh_harness import REPO_ROOT _HARDCODED_CHECKOUTS = ("/root/miles", "/workspace/miles") +_REMOVED_COMMAND_HELPERS = re.compile(r"(? str | None: commands.append(cmd) return "0" if capture_output else None - def fake_exec_command_all_ray_node( + def fake_exec_command_multi_node( cmd: str, capture_output: bool = False, num_nodes: int | None = None ) -> list[str | None]: - commands.append(f"[all_ray_node num_nodes={num_nodes}] {cmd}") + commands.append(f"[multi_node num_nodes={num_nodes}] {cmd}") return ["0"] for module in (command_utils, misc): - monkeypatch.setattr(module, "exec_command", fake_exec_command, raising=False) - monkeypatch.setattr(module, "exec_command_all_ray_node", fake_exec_command_all_ray_node, raising=False) + monkeypatch.setattr(module, "exec_command_cpu", fake_exec_command, raising=False) + monkeypatch.setattr(module, "exec_command_gpu", fake_exec_command, raising=False) + monkeypatch.setattr(module, "exec_command_multi_node", fake_exec_command_multi_node, raising=False) return commands diff --git a/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_compare.py b/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_compare.py index 21ea7998b4..13fe1517c6 100644 --- a/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_compare.py +++ b/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_compare.py @@ -20,14 +20,14 @@ def _make_compare_args(**overrides: object) -> CompareArgs: class TestActivationComparison: - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_calls_comparator(self, mock_exec: MagicMock) -> None: compare_impl(_make_compare_args()) mock_exec.assert_called_once() cmd = mock_exec.call_args[0][0] assert "sglang.srt.debug_utils.comparator" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_required_args_in_command(self, mock_exec: MagicMock) -> None: compare_impl(_make_compare_args()) cmd = mock_exec.call_args[0][0] @@ -36,7 +36,7 @@ def test_required_args_in_command(self, mock_exec: MagicMock) -> None: assert "/baseline" in cmd assert "/target" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_optional_args_included(self, mock_exec: MagicMock) -> None: compare_impl( _make_compare_args( @@ -52,7 +52,7 @@ def test_optional_args_included(self, mock_exec: MagicMock) -> None: assert "--patch-config" in cmd assert "--diff-threshold" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_optional_args_excluded(self, mock_exec: MagicMock) -> None: compare_impl(_make_compare_args()) cmd = mock_exec.call_args[0][0] @@ -63,7 +63,7 @@ def test_optional_args_excluded(self, mock_exec: MagicMock) -> None: class TestActivationFailure: - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_activation_failure_exits(self, mock_exec: MagicMock) -> None: mock_exec.side_effect = subprocess.CalledProcessError(returncode=1, cmd="test") with pytest.raises(SystemExit) as exc_info: @@ -73,7 +73,7 @@ def test_activation_failure_exits(self, mock_exec: MagicMock) -> None: class TestLogprobBranch: @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_logprob_called_when_dirs_provided(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: mock_logprob.return_value = True compare_impl( @@ -90,13 +90,13 @@ def test_logprob_called_when_dirs_provided(self, mock_exec: MagicMock, mock_logp ) @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_logprob_not_called_when_dirs_missing(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: compare_impl(_make_compare_args()) mock_logprob.assert_not_called() @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_logprob_default_threshold(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: mock_logprob.return_value = True compare_impl( @@ -110,7 +110,7 @@ def test_logprob_default_threshold(self, mock_exec: MagicMock, mock_logprob: Mag assert call_kwargs["threshold"] == 1e-3 @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_logprob_failure_exits(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: mock_logprob.return_value = False with pytest.raises(SystemExit) as exc_info: @@ -123,7 +123,7 @@ def test_logprob_failure_exits(self, mock_exec: MagicMock, mock_logprob: MagicMo assert exc_info.value.code == 1 @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_activation_pass_logprob_fail(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: mock_logprob.return_value = False with pytest.raises(SystemExit): @@ -135,7 +135,7 @@ def test_activation_pass_logprob_fail(self, mock_exec: MagicMock, mock_logprob: ) @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.compare_logprobs") - @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command") + @patch("miles.utils.debug_utils.run_megatron.cli.commands.compare.exec_command_cpu") def test_activation_fail_logprob_pass(self, mock_exec: MagicMock, mock_logprob: MagicMock) -> None: mock_exec.side_effect = subprocess.CalledProcessError(returncode=1, cmd="test") mock_logprob.return_value = True diff --git a/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_run.py b/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_run.py index 8ad44b85f4..f7651464c4 100644 --- a/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_run.py +++ b/tests/fast/utils/debug_utils/run_megatron/cli/commands/test_run.py @@ -41,14 +41,14 @@ def test_routing_replay_pp_gt1_also_fails(self) -> None: class TestRunImplExecCommand: - """Only mock exec_command, generate_token_ids, write_token_ids_to_tmpfile, + """Only mock exec_command_gpu, generate_token_ids, write_token_ids_to_tmpfile, and resolve_model_script — let the rest (build_worker_args, build_dumper_env, build_torchrun_cmd, ParallelConfig, WorkerScriptArgs) run for real.""" @pytest.fixture(autouse=True) def _patch_externals(self) -> Generator[None, None, None]: with ( - patch("miles.utils.debug_utils.run_megatron.cli.commands.run.exec_command") as mock_exec, + patch("miles.utils.debug_utils.run_megatron.cli.commands.run.exec_command_gpu") as mock_exec, patch( "miles.utils.debug_utils.run_megatron.cli.commands.run.generate_token_ids", return_value=list(range(200)), diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 726ef403af..8afdaf887a 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -39,7 +39,7 @@ def test_preserves_source_paths_on_the_pythonpath(self, monkeypatch, tmp_path): """The converter runs out-of-process, so miles and megatron must be on its PYTHONPATH.""" commands = [] monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_gpu", commands.append) command_utils.convert_checkpoint( model_name="model", @@ -99,7 +99,7 @@ def test_reruns_when_the_tracker_holds_an_iteration(self, commands, tmp_path): assert len(commands) == 1 def test_multinode_uses_torchrun_rendezvous_placeholders(self, commands, tmp_path): - """Multi-node conversion must template the placeholders exec_command_all_ray_node substitutes.""" + """Multi-node conversion must template the placeholders exec_command_multi_node substitutes.""" command_utils.convert_checkpoint( model_name="Qwen3-4B", megatron_model_type="qwen3-4B", @@ -128,7 +128,7 @@ class TestRsyncSimple: def test_limits_itself_to_the_requested_node_count(self, monkeypatch): """prepare_cp asks for the training node count; forwarding it is the whole point of the argument.""" calls = [] - monkeypatch.setattr(command_utils, "exec_command_all_ray_node", lambda cmd, **kwargs: calls.append(kwargs)) + monkeypatch.setattr(command_utils, "exec_command_multi_node", lambda cmd, **kwargs: calls.append(kwargs)) command_utils.rsync_simple("/src", "/dst", num_nodes=4) @@ -138,7 +138,7 @@ def test_creates_the_destination_before_copying(self, commands): """rsync fails on a missing destination, so the mkdir has to precede it.""" command_utils.rsync_simple("/src", "/dst") - assert commands == ["[all_ray_node num_nodes=None] mkdir -p /dst && rsync -a --info=progress2 /src/ /dst"] + assert commands == ["[multi_node num_nodes=None] mkdir -p /dst && rsync -a --info=progress2 /src/ /dst"] class TestHfDownloadDataset: @@ -172,7 +172,7 @@ def test_reuses_a_ready_server(self, monkeypatch): commands = [] waits = [] monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: True) - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr( command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs)) ) @@ -188,7 +188,7 @@ def test_restarts_and_waits_until_ready(self, monkeypatch, tmp_path): waits = [] log_path = tmp_path / "mooncake master.log" monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr( command_utils, "wait_for_server_ready", lambda *args, **kwargs: waits.append((args, kwargs)) ) @@ -207,7 +207,7 @@ def test_reports_the_log_when_startup_fails(self, monkeypatch, tmp_path): log_path.write_text("bind failed\nfatal startup error\n") commands = [] monkeypatch.setattr(command_utils, "_is_tcp_server_ready", lambda host, port: False) - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) def fail_wait(*args, **kwargs): raise RuntimeError("not ready") @@ -227,7 +227,7 @@ def test_exports_unbuffered_python_to_ray(self, monkeypatch): commands = [] monkeypatch.delenv("MILES_SCRIPT_EXTERNAL_RAY", raising=False) monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) command_utils.execute_train( @@ -246,7 +246,7 @@ def test_unbuffers_the_ray_workers_too(self, monkeypatch): commands = [] monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="model_type") @@ -260,7 +260,7 @@ def test_preserves_source_paths_in_the_ray_runtime(self, monkeypatch): monkeypatch.setenv("PYTHONPATH", "/sglang:/existing") monkeypatch.setenv("MILES_SCRIPT_EXTERNAL_RAY", "1") monkeypatch.setenv("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1") - monkeypatch.setattr(command_utils, "exec_command", commands.append) + monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) command_utils.execute_train( @@ -474,7 +474,7 @@ def fake_exec_command(cmd: str, capture_output: bool = False) -> str: captured.append(capture_output) return output - monkeypatch.setattr(command_utils, "exec_command", fake_exec_command) + monkeypatch.setattr(command_utils, "exec_command_gpu", fake_exec_command) return captured return install diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt index 837cbaa156..a55d0d820d 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_cp.txt @@ -1,7 +1,7 @@ ### 0 -[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8_torch_dist && rsync -a +[multi_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8_torch_dist && rsync -a --info=progress2 /root/models/DeepSeek-V4-Flash-FP8_torch_dist/ /root/models/DeepSeek-V4-Flash-FP8_torch_dist ### 1 -[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8 && rsync -a +[multi_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8 && rsync -a --info=progress2 /root/models/DeepSeek-V4-Flash-FP8/ /root/models/DeepSeek-V4-Flash-FP8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt index 8cff96ff4c..4dae586339 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt @@ -21,7 +21,7 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3-bf16/ ### 5 -[all_ray_node num_nodes=None] source /scripts/models/deepseek-v3.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/deepseek-v3.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 4 --master-addr {{master_addr}} --master-port 23456 @@ -37,11 +37,11 @@ python /tools/fp8_cast_bf16.py --decoder-last-pipeline-num-layers 6 ### 6 -[all_ray_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3_torch_dist && rsync -a --info=progress2 /root/models/DeepSeek-V3_torch_dist/ /root/local_data/DeepSeek-V3_torch_dist ### 7 -[all_ray_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/local_data/DeepSeek-V3 && rsync -a --info=progress2 /root/models/DeepSeek-V3/ /root/local_data/DeepSeek-V3 ### 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt index aaedbcbade..d7a9db10aa 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt @@ -21,7 +21,7 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ ### 5 -[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt index 1e98750b4f..0c76a74268 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt @@ -21,7 +21,7 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ ### 5 -[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt index 4f8b361312..52049a6660 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_cp.txt @@ -1,7 +1,7 @@ ### 0 -[all_ray_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2_torch_dist && rsync -a --info=progress2 /root/models/DeepSeek-V3.2_torch_dist/ /root/models/DeepSeek-V3.2_torch_dist ### 1 -[all_ray_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/DeepSeek-V3.2 && rsync -a --info=progress2 /root/models/DeepSeek-V3.2/ /root/models/DeepSeek-V3.2 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt index 43bf5f5aaa..3337c300bb 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt @@ -1,5 +1,5 @@ ### 0 -[all_ray_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt index da0a706663..703fd68445 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_cp.txt @@ -1,7 +1,7 @@ ### 0 -[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist && rsync -a +[multi_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist && rsync -a --info=progress2 /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist/ /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist ### 1 -[all_ray_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer && rsync -a +[multi_node num_nodes=1] mkdir -p /root/models/DeepSeek-V4-Flash-FP8-4layer && rsync -a --info=progress2 /root/models/DeepSeek-V4-Flash-FP8-4layer/ /root/models/DeepSeek-V4-Flash-FP8-4layer diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt index b709dc8343..36dfe44709 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt @@ -21,7 +21,7 @@ hf download --local-dir /root/datasets/aime-2025 ### 5 -[all_ray_node num_nodes=None] source /scripts/models/glm4.5-355B-A32B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/glm4.5-355B-A32B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 4 --master-addr {{master_addr}} --master-port 23456 @@ -31,11 +31,11 @@ hf download --save /root/models/GLM-4.5_torch_dist ### 6 -[all_ray_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5_torch_dist && rsync -a --info=progress2 /root/models/GLM-4.5_torch_dist/ /root/local_data/GLM-4.5_torch_dist ### 7 -[all_ray_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/local_data/GLM-4.5 && rsync -a --info=progress2 /root/models/GLM-4.5/ /root/local_data/GLM-4.5 ### 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt index 9df4de9279..808ad82115 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt @@ -11,7 +11,7 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[all_ray_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 @@ -27,11 +27,11 @@ hf download --decoder-last-pipeline-num-layers 20 ### 4 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a --info=progress2 /models/GLM-5.2_torch_dist/ /root/models/GLM-5.2_torch_dist ### 5 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a --info=progress2 /models/GLM-5.2/ /root/models/GLM-5.2 ### 6 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt index abe63c5f53..47e978b1dc 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt @@ -11,7 +11,7 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[all_ray_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt index a03fe20a31..53aa839517 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare_cp.txt @@ -1,7 +1,7 @@ ### 0 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5.2_torch_dist && rsync -a --info=progress2 /models/GLM-5.2_torch_dist/ /root/models/GLM-5.2_torch_dist ### 1 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5.2 && rsync -a --info=progress2 /models/GLM-5.2/ /root/models/GLM-5.2 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt index 5a2e94380c..4aa1775d42 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt @@ -11,7 +11,7 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[all_ray_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 @@ -26,11 +26,11 @@ hf download --decoder-last-pipeline-num-layers 18 ### 4 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a --info=progress2 /models/GLM-5_torch_dist/ /root/models/GLM-5_torch_dist ### 5 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a --info=progress2 /models/GLM-5/ /root/models/GLM-5 ### 6 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt index 0f15caaeda..869fca6eb6 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt @@ -11,7 +11,7 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[all_ray_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt index dc829cee17..52776b98ff 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare_cp.txt @@ -1,7 +1,7 @@ ### 0 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5_torch_dist && rsync -a --info=progress2 /models/GLM-5_torch_dist/ /root/models/GLM-5_torch_dist ### 1 -[all_ray_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/GLM-5 && rsync -a --info=progress2 /models/GLM-5/ /root/models/GLM-5 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt index 81b73042bf..8c7f29097d 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/prepare_cp.txt @@ -1,3 +1,3 @@ ### 0 -[all_ray_node num_nodes=None] mkdir -p /root/models/Inkling-4layer_torch_dist && rsync -a +[multi_node num_nodes=None] mkdir -p /root/models/Inkling-4layer_torch_dist && rsync -a --info=progress2 /root/models/Inkling-4layer_torch_dist/ /root/models/Inkling-4layer_torch_dist diff --git a/tests/test_external_rollout.py b/tests/test_external_rollout.py index e5fe4082a4..b1192621a3 100644 --- a/tests/test_external_rollout.py +++ b/tests/test_external_rollout.py @@ -13,8 +13,8 @@ def prepare(): - U.exec_command("mkdir -p /root/models /root/datasets") - U.exec_command(f"hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir /root/models/{MODEL_NAME}") + U.exec_command_cpu("mkdir -p /root/models /root/datasets") + U.exec_command_cpu(f"hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir /root/models/{MODEL_NAME}") U.hf_download_dataset("zhuzilin/gsm8k") U.convert_checkpoint(model_name=MODEL_NAME, megatron_model_type=MODEL_TYPE, num_gpus_per_node=NUM_GPUS) From 84de461be8cc101b12f465b598e0b08563b45add Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 27 Jul 2026 15:49:29 +0800 Subject: [PATCH 10/18] Move the shell exec helpers next to their only consumers Squashed from: - Move the shell exec helpers next to their only consumers - Carry NodeAffinitySchedulingStrategy along with the moved exec helpers - Stop patching command helpers on a module that no longer has them --- .../single_round/kimina_wrapper.py | 3 +- .../multi_turn/run_geo3k_vlm_multi_turn.py | 2 +- .../run_megatron/cli/commands/compare.py | 2 +- .../run_megatron/cli/commands/run.py | 2 +- miles/utils/external_utils/command_utils.py | 2 +- miles/utils/external_utils/exec_command.py | 95 +++++++++++++++++++ miles/utils/misc.py | 91 ------------------ scripts/run_qwen3_4b_npu.py | 2 +- tests/e2e/short/test_run_megatron.py | 2 +- tests/fast/utils/command_recorder.py | 8 +- 10 files changed, 106 insertions(+), 103 deletions(-) create mode 100644 miles/utils/external_utils/exec_command.py diff --git a/examples/experimental/formal_math/single_round/kimina_wrapper.py b/examples/experimental/formal_math/single_round/kimina_wrapper.py index ffcaf227f7..4746a62cd0 100644 --- a/examples/experimental/formal_math/single_round/kimina_wrapper.py +++ b/examples/experimental/formal_math/single_round/kimina_wrapper.py @@ -8,7 +8,8 @@ from kimina_client import AsyncKiminaClient, CheckResponse from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy -from miles.utils.misc import exec_command_cpu, get_free_port +from miles.utils.external_utils.exec_command import exec_command_cpu +from miles.utils.misc import get_free_port # TODO handle docker stop more gracefully later _KILL_PREVIOUS_KIMINA_DOCKER = bool(int(os.environ.get("MILES_KILL_PREVIOUS_KIMINA_DOCKER", "1"))) diff --git a/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py b/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py index 3bbc4ec0ea..2af2e935e1 100644 --- a/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py +++ b/examples/geo3k_vlm/multi_turn/run_geo3k_vlm_multi_turn.py @@ -1,6 +1,6 @@ import os -import miles.utils.misc as U +import miles.utils.external_utils.exec_command as U from miles.utils.external_utils.command_utils import execute_train MODEL_NAME = os.environ.get("MILES_SCRIPT_MODEL_NAME", "Qwen3-VL-2B-Instruct") diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/compare.py b/miles/utils/debug_utils/run_megatron/cli/commands/compare.py index 7a5b9d95c7..9b86070a97 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/compare.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/compare.py @@ -7,7 +7,7 @@ from miles.utils.debug_utils.run_megatron.cli.commands.args import CompareArgs from miles.utils.debug_utils.run_megatron.logprob_comparator import compare_logprobs -from miles.utils.misc import exec_command_cpu +from miles.utils.external_utils.exec_command import exec_command_cpu from miles.utils.typer_utils import dataclass_cli diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/run.py b/miles/utils/debug_utils/run_megatron/cli/commands/run.py index bad142ce0f..4f1a53659f 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/run.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/run.py @@ -19,7 +19,7 @@ build_worker_args, ) from miles.utils.debug_utils.run_megatron.worker.script_args import WorkerScriptArgs -from miles.utils.misc import exec_command_cpu, exec_command_gpu +from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu from miles.utils.typer_utils import dataclass_cli diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index 8d8e0bf149..11e6ddbf21 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -13,8 +13,8 @@ from functools import partial from pathlib import Path +from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu, exec_command_multi_node from miles.utils.http_utils import wait_for_server_ready -from miles.utils.misc import exec_command_cpu, exec_command_gpu, exec_command_multi_node from miles.utils.typer_utils import dataclass_cli _ = exec_command_cpu, exec_command_gpu, exec_command_multi_node, dataclass_cli diff --git a/miles/utils/external_utils/exec_command.py b/miles/utils/external_utils/exec_command.py new file mode 100644 index 0000000000..c40cbda3b2 --- /dev/null +++ b/miles/utils/external_utils/exec_command.py @@ -0,0 +1,95 @@ +import re +import subprocess + +import ray +from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy + +from miles.utils.misc import get_current_node_ip + + +def exec_command_gpu(cmd: str, capture_output: bool = False) -> str | None: + return _exec_command(cmd, capture_output=capture_output) + + +def exec_command_cpu(cmd: str, capture_output: bool = False) -> str | None: + return _exec_command(cmd, capture_output=capture_output) + + +def _exec_command(cmd: str, capture_output: bool = False) -> str | None: + print(f"EXEC: {cmd}", flush=True) + + try: + result = subprocess.run( + ["bash", "-c", cmd], + shell=False, + check=True, + capture_output=capture_output, + **(dict(text=True) if capture_output else {}), + ) + except subprocess.CalledProcessError as e: + if capture_output: + print(f"{e.stdout=} {e.stderr=}") + raise + + if capture_output: + print(f"Captured stdout={result.stdout} stderr={result.stderr}") + return result.stdout + + +@ray.remote(num_cpus=0.001) +def _exec_command_on_node(cmd: str, capture_output: bool) -> str | None: + return _exec_command(f"unset CUDA_VISIBLE_DEVICES; {cmd}", capture_output=capture_output) + + +def exec_command_multi_node(cmd: str, capture_output: bool = False, num_nodes: int | None = None) -> list[str | None]: + """Execute a shell command on every alive Ray node in parallel. + + Supported placeholders in `cmd` (replaced per-node before execution): + {{node_rank}} - 0-based index of the node + {{nnodes}} - total number of alive nodes (or num_nodes if specified) + {{master_addr}} - NodeManagerAddress of the first node + {{node_ip}} - NodeManagerAddress of the current node + + Args: + num_nodes: If set, only use the first `num_nodes` nodes instead of all alive nodes. + """ + ray.init(address="auto") + try: + current_ip = get_current_node_ip() + nodes = sorted( + [n for n in ray.nodes() if n.get("Alive")], + key=lambda n: (n["NodeManagerAddress"] != current_ip, n["NodeManagerAddress"]), + ) + assert len(nodes) > 0 + + if num_nodes is not None: + assert num_nodes <= len(nodes), f"Requested {num_nodes} nodes but only {len(nodes)} alive nodes available." + nodes = nodes[:num_nodes] + + master_addr = nodes[0]["NodeManagerAddress"] + nnodes = str(len(nodes)) + + placeholder_pattern = re.compile( + "|".join(map(re.escape, ["{{node_rank}}", "{{nnodes}}", "{{master_addr}}", "{{node_ip}}"])) + ) + + refs = [] + for rank, node in enumerate(nodes): + substitutions = { + "{{node_rank}}": str(rank), + "{{nnodes}}": nnodes, + "{{master_addr}}": master_addr, + "{{node_ip}}": node["NodeManagerAddress"], + } + node_cmd = placeholder_pattern.sub(lambda m, s=substitutions: s[m.group(0)], cmd) + refs.append( + _exec_command_on_node.options( + scheduling_strategy=NodeAffinitySchedulingStrategy( + node_id=node["NodeID"], + soft=False, + ), + ).remote(node_cmd, capture_output=capture_output) + ) + return ray.get(refs) + finally: + ray.shutdown() diff --git a/miles/utils/misc.py b/miles/utils/misc.py index 48786f9a48..da39d762cb 100644 --- a/miles/utils/misc.py +++ b/miles/utils/misc.py @@ -2,14 +2,11 @@ import importlib import inspect import logging -import re -import subprocess from collections.abc import Sequence from contextlib import contextmanager from typing import Any import ray -from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy from miles.utils.http_utils import is_port_available @@ -115,94 +112,6 @@ def clear_all_instances(): SingletonMeta._instances.clear() -def exec_command_gpu(cmd: str, capture_output: bool = False) -> str | None: - return _exec_command(cmd, capture_output=capture_output) - - -def exec_command_cpu(cmd: str, capture_output: bool = False) -> str | None: - return _exec_command(cmd, capture_output=capture_output) - - -def _exec_command(cmd: str, capture_output: bool = False) -> str | None: - print(f"EXEC: {cmd}", flush=True) - - try: - result = subprocess.run( - ["bash", "-c", cmd], - shell=False, - check=True, - capture_output=capture_output, - **(dict(text=True) if capture_output else {}), - ) - except subprocess.CalledProcessError as e: - if capture_output: - print(f"{e.stdout=} {e.stderr=}") - raise - - if capture_output: - print(f"Captured stdout={result.stdout} stderr={result.stderr}") - return result.stdout - - -@ray.remote(num_cpus=0.001) -def _exec_command_on_node(cmd: str, capture_output: bool) -> str | None: - return _exec_command(f"unset CUDA_VISIBLE_DEVICES; {cmd}", capture_output=capture_output) - - -def exec_command_multi_node(cmd: str, capture_output: bool = False, num_nodes: int | None = None) -> list[str | None]: - """Execute a shell command on every alive Ray node in parallel. - - Supported placeholders in `cmd` (replaced per-node before execution): - {{node_rank}} - 0-based index of the node - {{nnodes}} - total number of alive nodes (or num_nodes if specified) - {{master_addr}} - NodeManagerAddress of the first node - {{node_ip}} - NodeManagerAddress of the current node - - Args: - num_nodes: If set, only use the first `num_nodes` nodes instead of all alive nodes. - """ - ray.init(address="auto") - try: - current_ip = get_current_node_ip() - nodes = sorted( - [n for n in ray.nodes() if n.get("Alive")], - key=lambda n: (n["NodeManagerAddress"] != current_ip, n["NodeManagerAddress"]), - ) - assert len(nodes) > 0 - - if num_nodes is not None: - assert num_nodes <= len(nodes), f"Requested {num_nodes} nodes but only {len(nodes)} alive nodes available." - nodes = nodes[:num_nodes] - - master_addr = nodes[0]["NodeManagerAddress"] - nnodes = str(len(nodes)) - - placeholder_pattern = re.compile( - "|".join(map(re.escape, ["{{node_rank}}", "{{nnodes}}", "{{master_addr}}", "{{node_ip}}"])) - ) - - refs = [] - for rank, node in enumerate(nodes): - substitutions = { - "{{node_rank}}": str(rank), - "{{nnodes}}": nnodes, - "{{master_addr}}": master_addr, - "{{node_ip}}": node["NodeManagerAddress"], - } - node_cmd = placeholder_pattern.sub(lambda m, s=substitutions: s[m.group(0)], cmd) - refs.append( - _exec_command_on_node.options( - scheduling_strategy=NodeAffinitySchedulingStrategy( - node_id=node["NodeID"], - soft=False, - ), - ).remote(node_cmd, capture_output=capture_output) - ) - return ray.get(refs) - finally: - ray.shutdown() - - def get_current_node_ip(): address = ray._private.services.get_node_ip_address() # strip ipv6 address diff --git a/scripts/run_qwen3_4b_npu.py b/scripts/run_qwen3_4b_npu.py index 952420daa0..6c8e07388a 100644 --- a/scripts/run_qwen3_4b_npu.py +++ b/scripts/run_qwen3_4b_npu.py @@ -1,6 +1,6 @@ import os -import miles.utils.misc as U +import miles.utils.external_utils.exec_command as U from miles.utils.external_utils.command_utils import execute_train_npu MODEL_NAME = os.environ.get("MILES_SCRIPT_MODEL_NAME", "Qwen3-4B-Instruct-2507") diff --git a/tests/e2e/short/test_run_megatron.py b/tests/e2e/short/test_run_megatron.py index 02701b0a8f..9ad02d57bd 100644 --- a/tests/e2e/short/test_run_megatron.py +++ b/tests/e2e/short/test_run_megatron.py @@ -23,7 +23,7 @@ import miles.utils.external_utils.command_utils as U from miles.utils.debug_utils.run_megatron.cli.parallel_utils import ParallelConfig, parse_parallel_args -from miles.utils.misc import exec_command_cpu, exec_command_gpu +from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu app: typer.Typer = typer.Typer() diff --git a/tests/fast/utils/command_recorder.py b/tests/fast/utils/command_recorder.py index 1632f19b99..88e1edb544 100644 --- a/tests/fast/utils/command_recorder.py +++ b/tests/fast/utils/command_recorder.py @@ -1,5 +1,4 @@ import miles.utils.external_utils.command_utils as command_utils -import miles.utils.misc as misc def record_commands(monkeypatch) -> list[str]: @@ -16,9 +15,8 @@ def fake_exec_command_multi_node( commands.append(f"[multi_node num_nodes={num_nodes}] {cmd}") return ["0"] - for module in (command_utils, misc): - monkeypatch.setattr(module, "exec_command_cpu", fake_exec_command, raising=False) - monkeypatch.setattr(module, "exec_command_gpu", fake_exec_command, raising=False) - monkeypatch.setattr(module, "exec_command_multi_node", fake_exec_command_multi_node, raising=False) + monkeypatch.setattr(command_utils, "exec_command_cpu", fake_exec_command) + monkeypatch.setattr(command_utils, "exec_command_gpu", fake_exec_command) + monkeypatch.setattr(command_utils, "exec_command_multi_node", fake_exec_command_multi_node) return commands From 574415b9275cd8492a8f6e538d02fd2e5e38fce2 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 15:06:34 +0800 Subject: [PATCH 11/18] Remove non-reproducible file arguments by supporting inline base64 payloads Squashed from: - Accept inline base64 payloads for the config file arguments - Pass config documents inline instead of through a temp file - Make the inline config payload reach every consumer and fail loudly - Apply pre-commit import ordering - Regenerate the deepseek-v4 snapshots for the inline config payload --- .../eval/eval_delegate_rollout.py | 10 ++-- miles/utils/arguments.py | 11 +++-- miles/utils/external_utils/command_utils.py | 10 ++-- miles/utils/file_arg_utils.py | 11 +++++ scripts/amd/run_qwen3_30b_a3b.py | 2 +- scripts/run_deepseek_v32.py | 4 +- scripts/run_deepseek_v4.py | 2 +- scripts/run_glm45_355b_a32b.py | 2 +- scripts/run_joy_ai_llm_flash.py | 4 +- scripts/run_mcore_fsdp.py | 2 +- scripts/run_qwen3_30b_a3b.py | 4 +- scripts/run_qwen3_4b.py | 4 +- .../test_deepseek_v32_5layer_mxfp8.py | 2 +- .../test_glm5_2_744b_a40b_5layer_nvfp4.py | 2 +- tests/fast/examples/experimental/__init__.py | 0 .../examples/experimental/eval/__init__.py | 0 .../eval/test_eval_delegate_rollout.py | 47 +++++++++++++++++++ tests/fast/launch_scripts/py_harness.py | 6 +-- tests/fast/utils/test_command_utils.py | 25 ++++++---- tests/fast/utils/test_file_arg_utils.py | 47 +++++++++++++++++++ .../scripts/run_deepseek_v4.py/full_train.txt | 2 +- .../py/scripts/run_deepseek_v4.py/train.txt | 2 +- 22 files changed, 157 insertions(+), 42 deletions(-) create mode 100644 miles/utils/file_arg_utils.py create mode 100644 tests/fast/examples/experimental/__init__.py create mode 100644 tests/fast/examples/experimental/eval/__init__.py create mode 100644 tests/fast/examples/experimental/eval/test_eval_delegate_rollout.py create mode 100644 tests/fast/utils/test_file_arg_utils.py diff --git a/examples/experimental/eval/eval_delegate_rollout.py b/examples/experimental/eval/eval_delegate_rollout.py index ef527958fa..ecb0ae28fa 100644 --- a/examples/experimental/eval/eval_delegate_rollout.py +++ b/examples/experimental/eval/eval_delegate_rollout.py @@ -10,6 +10,7 @@ from miles.rollout.base_types import RolloutFnEvalOutput, RolloutFnTrainOutput from miles.rollout.sglang_rollout import generate_rollout as base_generate_rollout +from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX, resolve_file_arg logger = logging.getLogger(__name__) @@ -37,19 +38,22 @@ def _get_delegate_client(args) -> EvalDelegateClient | None: if not config_path: return None + if config_path.startswith(PSEUDO_FILE_PREFIX): + return _build_delegate_client(args, resolve_file_arg(config_path)) + config_path = str(Path(config_path).expanduser()) cache_entry = _DELEGATE_CACHE.get(config_path) mtime = _safe_mtime(config_path) if cache_entry and cache_entry[0] == mtime: return cache_entry[1] - client = _build_delegate_client(args, config_path) + client = _build_delegate_client(args, resolve_file_arg(config_path)) _DELEGATE_CACHE[config_path] = (mtime, client) return client -def _build_delegate_client(args, config_path: str) -> EvalDelegateClient | None: - cfg = OmegaConf.load(config_path) +def _build_delegate_client(args, config_text: str) -> EvalDelegateClient | None: + cfg = OmegaConf.create(config_text) cfg_dict = OmegaConf.to_container(cfg, resolve=True) if not isinstance(cfg_dict, dict): logger.warning("--eval-config must contain a mapping at the root.") diff --git a/miles/utils/arguments.py b/miles/utils/arguments.py index 622059ced5..f36fe6f44c 100644 --- a/miles/utils/arguments.py +++ b/miles/utils/arguments.py @@ -14,6 +14,7 @@ from miles.utils.chat_template_utils.tito_tokenizer import TITOTokenizerType from miles.utils.environ import enable_experimental_ft_trainer, enable_experimental_rollout_refactor from miles.utils.eval_config import EvalDatasetConfig, build_eval_dataset_configs, ensure_dataset_list +from miles.utils.file_arg_utils import resolve_file_arg from miles.utils.ft_utils.health_checker import SimpleHealthCheckerConfig from miles.utils.hf_config import is_dsa, load_hf_config from miles.utils.logging_utils import configure_logger_raw @@ -1187,7 +1188,8 @@ def add_eval_arguments(parser): type=str, default=None, help=( - "Path to an OmegaConf YAML/JSON file describing evaluation datasets. " + "Path to an OmegaConf YAML/JSON file describing evaluation datasets, or an " + "inline `base64:` carrying the same document. " "When provided, this overrides --eval-prompt-data." ), ) @@ -2611,7 +2613,7 @@ def add_user_provided_function_arguments(parser): "--custom-config-path", type=str, default=None, - help="Path to the YAML config for custom function arguments.", + help="Path to the YAML config for custom function arguments, or an inline `base64:`.", ) reset_arg(parser, "--padded-vocab-size", type=int, default=None) @@ -2713,7 +2715,7 @@ def _resolve_eval_datasets(args) -> list[EvalDatasetConfig]: if args.eval_config: from omegaconf import OmegaConf - cfg = OmegaConf.load(args.eval_config) + cfg = OmegaConf.create(resolve_file_arg(args.eval_config)) cfg_dict = OmegaConf.to_container(cfg, resolve=True) if not isinstance(cfg_dict, dict): raise ValueError("--eval-config must contain a mapping at the root.") @@ -3423,8 +3425,7 @@ def miles_validate_args(args): args.use_routing_replay = True if args.custom_config_path: - with open(args.custom_config_path) as f: - data = yaml.safe_load(f) or {} + data = yaml.safe_load(resolve_file_arg(args.custom_config_path)) or {} for k, v in data.items(): if hasattr(args, k): logger.info(f"Warning: Argument {k} is already set to {getattr(args, k)}, will override with {v}.") diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index 11e6ddbf21..c6e9331735 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -2,18 +2,19 @@ This file is not for miles framework itself, but as an optional utility to easily launch miles jobs and tests. """ +import base64 import datetime import json import os import random import shlex import socket -import time from dataclasses import dataclass, field from functools import partial from pathlib import Path from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu, exec_command_multi_node +from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX from miles.utils.http_utils import wait_for_server_ready from miles.utils.typer_utils import dataclass_cli @@ -332,11 +333,8 @@ def start_mooncake_master( ) from exc -def save_to_temp_file(text: str, ext: str): - path = Path(f"/tmp/miles_temp_file_{time.time()}_{random.randrange(0, 10000000)}.{ext}") - path.write_text(text) - print(f"Write the following content to {path=}: {text=}") - return str(path) +def encode_pseudo_file(text: str) -> str: + return PSEUDO_FILE_PREFIX + base64.b64encode(text.encode()).decode() NUM_GPUS_OF_HARDWARE = { diff --git a/miles/utils/file_arg_utils.py b/miles/utils/file_arg_utils.py new file mode 100644 index 0000000000..67324eb43f --- /dev/null +++ b/miles/utils/file_arg_utils.py @@ -0,0 +1,11 @@ +import base64 +from pathlib import Path + +PSEUDO_FILE_PREFIX = "base64:" + + +def resolve_file_arg(value: str) -> str: + """Read a command line argument that is either a file path or an inline `base64:` payload.""" + if value.startswith(PSEUDO_FILE_PREFIX): + return base64.b64decode(value[len(PSEUDO_FILE_PREFIX) :], validate=True).decode() + return Path(value).read_text(encoding="utf-8") diff --git a/scripts/amd/run_qwen3_30b_a3b.py b/scripts/amd/run_qwen3_30b_a3b.py index 1857225eff..e270eeab02 100644 --- a/scripts/amd/run_qwen3_30b_a3b.py +++ b/scripts/amd/run_qwen3_30b_a3b.py @@ -203,7 +203,7 @@ def execute(args: ScriptArgs): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/scripts/run_deepseek_v32.py b/scripts/run_deepseek_v32.py index fde825e7f3..76a2adf464 100644 --- a/scripts/run_deepseek_v32.py +++ b/scripts/run_deepseek_v32.py @@ -378,7 +378,7 @@ def _execute_train(args: ScriptArgs): config: "bf16" """.strip() if "--te-precision-config-file" not in args.extra_args: - misc_args += f"--te-precision-config-file {U.save_to_temp_file(te_precision_config_text, 'yaml')} " + misc_args += f"--te-precision-config-file {U.encode_pseudo_file(te_precision_config_text)} " else: if args.use_single_node: sglang_world_size = 2 @@ -419,7 +419,7 @@ def _execute_train(args: ScriptArgs): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/scripts/run_deepseek_v4.py b/scripts/run_deepseek_v4.py index 283800d6cd..05f006f546 100644 --- a/scripts/run_deepseek_v4.py +++ b/scripts/run_deepseek_v4.py @@ -641,7 +641,7 @@ def _train(args: ScriptArgs): misc_args += "--transformer-impl transformer_engine " "--bf16 " "--fp8-format e4m3 " "--fp8-recipe blockwise " if (args.train_fp8 or args.train_mxfp8) and "--te-precision-config-file" not in args.extra_args: - misc_args += f"--te-precision-config-file " f"{U.save_to_temp_file(_DSV4_TE_PRECISION_CONFIG, 'yaml')} " + misc_args += f"--te-precision-config-file " f"{U.encode_pseudo_file(_DSV4_TE_PRECISION_CONFIG)} " train_args = ( f"{ckpt_args} " diff --git a/scripts/run_glm45_355b_a32b.py b/scripts/run_glm45_355b_a32b.py index aa8b9f79c1..c85f9faffd 100644 --- a/scripts/run_glm45_355b_a32b.py +++ b/scripts/run_glm45_355b_a32b.py @@ -330,7 +330,7 @@ def _execute_train(args: ScriptArgs): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/scripts/run_joy_ai_llm_flash.py b/scripts/run_joy_ai_llm_flash.py index b604e09f61..edc17a403e 100644 --- a/scripts/run_joy_ai_llm_flash.py +++ b/scripts/run_joy_ai_llm_flash.py @@ -250,7 +250,7 @@ def execute(args: ScriptArgs, *, wandb_file: str = __file__): optimizer_args += ( "--optimizer-cpu-offload " "--overlap-cpu-optimizer-d2h-h2d " "--use-precision-aware-optimizer " ) - misc_args += f"--te-precision-config-file {U.save_to_temp_file(MXFP8_TE_PRECISION_CONFIG, 'yaml')} " + misc_args += f"--te-precision-config-file {U.encode_pseudo_file(MXFP8_TE_PRECISION_CONFIG)} " else: sglang_args += "--rollout-num-gpus-per-engine 1 " "--sglang-cuda-graph-max-bs 256 " case _: @@ -271,7 +271,7 @@ def execute(args: ScriptArgs, *, wandb_file: str = __file__): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/scripts/run_mcore_fsdp.py b/scripts/run_mcore_fsdp.py index daca0ee6ef..c598cc90c6 100644 --- a/scripts/run_mcore_fsdp.py +++ b/scripts/run_mcore_fsdp.py @@ -121,7 +121,7 @@ def execute(args: ScriptArgs): rm_type: ifbench n_samples_per_eval_prompt: 1 """.strip() - eval_args += f"--eval-config {U.save_to_temp_file(eval_config_text, 'yaml')} " + eval_args += f"--eval-config {U.encode_pseudo_file(eval_config_text)} " else: eval_args += ( f"--eval-prompt-data aime {args.data_dir}/aime-2024/aime-2024.jsonl " diff --git a/scripts/run_qwen3_30b_a3b.py b/scripts/run_qwen3_30b_a3b.py index 57b65d8c76..1a23d8d64a 100644 --- a/scripts/run_qwen3_30b_a3b.py +++ b/scripts/run_qwen3_30b_a3b.py @@ -285,7 +285,7 @@ def execute(args: ScriptArgs): pattern: "*" config: "bf16" """.strip() - misc_args += f"--te-precision-config-file {U.save_to_temp_file(te_precision_config_text, 'yaml')} " + misc_args += f"--te-precision-config-file {U.encode_pseudo_file(te_precision_config_text)} " if args.enable_megatron_bridge: misc_args += "--megatron-to-hf-mode bridge " @@ -394,7 +394,7 @@ def execute(args: ScriptArgs): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/scripts/run_qwen3_4b.py b/scripts/run_qwen3_4b.py index 3df094a068..3b9d36b599 100644 --- a/scripts/run_qwen3_4b.py +++ b/scripts/run_qwen3_4b.py @@ -166,7 +166,7 @@ def execute(args: ScriptArgs): rm_type: ifbench n_samples_per_eval_prompt: 1 """.strip() - eval_args += f"--eval-config {U.save_to_temp_file(eval_config_text, 'yaml')} " + eval_args += f"--eval-config {U.encode_pseudo_file(eval_config_text)} " else: eval_args += ( f"--eval-prompt-data aime {args.data_dir}/aime-2024/aime-2024.jsonl " @@ -283,7 +283,7 @@ def execute(args: ScriptArgs): tis_batch_normalize: true """.strip() misc_args += ( - f"--custom-config-path {U.save_to_temp_file(config_text, 'yaml')} " + f"--custom-config-path {U.encode_pseudo_file(config_text)} " "--custom-tis-function-path examples.infra_features.train_infer_mismatch_helper.mis.compute_mis_weights_with_cp " ) diff --git a/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py b/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py index c2697313a6..ceb4efb2df 100644 --- a/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py +++ b/tests/e2e/megatron/model_scripts/test_deepseek_v32_5layer_mxfp8.py @@ -111,7 +111,7 @@ def prepare(): def execute(): os.environ.setdefault("RAY_TMPDIR", "/tmp/ray") - te_precision_config_path = U.save_to_temp_file(TE_PRECISION_CONFIG, "yaml") + te_precision_config_path = U.encode_pseudo_file(TE_PRECISION_CONFIG) ckpt_args = f"--hf-checkpoint {MODEL_DIR}/{MODEL_NAME}-MXFP8/ " f"--ref-load {MODEL_DIR}/{MODEL_NAME}_torch_dist " diff --git a/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py b/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py index e223a201bb..5c0b770a0b 100644 --- a/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py +++ b/tests/e2e/megatron/test_glm5_2_744b_a40b_5layer_nvfp4.py @@ -168,7 +168,7 @@ def execute(): os.environ.update(NVFP4_ENV) os.environ.update(GLM5_ENV) os.environ.setdefault("RAY_TMPDIR", "/tmp/ray") - te_precision_config_path = U.save_to_temp_file(TE_PRECISION_CONFIG, "yaml") + te_precision_config_path = U.encode_pseudo_file(TE_PRECISION_CONFIG) ckpt_args = f"--hf-checkpoint {MODEL_DIR}/{MODEL_NAME}-NVFP4/ " f"--ref-load {MODEL_DIR}/{MODEL_NAME}_torch_dist " diff --git a/tests/fast/examples/experimental/__init__.py b/tests/fast/examples/experimental/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/examples/experimental/eval/__init__.py b/tests/fast/examples/experimental/eval/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/examples/experimental/eval/test_eval_delegate_rollout.py b/tests/fast/examples/experimental/eval/test_eval_delegate_rollout.py new file mode 100644 index 0000000000..bb5d16f575 --- /dev/null +++ b/tests/fast/examples/experimental/eval/test_eval_delegate_rollout.py @@ -0,0 +1,47 @@ +import base64 +from types import SimpleNamespace + +import pytest + +from examples.experimental.eval import eval_delegate_rollout +from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX + +_CONFIG = """ +eval: + delegate: + - name: aime +""" + + +@pytest.fixture +def recorded_env_configs(monkeypatch): + seen = [] + monkeypatch.setattr(eval_delegate_rollout, "_rebuild_delegate_config", lambda args, entries, defaults: entries) + monkeypatch.setattr( + eval_delegate_rollout.EvalDelegateClient, + "maybe_create", + classmethod(lambda cls, args, env_configs: seen.append(env_configs)), + ) + eval_delegate_rollout._DELEGATE_CACHE.clear() + return seen + + +class TestGetDelegateClient: + def test_accepts_an_inline_eval_config(self, recorded_env_configs): + """The main parser resolves --eval-config, so the delegate must resolve the same value too.""" + encoded = base64.b64encode(_CONFIG.encode()).decode() + args = SimpleNamespace(eval_config=f"{PSEUDO_FILE_PREFIX}{encoded}") + + eval_delegate_rollout._get_delegate_client(args) + + assert recorded_env_configs == [[{"name": "aime"}]] + + def test_accepts_a_plain_eval_config_path(self, recorded_env_configs, tmp_path): + """A file path keeps working and is still cached by mtime.""" + path = tmp_path / "eval.yaml" + path.write_text(_CONFIG) + args = SimpleNamespace(eval_config=str(path)) + + eval_delegate_rollout._get_delegate_client(args) + + assert recorded_env_configs == [[{"name": "aime"}]] diff --git a/tests/fast/launch_scripts/py_harness.py b/tests/fast/launch_scripts/py_harness.py index 661ce00086..44785cc5d0 100644 --- a/tests/fast/launch_scripts/py_harness.py +++ b/tests/fast/launch_scripts/py_harness.py @@ -71,12 +71,12 @@ def freeze_environment(monkeypatch) -> None: def install_command_recorder(monkeypatch) -> Recording: recording = Recording(commands=record_commands(monkeypatch), pseudo_files=[]) - def fake_save_to_temp_file(text: str, ext: str) -> str: + def fake_encode_pseudo_file(text: str) -> str: recording.pseudo_files.append(text) - return f"/frozen/pseudo_file_{len(recording.pseudo_files)}.{ext}" + return f"base64:" monkeypatch.setattr(command_utils, "create_run_id", lambda: FROZEN_RUN_ID) - monkeypatch.setattr(command_utils, "save_to_temp_file", fake_save_to_temp_file) + monkeypatch.setattr(command_utils, "encode_pseudo_file", fake_encode_pseudo_file) return recording diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 8afdaf887a..2bddcb909e 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -6,6 +6,7 @@ from tests.fast.utils.command_recorder import record_commands import miles.utils.external_utils.command_utils as command_utils +from miles.utils.file_arg_utils import resolve_file_arg @pytest.fixture @@ -576,16 +577,22 @@ def test_defaults_to_off(self, monkeypatch): assert command_utils.get_env_enable_infinite_run() is True -class TestSaveToTempFile: - def test_writes_the_content_and_returns_a_unique_path(self): - """Config text handed to a subprocess has to exist on disk under a collision-free name.""" - first = command_utils.save_to_temp_file("hello: world", "yaml") - second = command_utils.save_to_temp_file("hello: world", "yaml") +class TestEncodePseudoFile: + def test_round_trips_through_resolve_file_arg(self): + """The encoded argument is what the training process will be asked to resolve.""" + encoded = command_utils.encode_pseudo_file("hello: world") - assert first != second - assert first.endswith(".yaml") - with open(first) as f: - assert f.read() == "hello: world" + assert resolve_file_arg(encoded) == "hello: world" + + def test_is_deterministic(self): + """A hot restart must recompute the identical launch command.""" + assert command_utils.encode_pseudo_file("hello: world") == command_utils.encode_pseudo_file("hello: world") + + def test_survives_a_command_line_round_trip(self): + """The value is interpolated into a shell command, so it must not need quoting.""" + encoded = command_utils.encode_pseudo_file("a: 1\nb: 'two words'\n") + + assert shlex.split(f"--custom-config-path {encoded}")[1] == encoded class TestHardwareTables: diff --git a/tests/fast/utils/test_file_arg_utils.py b/tests/fast/utils/test_file_arg_utils.py new file mode 100644 index 0000000000..6c3eecce84 --- /dev/null +++ b/tests/fast/utils/test_file_arg_utils.py @@ -0,0 +1,47 @@ +import base64 +import binascii + +import pytest + +from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX, resolve_file_arg + + +class TestResolveFileArg: + def test_reads_a_plain_file_path(self, tmp_path): + """A bare path keeps working, so existing launchers are unaffected.""" + path = tmp_path / "config.yaml" + path.write_text("a: 1\n") + + assert resolve_file_arg(str(path)) == "a: 1\n" + + def test_decodes_an_inline_base64_payload(self): + """An inline payload needs no shared filesystem between launcher and worker.""" + encoded = base64.b64encode(b"a: 1\n").decode() + + assert resolve_file_arg(f"{PSEUDO_FILE_PREFIX}{encoded}") == "a: 1\n" + + def test_round_trips_multiline_utf8_content(self): + """Config documents are multi-line and may carry non-ascii comments.""" + text = "eval:\n datasets:\n - name: aime # 中文注释\n" + encoded = base64.b64encode(text.encode()).decode() + + assert resolve_file_arg(f"{PSEUDO_FILE_PREFIX}{encoded}") == text + + def test_reads_a_utf8_file_whatever_the_process_locale_is(self, tmp_path): + """OmegaConf.load() always read UTF-8, so a non-UTF-8 default locale must not change the result.""" + path = tmp_path / "config.yaml" + text = "eval:\n name: aime # 中文注释\n" + path.write_text(text, encoding="utf-8") + + assert resolve_file_arg(str(path)) == text + + def test_a_missing_path_still_raises(self, tmp_path): + """A typo in a path must fail loudly rather than silently yield an empty config.""" + with pytest.raises(FileNotFoundError): + resolve_file_arg(str(tmp_path / "absent.yaml")) + + @pytest.mark.parametrize("payload", ["!!!!", "a: 1", "eval:"], ids=["symbols", "yaml", "truncated"]) + def test_a_corrupt_payload_raises_instead_of_decoding_to_nothing(self, payload): + """b64decode() drops invalid characters by default, which would silently yield an empty config.""" + with pytest.raises(binascii.Error): + resolve_file_arg(f"{PSEUDO_FILE_PREFIX}{payload}") diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt index 529be32c53..9e35c427b8 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt @@ -149,7 +149,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/sc --bf16 --fp8-format e4m3 --fp8-recipe blockwise - --te-precision-config-file /frozen/pseudo_file_1.yaml + --te-precision-config-file base64: ### pseudo file 1 configs: diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt index f1b2b1c74b..cddde08377 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt @@ -106,7 +106,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/sc --bf16 --fp8-format e4m3 --fp8-recipe blockwise - --te-precision-config-file /frozen/pseudo_file_1.yaml + --te-precision-config-file base64: ### pseudo file 1 configs: From e454b3d78793d12eb049f6c552d4656f77358208 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 16:20:06 +0800 Subject: [PATCH 12/18] Snapshot the launchers that build their own command line Squashed from: - Snapshot the launchers that build their own command line - Record what the self-executing launchers submit today - Freeze the pid these launchers embed in their cleanup command --- tests/fast/launch_scripts/py_harness.py | 39 ++++++ .../test_self_executing_launchers.py | 110 ++++++++++++++++ .../single_round/run_minimal.py/import.txt | 68 ++++++++++ .../run.py/run/GLM-4.5-Air/broadcast.txt | 106 ++++++++++++++++ .../run.py/run/GLM-4.5-Air/p2p.txt | 107 ++++++++++++++++ .../run.py/run/GLM-4.7-Flash/broadcast.txt | 108 ++++++++++++++++ .../run.py/run/GLM-4.7-Flash/p2p.txt | 109 ++++++++++++++++ .../run.py/run/GLM-5/broadcast.txt | 118 +++++++++++++++++ .../run.py/run/GLM-5/p2p.txt | 119 ++++++++++++++++++ .../run.py/run/GLM-5_20layer/broadcast.txt | 118 +++++++++++++++++ .../run.py/run/GLM-5_20layer/p2p.txt | 119 ++++++++++++++++++ .../run.py/run/GLM-5_4layer/broadcast.txt | 114 +++++++++++++++++ .../run.py/run/GLM-5_4layer/p2p.txt | 115 +++++++++++++++++ .../run.py/run/GLM-Z1-9B-0414/broadcast.txt | 92 ++++++++++++++ .../run.py/run/GLM-Z1-9B-0414/p2p.txt | 93 ++++++++++++++ .../run.py/run/Kimi-K2-Instruct/broadcast.txt | 114 +++++++++++++++++ .../run.py/run/Kimi-K2-Instruct/p2p.txt | 115 +++++++++++++++++ .../Moonlight-16B-A3B-Instruct/broadcast.txt | 100 +++++++++++++++ .../run/Moonlight-16B-A3B-Instruct/p2p.txt | 101 +++++++++++++++ .../broadcast.txt | 107 ++++++++++++++++ .../run/Qwen3-235B-A22B-Instruct-2507/p2p.txt | 108 ++++++++++++++++ .../run.py/run/Qwen3-30B-A3B/broadcast.txt | 105 ++++++++++++++++ .../run.py/run/Qwen3-30B-A3B/p2p.txt | 106 ++++++++++++++++ .../run.py/run/Qwen3-4B/broadcast.txt | 91 ++++++++++++++ .../run.py/run/Qwen3-4B/p2p.txt | 92 ++++++++++++++ 25 files changed, 2574 insertions(+) create mode 100644 tests/fast/launch_scripts/test_self_executing_launchers.py create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt create mode 100644 tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt diff --git a/tests/fast/launch_scripts/py_harness.py b/tests/fast/launch_scripts/py_harness.py index 44785cc5d0..5c2597a5dd 100644 --- a/tests/fast/launch_scripts/py_harness.py +++ b/tests/fast/launch_scripts/py_harness.py @@ -1,8 +1,11 @@ import ast import importlib.util import inspect +import os import re +import subprocess import sys +import time from collections.abc import Iterator from contextlib import contextmanager from dataclasses import dataclass @@ -16,6 +19,10 @@ FROZEN_RUN_ID = "260101-000000-000" +_GPU_COUNT_ANY_WAIT_LOOP_ACCEPTS = "1000000" +_FROZEN_PID = 1000 +_FROZEN_PPID = 1001 + _FROZEN_ENV = { "MASTER_ADDR": "127.0.0.1", "MILES_SCRIPT_ENABLE_RAY_SUBMIT": "1", @@ -61,6 +68,38 @@ def iter_py_launch_scripts() -> list[PyLaunchScript]: return [PyLaunchScript(path=path, entrypoints=tuple(_entrypoint_names(path))) for path in paths] +def iter_self_executing_launchers() -> list[Path]: + """Launchers that reach the shell themselves rather than through command_utils.""" + roots = [REPO_ROOT / root for root in ("scripts", "examples", "tools")] + convention = {script.path for script in iter_py_launch_scripts()} + return sorted( + path + for root in roots + for path in root.rglob("*.py") + if path not in convention and "ray job submit" in path.read_text(errors="replace") + ) + + +def install_shell_recorder(monkeypatch, sandbox: Path) -> Recording: + """A launcher holding its own subprocess handle never touches the recorded command_utils helpers.""" + recording = Recording(commands=[], pseudo_files=[]) + + def fake_run(command, *args, **kwargs): + recording.commands.append(command if isinstance(command, str) else " ".join(command)) + return subprocess.CompletedProcess( + args=command, returncode=0, stdout=_GPU_COUNT_ANY_WAIT_LOOP_ACCEPTS, stderr="" + ) + + monkeypatch.setenv("MILES_LOG_DIR", str(sandbox)) + monkeypatch.setattr(subprocess, "run", fake_run) + monkeypatch.setattr(time, "sleep", lambda seconds: None) + monkeypatch.setattr(os, "makedirs", lambda path, **kwargs: None) + monkeypatch.setattr(os, "getpid", lambda: _FROZEN_PID) + monkeypatch.setattr(os, "getppid", lambda: _FROZEN_PPID) + + return recording + + def freeze_environment(monkeypatch) -> None: for key, value in _FROZEN_ENV.items(): monkeypatch.setenv(key, value) diff --git a/tests/fast/launch_scripts/test_self_executing_launchers.py b/tests/fast/launch_scripts/test_self_executing_launchers.py new file mode 100644 index 0000000000..ec50b9396d --- /dev/null +++ b/tests/fast/launch_scripts/test_self_executing_launchers.py @@ -0,0 +1,110 @@ +from dataclasses import dataclass, field +from pathlib import Path + +import pytest + +from tests.fast.launch_scripts.py_harness import ( + format_recording, + freeze_environment, + import_launch_script, + install_shell_recorder, + iter_self_executing_launchers, +) +from tests.fast.launch_scripts.sh_harness import REPO_ROOT, assert_matches_snapshot + +_SNAPSHOT_DIR = REPO_ROOT / "tests" / "snapshots" / "launch_scripts" / "self_executing" + +_P2P = "examples/infra_features/p2p_weight_transfer/run.py" +_FORMAL_MATH = "examples/experimental/formal_math/single_round/run_minimal.py" + + +@dataclass(frozen=True) +class LauncherCase: + rel: str + name: str + entrypoint: str | None = None + kwargs: dict[str, object] = field(default_factory=dict) + + +_P2P_PROFILES = ( + "GLM-4.5-Air", + "GLM-4.7-Flash", + "GLM-5", + "GLM-5_20layer", + "GLM-5_4layer", + "GLM-Z1-9B-0414", + "Kimi-K2-Instruct", + "Moonlight-16B-A3B-Instruct", + "Qwen3-235B-A22B-Instruct-2507", + "Qwen3-30B-A3B", + "Qwen3-4B", +) + +_CASES = [ + LauncherCase( + rel=_P2P, + name=f"run/{profile}/{mode}", + entrypoint="cmd_run", + kwargs={"model_name": profile, "mode": mode, "node_rank": 0, "head_ip": "10.0.0.1"}, + ) + for profile in _P2P_PROFILES + for mode in ("p2p", "broadcast") +] + [LauncherCase(rel=_FORMAL_MATH, name="import")] + +_ENTRYPOINTS_THE_HARNESS_CANNOT_SANDBOX = {(_P2P, "cmd_prepare")} + + +@pytest.fixture(params=_CASES, ids=[f"{case.rel}::{case.name}" for case in _CASES]) +def recorded(request, monkeypatch, tmp_path): + case = request.param + freeze_environment(monkeypatch) + monkeypatch.setenv("SKIP_VALIDATION", "1") + recording = install_shell_recorder(monkeypatch, sandbox=tmp_path) + module = import_launch_script(REPO_ROOT / case.rel) + if case.entrypoint is not None: + getattr(module, case.entrypoint)(**case.kwargs) + return case, recording, tmp_path + + +class TestEverySelfExecutingLauncher: + def test_commands_match_snapshot(self, recorded): + """These launchers build their whole command line by hand, so only a snapshot pins it.""" + case, recording, sandbox = recorded + snapshot = _SNAPSHOT_DIR / case.rel / f"{case.name}.txt" + + assert_matches_snapshot(snapshot, format_recording(recording, sandbox=sandbox), f"{case.rel}::{case.name}") + + def test_reruns_produce_identical_recordings(self, recorded, monkeypatch, tmp_path): + """These launchers embed their own pid, so a snapshot is only stable if the harness freezes it.""" + case, recording, _ = recorded + freeze_environment(monkeypatch) + monkeypatch.setenv("SKIP_VALIDATION", "1") + again = install_shell_recorder(monkeypatch, sandbox=tmp_path) + module = import_launch_script(REPO_ROOT / case.rel) + if case.entrypoint is not None: + getattr(module, case.entrypoint)(**case.kwargs) + + assert again.commands == recording.commands + + def test_the_launcher_submits_a_ray_job(self, recorded): + """A launcher that stops reaching `ray job submit` is broken, whatever else it records.""" + _, recording, _ = recorded + + assert [command for command in recording.commands if "ray job submit" in command] + + +class TestDiscovery: + def test_every_self_executing_launcher_has_at_least_one_case(self): + """Discovery is by behaviour, not by path, so a new hand-rolled launcher shows up here.""" + discovered = {path.relative_to(REPO_ROOT).as_posix() for path in iter_self_executing_launchers()} + + assert discovered == {case.rel for case in _CASES} + + def test_the_uncovered_entrypoint_is_named_and_still_uncoverable(self): + """cmd_prepare rewrites a checkout under a hardcoded /root/models, which no fixture can redirect.""" + module = import_launch_script(REPO_ROOT / _P2P) + + assert {(_P2P, name) for name in ("cmd_run", "cmd_prepare")} - { + (case.rel, case.entrypoint) for case in _CASES + } == _ENTRYPOINTS_THE_HARNESS_CANNOT_SANDBOX + assert '"/root/models"' in Path(module.__file__).read_text() diff --git a/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt b/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt new file mode 100644 index 0000000000..ad94fb21e0 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt @@ -0,0 +1,68 @@ +### 0 +bash -c export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-8B.sh" && ray job submit + --address="http://127.0.0.1:8265" + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1"}}' + -- python3 train.py ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-8B/ + --ref-load /root/models/Qwen3-8B_torch_dist + --save-interval 20 + --load /root/Qwen3-8B_miles + --save /root/Qwen3-8B_miles + --prompt-data /root/datasets/formal_math_single_round/minimal_demo/flc_train.jsonl + --input-key prompt + --apply-chat-template + --rollout-shuffle + --custom-rm-path examples.experimental.formal_math.single_round.reward_fn.reward_fn + --reward-key reward_value + --log-reward-category reward_cat + --rollout-batch-size 32 + --n-samples-per-prompt 8 + --rollout-max-response-len 8192 + --rollout-temperature 1 + --global-batch-size 256 + --balance-data + --num-rollout 3000 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --use-wandb + --wandb-project miles-formal-math-run-minimal + --wandb-group demo + --wandb-key 'frozen-wandb-api-key' + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 6144 + --eval-interval 20 + --n-samples-per-eval-prompt 1 + --eval-max-response-len 16384 + --eval-top-p 1 + --eval-prompt-data minif2f /root/datasets/formal_math_single_round/minimal_demo/minif2f_test.jsonl + --rollout-num-gpus-per-engine 8 + --sglang-mem-fraction-static 0.7 + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --colocate + --log-passrate diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt new file mode 100644 index 0000000000..0985581a51 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt @@ -0,0 +1,106 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.5-Air + --ref-load /root/GLM-4.5-Air_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 1 + --sequence-parallel + --pipeline-model-parallel-size 4 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 10 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 32 + --sglang-mem-fraction-static 0.8 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 4 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 4294967296 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt new file mode 100644 index 0000000000..83b7170405 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt @@ -0,0 +1,107 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.5-Air + --ref-load /root/GLM-4.5-Air_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 1 + --sequence-parallel + --pipeline-model-parallel-size 4 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 10 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 32 + --sglang-mem-fraction-static 0.8 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 4 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt new file mode 100644 index 0000000000..433f05bf26 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt @@ -0,0 +1,108 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm4.7-flash.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.7-Flash + --ref-load /root/multinode/GLM-4.7-Flash_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime24 /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-temperature 0.6 + --eval-top-p 0.95 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 4 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 4 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt new file mode 100644 index 0000000000..fd2c92f05f --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt @@ -0,0 +1,109 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm4.7-flash.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-4.7-Flash + --ref-load /root/multinode/GLM-4.7-Flash_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime24 /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-temperature 0.6 + --eval-top-p 0.95 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 4 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 4 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt new file mode 100644 index 0000000000..878aae279c --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt @@ -0,0 +1,118 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5 + --ref-load /root/GLM-5_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 8 + --context-parallel-size 2 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 8 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 256 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 64 + --rollout-num-gpus 128 + --sglang-mem-fraction-static 0.9 + --sglang-ep-size 64 + --sglang-dp-size 64 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 131072 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 16 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt new file mode 100644 index 0000000000..84ba31d392 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt @@ -0,0 +1,119 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5 + --ref-load /root/GLM-5_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 8 + --context-parallel-size 2 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 8 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 256 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 64 + --rollout-num-gpus 128 + --sglang-mem-fraction-static 0.9 + --sglang-ep-size 64 + --sglang-dp-size 64 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 131072 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 16 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt new file mode 100644 index 0000000000..f2e0345b5d --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt @@ -0,0 +1,118 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B_20layer.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5_20layer + --ref-load /root/GLM-5_20layer_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 3 + --context-parallel-size 1 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 6 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 16 + --rollout-num-gpus 48 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 16 + --sglang-dp-size 16 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 32768 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 6 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt new file mode 100644 index 0000000000..060b1c407c --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt @@ -0,0 +1,119 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B_20layer.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5_20layer + --ref-load /root/GLM-5_20layer_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 3 + --context-parallel-size 1 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 6 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 1024 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 16 + --rollout-num-gpus 48 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 16 + --sglang-dp-size 16 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 32768 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 6 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt new file mode 100644 index 0000000000..76fdfe325c --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt @@ -0,0 +1,114 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B_4layer.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5_4layer + --ref-load /root/GLM-5_4layer_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt new file mode 100644 index 0000000000..d1012211f0 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt @@ -0,0 +1,115 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/glm5-744B-A40B_4layer.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-5_4layer + --ref-load /root/GLM-5_4layer_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --data-pad-size-multiplier 4096 + --log-probs-chunk-size 1024 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --kl-coef 0.00 + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-page-size 64 + --sglang-nsa-decode-backend flashmla_sparse + --sglang-nsa-prefill-backend flashmla_sparse + --sglang-attention-backend nsa + --sglang-cuda-graph-max-bs 8 + --sglang-max-running-requests 512 + --sglang-chunked-prefill-size 16384 + --sglang-watchdog-timeout 3600 + --sglang-disable-cuda-graph + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --allgather-cp + --moe-token-dispatcher-type alltoall + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt new file mode 100644 index 0000000000..560206d420 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt @@ -0,0 +1,92 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +ray start + --head + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +source "/scripts/models/glm4-9B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-Z1-9B-0414 + --ref-load /root/multinode/GLM-Z1-9B-0414_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 32 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 2 + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 2 + --rollout-num-gpus 4 + --sglang-mem-fraction-static 0.8 '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt new file mode 100644 index 0000000000..cb2a9a61cb --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt @@ -0,0 +1,93 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +ray start + --head + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +source "/scripts/models/glm4-9B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/GLM-Z1-9B-0414 + --ref-load /root/multinode/GLM-Z1-9B-0414_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 32 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 2 + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 2 + --rollout-num-gpus 4 + --sglang-mem-fraction-static 0.8 + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt new file mode 100644 index 0000000000..115505f9e0 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt @@ -0,0 +1,114 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/kimi-k2.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Kimi-K2-Instruct + --ref-load /root/multinode/Kimi-K2-Instruct_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 64 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 8 + --context-parallel-size 4 + --expert-model-parallel-size 32 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 5 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 16384 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 32 + --rollout-num-gpus 256 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 32 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-server-concurrency 1024 + --sglang-moe-runner-backend triton + --sglang-fp8-gemm-backend triton '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --moe-token-dispatcher-type alltoall + --actor-num-nodes 32 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt new file mode 100644 index 0000000000..52de614a9d --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt @@ -0,0 +1,115 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/kimi-k2.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Kimi-K2-Instruct + --ref-load /root/multinode/Kimi-K2-Instruct_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 64 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 8 + --sequence-parallel + --pipeline-model-parallel-size 8 + --context-parallel-size 4 + --expert-model-parallel-size 32 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 5 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 16384 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 32 + --rollout-num-gpus 256 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 32 + --sglang-dp-size 8 + --sglang-moe-dense-tp-size 1 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-server-concurrency 1024 + --sglang-moe-runner-backend triton + --sglang-fp8-gemm-backend triton + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --moe-token-dispatcher-type alltoall + --actor-num-nodes 32 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt new file mode 100644 index 0000000000..ee975b6212 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt @@ -0,0 +1,100 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/moonlight.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Moonlight-16B-A3B-Instruct + --ref-load /root/multinode/Moonlight-16B-A3B-Instruct_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt new file mode 100644 index 0000000000..5886226820 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt @@ -0,0 +1,101 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/moonlight.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Moonlight-16B-A3B-Instruct + --ref-load /root/multinode/Moonlight-16B-A3B-Instruct_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 1.0 + --global-batch-size 16 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --use-kl-loss + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 8 + --sglang-mem-fraction-static 0.7 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt new file mode 100644 index 0000000000..63455c4612 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt @@ -0,0 +1,107 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-235B-A22B-Instruct-2507 + --ref-load /root/multinode/Qwen3-235B-A22B-Instruct-2507_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 64 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 4 + --context-parallel-size 2 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 22 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 32 + --rollout-num-gpus 64 + --sglang-mem-fraction-static 0.75 + --sglang-ep-size 32 + --sglang-dp-size 1 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 8 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt new file mode 100644 index 0000000000..0812884fa3 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt @@ -0,0 +1,108 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-235B-A22B-Instruct-2507 + --ref-load /root/multinode/Qwen3-235B-A22B-Instruct-2507_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 64 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 4 + --context-parallel-size 2 + --expert-model-parallel-size 16 + --expert-tensor-parallel-size 1 + --decoder-last-pipeline-num-layers 22 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 8192 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 32 + --rollout-num-gpus 64 + --sglang-mem-fraction-static 0.75 + --sglang-ep-size 32 + --sglang-dp-size 1 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 8 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt new file mode 100644 index 0000000000..62e0f4baf3 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt @@ -0,0 +1,105 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B + --ref-load /root/multinode/Qwen3-30B-A3B_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 16 + --sglang-mem-fraction-static 0.8 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 2 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt new file mode 100644 index 0000000000..45a3b63863 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt @@ -0,0 +1,106 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +RAY_memory_monitor_refresh_ms=0 ray start + --head + --node-ip-address 10.0.0.1 + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" + +### 11 +source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-30B-A3B + --ref-load /root/multinode/Qwen3-30B-A3B_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 4 + --n-samples-per-prompt 4 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 16 + --balance-data + --eval-prompt-data aime /root/datasets/aime-2024/aime-2024.jsonl + --n-samples-per-eval-prompt 16 + --eval-max-response-len 16384 + --eval-top-p 0.7 + --tensor-model-parallel-size 4 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 1 + --expert-model-parallel-size 8 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator gspo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 4e-4 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --optimizer-cpu-offload + --overlap-cpu-optimizer-d2h-h2d + --use-precision-aware-optimizer + --rollout-num-gpus-per-engine 8 + --rollout-num-gpus 16 + --sglang-mem-fraction-static 0.8 + --sglang-ep-size 8 + --sglang-cuda-graph-bs 1 2 4 8 16 + --sglang-enable-dp-attention + --sglang-enable-dp-lm-head + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 2 + --actor-num-gpus-per-node 8 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt new file mode 100644 index 0000000000..40fc615187 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt @@ -0,0 +1,91 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +ray start + --head + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +source "/scripts/models/qwen3-4B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-4B + --ref-load /root/multinode/Qwen3-4B_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 32 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 2 + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 2 + --rollout-num-gpus 4 + --sglang-mem-fraction-static 0.8 '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode broadcast diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt new file mode 100644 index 0000000000..c89b79aaf1 --- /dev/null +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt @@ -0,0 +1,92 @@ +### 0 +pkill -9 sglang || true + +### 1 +sleep 3 + +### 2 +ray stop + --force || true + +### 3 +pkill -9 ray || true + +### 4 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 5 +sleep 3 + +### 6 +pkill -9 ray || true + +### 7 +pgrep -x 'python|python3' | grep -v -w 1000 | grep -v -w 1001 | xargs -r kill -9 || true + +### 8 +pkill -9 redis || true + +### 9 +ray start + --head + --num-gpus 8 + --disable-usage-stats + --dashboard-host=0.0.0.0 + --dashboard-port=8265 + +### 10 +source "/scripts/models/qwen3-4B.sh" && ray job submit + --address='http://127.0.0.1:8265' + --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' + -- python3 "/train.py" ${MODEL_ARGS[@]} + --hf-checkpoint /root/models/Qwen3-4B + --ref-load /root/multinode/Qwen3-4B_torch_dist + --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl + --input-key prompt + --label-key label + --apply-chat-template + --rollout-shuffle + --rm-type deepscaler + --num-rollout 13 + --rollout-batch-size 8 + --n-samples-per-prompt 8 + --rollout-max-response-len 100 + --rollout-temperature 0.8 + --global-batch-size 32 + --balance-data + --tensor-model-parallel-size 2 + --sequence-parallel + --pipeline-model-parallel-size 1 + --context-parallel-size 2 + --expert-model-parallel-size 1 + --expert-tensor-parallel-size 1 + --recompute-granularity full + --recompute-method uniform + --recompute-num-layers 1 + --use-dynamic-batch-size + --max-tokens-per-gpu 2048 + --advantage-estimator grpo + --kl-loss-coef 0.00 + --kl-loss-type low_var_kl + --entropy-coef 0.00 + --eps-clip 0.2 + --eps-clip-high 0.28 + --optimizer adam + --lr 1e-6 + --lr-decay-style constant + --weight-decay 0.1 + --adam-beta1 0.9 + --adam-beta2 0.98 + --rollout-num-gpus-per-engine 2 + --rollout-num-gpus 4 + --sglang-mem-fraction-static 0.8 + --sglang-remote-instance-weight-loader-start-seed-via-transfer-engine '--sglang-load-format dummy' + --attention-dropout 0.0 + --hidden-dropout 0.0 + --accumulate-allreduce-grads-in-fp32 + --attention-softmax-in-fp32 + --attention-backend flash + --actor-num-nodes 1 + --actor-num-gpus-per-node 4 + --update-weight-buffer-size 1073741824 + --update-weight-transfer-mode p2p From 4e3fcfddf037296c3dd3736dab6d4f8df347721a Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 16:21:46 +0800 Subject: [PATCH 13/18] Fix p2p profile's rotary_base not reaching the model script it configures Squashed from: - Let a p2p profile's rotary_base reach the model script it configures - Test the model args command run.py actually builds, not a copy of its logic - Flip the p2p snapshots to the rotary base each profile declares --- .../infra_features/p2p_weight_transfer/run.py | 22 +++++-- tests/fast/examples/__init__.py | 0 .../fast/examples/infra_features/__init__.py | 0 .../p2p_weight_transfer/__init__.py | 0 .../p2p_weight_transfer/test_run.py | 64 +++++++++++++++++++ .../run.py/run/GLM-4.5-Air/broadcast.txt | 2 +- .../run.py/run/GLM-4.5-Air/p2p.txt | 2 +- .../broadcast.txt | 2 +- .../run/Qwen3-235B-A22B-Instruct-2507/p2p.txt | 2 +- .../run.py/run/Qwen3-30B-A3B/broadcast.txt | 2 +- .../run.py/run/Qwen3-30B-A3B/p2p.txt | 2 +- 11 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 tests/fast/examples/__init__.py create mode 100644 tests/fast/examples/infra_features/__init__.py create mode 100644 tests/fast/examples/infra_features/p2p_weight_transfer/__init__.py create mode 100644 tests/fast/examples/infra_features/p2p_weight_transfer/test_run.py diff --git a/examples/infra_features/p2p_weight_transfer/run.py b/examples/infra_features/p2p_weight_transfer/run.py index c05e93d3d2..dd14e9b145 100644 --- a/examples/infra_features/p2p_weight_transfer/run.py +++ b/examples/infra_features/p2p_weight_transfer/run.py @@ -18,6 +18,7 @@ import json import os +import shlex import subprocess import sys import time @@ -778,7 +779,8 @@ def cmd_run( run_cmd("pkill -9 redis || true", check=False) # --- Source model args --- - model_args_source = f'source "{MILES_ROOT}/scripts/models/{cfg.model_type}.sh"' + model_args_env = build_model_args_env(cfg) + model_args_source = build_model_args_command(cfg) # --- Worker sleep --- if not is_single_node and node_rank > 0: @@ -838,8 +840,7 @@ def cmd_run( } if not is_single_node: env_vars["MC_TRANSFER_TIMEOUT"] = str(cfg.mc_transfer_timeout) - if cfg.rotary_base is not None: - env_vars["MODEL_ARGS_ROTARY_BASE"] = str(cfg.rotary_base) + env_vars.update(model_args_env) env_vars.update(cfg.extra_env_vars) runtime_env_json = json.dumps({"env_vars": env_vars}) @@ -1067,8 +1068,6 @@ def cmd_run( # --- Submit Ray job (head node only, or single-node) --- if is_single_node or node_rank == 0: - import shlex - args_str = " ".join(shlex.quote(a) for a in args) run_cmd( f"{model_args_source} && " @@ -1099,6 +1098,19 @@ def cmd_run( print("Done.") +def build_model_args_command(cfg: RunConfig) -> str: + """A shell snippet leaving MODEL_ARGS set; the knobs must reach it, not only ray's runtime env.""" + prefix = "".join(f"{name}={shlex.quote(value)} " for name, value in build_model_args_env(cfg).items()) + return f'{prefix}source "{MILES_ROOT}/scripts/models/{cfg.model_type}.sh"' + + +def build_model_args_env(cfg: RunConfig) -> dict[str, str]: + """The MODEL_ARGS_* knobs the model definitions read, as declared by the profile.""" + if cfg.rotary_base is None: + return {} + return {"MODEL_ARGS_ROTARY_BASE": str(cfg.rotary_base)} + + # --------------------------------------------------------------------------- # CLI # --------------------------------------------------------------------------- diff --git a/tests/fast/examples/__init__.py b/tests/fast/examples/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/examples/infra_features/__init__.py b/tests/fast/examples/infra_features/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/examples/infra_features/p2p_weight_transfer/__init__.py b/tests/fast/examples/infra_features/p2p_weight_transfer/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/examples/infra_features/p2p_weight_transfer/test_run.py b/tests/fast/examples/infra_features/p2p_weight_transfer/test_run.py new file mode 100644 index 0000000000..c602960b26 --- /dev/null +++ b/tests/fast/examples/infra_features/p2p_weight_transfer/test_run.py @@ -0,0 +1,64 @@ +import importlib.util +import subprocess +from pathlib import Path +from types import ModuleType + +import pytest + +REPO_ROOT = Path(__file__).resolve().parents[5] +RUN_SCRIPT = REPO_ROOT / "examples" / "infra_features" / "p2p_weight_transfer" / "run.py" + +_PROFILES_PINNING_A_ROTARY_BASE = ["Qwen3-235B-A22B-Instruct-2507", "Qwen3-30B-A3B", "GLM-4.5-Air"] + + +@pytest.fixture(scope="module") +def run_module() -> ModuleType: + spec = importlib.util.spec_from_file_location("p2p_weight_transfer_run", RUN_SCRIPT) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def expand_model_args(run_module: ModuleType, model_name: str) -> list[str]: + """Run the very snippet run.py hands to bash, so this keeps testing the real command.""" + command = run_module.build_model_args_command(run_module.RUN_CONFIGS[model_name]) + result = subprocess.run( + f'{command} && printf "%s\\n" "${{MODEL_ARGS[@]}}"', + shell=True, + executable="/bin/bash", + capture_output=True, + text=True, + check=True, + ) + return result.stdout.splitlines() + + +def test_model_args_env_is_empty_when_the_profile_pins_no_rotary_base(run_module: ModuleType) -> None: + """A profile without rotary_base must not inject any MODEL_ARGS_* override.""" + cfg = run_module.RUN_CONFIGS["Qwen3-4B"] + assert cfg.rotary_base is None + assert run_module.build_model_args_env(cfg) == {} + + +def test_model_args_env_carries_the_rotary_base_a_profile_pins(run_module: ModuleType) -> None: + """A profile pinning rotary_base must surface it as the MODEL_ARGS_* name the model definition reads.""" + cfg = run_module.RUN_CONFIGS["Qwen3-235B-A22B-Instruct-2507"] + assert cfg.rotary_base == 5000000 + assert run_module.build_model_args_env(cfg) == {"MODEL_ARGS_ROTARY_BASE": "5000000"} + + +@pytest.mark.parametrize("model_name", _PROFILES_PINNING_A_ROTARY_BASE) +def test_a_pinned_rotary_base_reaches_the_expanded_model_args(run_module: ModuleType, model_name: str) -> None: + """The knob has to survive into the shell that expands MODEL_ARGS, not only into ray's runtime env.""" + tokens = expand_model_args(run_module, model_name) + + assert str(run_module.RUN_CONFIGS[model_name].rotary_base) == tokens[tokens.index("--rotary-base") + 1] + + +@pytest.mark.parametrize("model_name", sorted({"Qwen3-4B", "GLM-4.7-Flash", *_PROFILES_PINNING_A_ROTARY_BASE})) +def test_every_profile_expands_to_a_usable_argv(run_module: ModuleType, model_name: str) -> None: + """A profile naming a model that no longer exists would submit a job with no architecture flags.""" + tokens = expand_model_args(run_module, model_name) + + assert tokens + assert tokens[0].startswith("--") diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt index 0985581a51..4a24915d1f 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt index 83b7170405..b992f74774 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt index 63455c4612..225afb2058 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=5000000 source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt index 0812884fa3..0a96a13815 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=5000000 source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt index 62e0f4baf3..74ab1db0ca 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt index 45a3b63863..259940107b 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} From f9ce73ba7267cd58548eb68c7ecb6845e7bb1eed Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 14:48:57 +0800 Subject: [PATCH 14/18] Snapshot test the argv of all model scripts The next ops rewrite all 62 scripts/models/*.sh into python. Once the shell versions are gone there is no source of truth left to prove the rewrite was faithful, so record the argv each of them expands to now. What these golden files pin is agreement with the shell era, not merely agreement with today's behaviour; the rewrite may only change the producer, never these files. They also give the 18 models that no launcher snapshot reaches their first coverage of any kind. --- .../fast/launch_scripts/model_args_harness.py | 31 ++++ tests/fast/launch_scripts/test_model_args.py | 37 ++++ .../model_args/deepseek-v3-20layer.txt | 75 ++++++++ .../model_args/deepseek-v3-5layer.txt | 75 ++++++++ tests/snapshots/model_args/deepseek-v3.txt | 75 ++++++++ .../model_args/deepseek-v32-5layer.txt | 78 +++++++++ tests/snapshots/model_args/deepseek-v32.txt | 78 +++++++++ .../model_args/deepseek-v4-flash-4layer.txt | 104 +++++++++++ .../model_args/deepseek-v4-flash.txt | 144 ++++++++++++++++ .../snapshots/model_args/deepseek-v4-pro.txt | 162 ++++++++++++++++++ .../model_args/gemma-4-26b-a4b-it.txt | 49 ++++++ tests/snapshots/model_args/gemma-4-31b-it.txt | 28 +++ tests/snapshots/model_args/glm4-32B.txt | 36 ++++ tests/snapshots/model_args/glm4-9B.txt | 33 ++++ .../snapshots/model_args/glm4.5-106B-A12B.txt | 53 ++++++ .../snapshots/model_args/glm4.5-355B-A32B.txt | 56 ++++++ tests/snapshots/model_args/glm4.7-flash.txt | 68 ++++++++ tests/snapshots/model_args/glm5-744B-A40B.txt | 66 +++++++ .../model_args/glm5-744B-A40B_20layer.txt | 66 +++++++ .../model_args/glm5-744B-A40B_4layer.txt | 66 +++++++ .../model_args/glm5.1-744B-A40B_6layer.txt | 66 +++++++ .../glm5.1-744B-A40B_6layer_lora.txt | 66 +++++++ .../model_args/glm5.1-744B-A40B_lora.txt | 66 +++++++ .../snapshots/model_args/glm5.2-744B-A40B.txt | 66 +++++++ .../model_args/glm5.2-744B-A40B_5layer.txt | 66 +++++++ .../glm5.2-744B-A40B_5layer_lora.txt | 66 +++++++ .../model_args/glm5.2-744B-A40B_lora.txt | 66 +++++++ tests/snapshots/model_args/gpt-oss-20b.txt | 47 +++++ tests/snapshots/model_args/inkling-small.txt | 55 ++++++ tests/snapshots/model_args/inkling.txt | 55 ++++++ .../snapshots/model_args/joyai-llm-flash.txt | 73 ++++++++ .../snapshots/model_args/kimi-k2-thinking.txt | 75 ++++++++ tests/snapshots/model_args/kimi-k2.txt | 75 ++++++++ .../snapshots/model_args/kimi-k25_2layer.txt | 75 ++++++++ .../model_args/llama3.1-8B-Instruct.txt | 30 ++++ .../model_args/llama3.2-3B-Instruct-amd.txt | 29 ++++ .../model_args/llama3.2-3B-Instruct.txt | 29 ++++ tests/snapshots/model_args/mimo-7B-rl.txt | 28 +++ tests/snapshots/model_args/moonlight.txt | 78 +++++++++ .../model_args/nemotron-3-nano-30b-a3b.txt | 50 ++++++ .../model_args/nemotron-3-nano-4b.txt | 23 +++ .../model_args/nemotron-3-super-120b-a12b.txt | 52 ++++++ .../nemotron-3-ultra-550b-a55b-4layer.txt | 52 ++++++ .../model_args/nemotron-3-ultra-550b-a55b.txt | 52 ++++++ tests/snapshots/model_args/qwen2.5-0.5B.txt | 23 +++ tests/snapshots/model_args/qwen2.5-1.5B.txt | 23 +++ tests/snapshots/model_args/qwen2.5-32B.txt | 24 +++ tests/snapshots/model_args/qwen2.5-3B.txt | 23 +++ tests/snapshots/model_args/qwen2.5-7B.txt | 24 +++ tests/snapshots/model_args/qwen3-0.6B.txt | 25 +++ tests/snapshots/model_args/qwen3-1.7B.txt | 25 +++ tests/snapshots/model_args/qwen3-14B.txt | 26 +++ .../snapshots/model_args/qwen3-235B-A22B.txt | 49 ++++++ .../model_args/qwen3-30B-A3B-5layer.txt | 49 ++++++ tests/snapshots/model_args/qwen3-30B-A3B.txt | 49 ++++++ tests/snapshots/model_args/qwen3-32B.txt | 26 +++ .../model_args/qwen3-4B-Instruct-2507.txt | 25 +++ tests/snapshots/model_args/qwen3-4B.txt | 25 +++ tests/snapshots/model_args/qwen3-8B.txt | 26 +++ .../model_args/qwen3-next-80B-A3B.txt | 59 +++++++ tests/snapshots/model_args/qwen3.5-27B.txt | 34 ++++ .../snapshots/model_args/qwen3.5-35B-A3B.txt | 59 +++++++ .../model_args/qwen3.5-35B-A3B_lora.txt | 59 +++++++ tests/snapshots/model_args/qwen3.5-4B.txt | 33 ++++ tests/snapshots/model_args/qwen3.5-9B.txt | 34 ++++ tests/snapshots/model_args/qwen3.6-27B.txt | 34 ++++ .../snapshots/model_args/qwen3.6-35B-A3B.txt | 59 +++++++ .../model_args/qwen3.6-35B-A3B_lora.txt | 59 +++++++ 68 files changed, 3592 insertions(+) create mode 100644 tests/fast/launch_scripts/model_args_harness.py create mode 100644 tests/fast/launch_scripts/test_model_args.py create mode 100644 tests/snapshots/model_args/deepseek-v3-20layer.txt create mode 100644 tests/snapshots/model_args/deepseek-v3-5layer.txt create mode 100644 tests/snapshots/model_args/deepseek-v3.txt create mode 100644 tests/snapshots/model_args/deepseek-v32-5layer.txt create mode 100644 tests/snapshots/model_args/deepseek-v32.txt create mode 100644 tests/snapshots/model_args/deepseek-v4-flash-4layer.txt create mode 100644 tests/snapshots/model_args/deepseek-v4-flash.txt create mode 100644 tests/snapshots/model_args/deepseek-v4-pro.txt create mode 100644 tests/snapshots/model_args/gemma-4-26b-a4b-it.txt create mode 100644 tests/snapshots/model_args/gemma-4-31b-it.txt create mode 100644 tests/snapshots/model_args/glm4-32B.txt create mode 100644 tests/snapshots/model_args/glm4-9B.txt create mode 100644 tests/snapshots/model_args/glm4.5-106B-A12B.txt create mode 100644 tests/snapshots/model_args/glm4.5-355B-A32B.txt create mode 100644 tests/snapshots/model_args/glm4.7-flash.txt create mode 100644 tests/snapshots/model_args/glm5-744B-A40B.txt create mode 100644 tests/snapshots/model_args/glm5-744B-A40B_20layer.txt create mode 100644 tests/snapshots/model_args/glm5-744B-A40B_4layer.txt create mode 100644 tests/snapshots/model_args/glm5.1-744B-A40B_6layer.txt create mode 100644 tests/snapshots/model_args/glm5.1-744B-A40B_6layer_lora.txt create mode 100644 tests/snapshots/model_args/glm5.1-744B-A40B_lora.txt create mode 100644 tests/snapshots/model_args/glm5.2-744B-A40B.txt create mode 100644 tests/snapshots/model_args/glm5.2-744B-A40B_5layer.txt create mode 100644 tests/snapshots/model_args/glm5.2-744B-A40B_5layer_lora.txt create mode 100644 tests/snapshots/model_args/glm5.2-744B-A40B_lora.txt create mode 100644 tests/snapshots/model_args/gpt-oss-20b.txt create mode 100644 tests/snapshots/model_args/inkling-small.txt create mode 100644 tests/snapshots/model_args/inkling.txt create mode 100644 tests/snapshots/model_args/joyai-llm-flash.txt create mode 100644 tests/snapshots/model_args/kimi-k2-thinking.txt create mode 100644 tests/snapshots/model_args/kimi-k2.txt create mode 100644 tests/snapshots/model_args/kimi-k25_2layer.txt create mode 100644 tests/snapshots/model_args/llama3.1-8B-Instruct.txt create mode 100644 tests/snapshots/model_args/llama3.2-3B-Instruct-amd.txt create mode 100644 tests/snapshots/model_args/llama3.2-3B-Instruct.txt create mode 100644 tests/snapshots/model_args/mimo-7B-rl.txt create mode 100644 tests/snapshots/model_args/moonlight.txt create mode 100644 tests/snapshots/model_args/nemotron-3-nano-30b-a3b.txt create mode 100644 tests/snapshots/model_args/nemotron-3-nano-4b.txt create mode 100644 tests/snapshots/model_args/nemotron-3-super-120b-a12b.txt create mode 100644 tests/snapshots/model_args/nemotron-3-ultra-550b-a55b-4layer.txt create mode 100644 tests/snapshots/model_args/nemotron-3-ultra-550b-a55b.txt create mode 100644 tests/snapshots/model_args/qwen2.5-0.5B.txt create mode 100644 tests/snapshots/model_args/qwen2.5-1.5B.txt create mode 100644 tests/snapshots/model_args/qwen2.5-32B.txt create mode 100644 tests/snapshots/model_args/qwen2.5-3B.txt create mode 100644 tests/snapshots/model_args/qwen2.5-7B.txt create mode 100644 tests/snapshots/model_args/qwen3-0.6B.txt create mode 100644 tests/snapshots/model_args/qwen3-1.7B.txt create mode 100644 tests/snapshots/model_args/qwen3-14B.txt create mode 100644 tests/snapshots/model_args/qwen3-235B-A22B.txt create mode 100644 tests/snapshots/model_args/qwen3-30B-A3B-5layer.txt create mode 100644 tests/snapshots/model_args/qwen3-30B-A3B.txt create mode 100644 tests/snapshots/model_args/qwen3-32B.txt create mode 100644 tests/snapshots/model_args/qwen3-4B-Instruct-2507.txt create mode 100644 tests/snapshots/model_args/qwen3-4B.txt create mode 100644 tests/snapshots/model_args/qwen3-8B.txt create mode 100644 tests/snapshots/model_args/qwen3-next-80B-A3B.txt create mode 100644 tests/snapshots/model_args/qwen3.5-27B.txt create mode 100644 tests/snapshots/model_args/qwen3.5-35B-A3B.txt create mode 100644 tests/snapshots/model_args/qwen3.5-35B-A3B_lora.txt create mode 100644 tests/snapshots/model_args/qwen3.5-4B.txt create mode 100644 tests/snapshots/model_args/qwen3.5-9B.txt create mode 100644 tests/snapshots/model_args/qwen3.6-27B.txt create mode 100644 tests/snapshots/model_args/qwen3.6-35B-A3B.txt create mode 100644 tests/snapshots/model_args/qwen3.6-35B-A3B_lora.txt diff --git a/tests/fast/launch_scripts/model_args_harness.py b/tests/fast/launch_scripts/model_args_harness.py new file mode 100644 index 0000000000..ceaa42a47d --- /dev/null +++ b/tests/fast/launch_scripts/model_args_harness.py @@ -0,0 +1,31 @@ +import subprocess + +from tests.fast.launch_scripts.sh_harness import REPO_ROOT + +MODEL_SCRIPT_DIR = REPO_ROOT / "scripts" / "models" + +_ENV_WITHOUT_THE_MODEL_ARGS_KNOBS = { + "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "HOME": "/root", + "LANG": "C", + "LC_ALL": "C", +} + + +def iter_model_types() -> list[str]: + return sorted(path.stem for path in MODEL_SCRIPT_DIR.glob("*.sh")) + + +def expand_model_args(model_type: str) -> list[str]: + """The golden files are taken from this shell expansion; whatever replaces it must reproduce them.""" + script = MODEL_SCRIPT_DIR / f"{model_type}.sh" + result = subprocess.run( + f'source "{script}" && printf "%s\\n" "${{MODEL_ARGS[@]}}"', + shell=True, + executable="/bin/bash", + env=_ENV_WITHOUT_THE_MODEL_ARGS_KNOBS, + capture_output=True, + text=True, + check=True, + ) + return result.stdout.splitlines() diff --git a/tests/fast/launch_scripts/test_model_args.py b/tests/fast/launch_scripts/test_model_args.py new file mode 100644 index 0000000000..85fcefd016 --- /dev/null +++ b/tests/fast/launch_scripts/test_model_args.py @@ -0,0 +1,37 @@ +import json + +import pytest + +from tests.fast.launch_scripts.model_args_harness import expand_model_args, iter_model_types +from tests.fast.launch_scripts.sh_harness import REPO_ROOT, assert_matches_snapshot + +_SNAPSHOT_DIR = REPO_ROOT / "tests" / "snapshots" / "model_args" + +_MODEL_TYPES = iter_model_types() + + +class TestEveryModelType: + @pytest.mark.parametrize("model_type", _MODEL_TYPES) + def test_model_args_match_snapshot(self, model_type: str) -> None: + """The golden argv of every model, so a later rewrite of the model definitions cannot drift.""" + actual = "\n".join(json.dumps(token) for token in expand_model_args(model_type)) + "\n" + + assert_matches_snapshot(_SNAPSHOT_DIR / f"{model_type}.txt", actual, model_type) + + @pytest.mark.parametrize("model_type", _MODEL_TYPES) + def test_model_args_are_flags_and_values(self, model_type: str) -> None: + """Consumers split the args on whitespace, so a token that contains any would silently become two.""" + tokens = expand_model_args(model_type) + + assert tokens + assert tokens[0].startswith("--") + assert all(token == token.strip() and " " not in token for token in tokens) + + +class TestDiscovery: + def test_every_model_is_discovered_and_snapshotted(self) -> None: + """A model that stops matching the discovery glob would otherwise lose its golden file silently.""" + snapshotted = {path.stem for path in _SNAPSHOT_DIR.glob("*.txt")} + + assert set(_MODEL_TYPES) == snapshotted + assert len(_MODEL_TYPES) > 60 diff --git a/tests/snapshots/model_args/deepseek-v3-20layer.txt b/tests/snapshots/model_args/deepseek-v3-20layer.txt new file mode 100644 index 0000000000..6837fa9c54 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v3-20layer.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"20" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/deepseek-v3-5layer.txt b/tests/snapshots/model_args/deepseek-v3-5layer.txt new file mode 100644 index 0000000000..4ca144e508 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v3-5layer.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"5" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/deepseek-v3.txt b/tests/snapshots/model_args/deepseek-v3.txt new file mode 100644 index 0000000000..0f7fe21c01 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v3.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/deepseek-v32-5layer.txt b/tests/snapshots/model_args/deepseek-v32-5layer.txt new file mode 100644 index 0000000000..5cd5b61f40 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v32-5layer.txt @@ -0,0 +1,78 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--disable-bias-linear" +"--num-layers" +"5" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/deepseek-v32.txt b/tests/snapshots/model_args/deepseek-v32.txt new file mode 100644 index 0000000000..d48f87901b --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v32.txt @@ -0,0 +1,78 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"128" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"40" +"--rotary-base" +"10000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"4" +"--moe-router-num-groups" +"8" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/deepseek-v4-flash-4layer.txt b/tests/snapshots/model_args/deepseek-v4-flash-4layer.txt new file mode 100644 index 0000000000..ae694b15f3 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v4-flash-4layer.txt @@ -0,0 +1,104 @@ +"--disable-bias-linear" +"--num-layers" +"4" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"2048" +"--num-attention-heads" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--hidden-dropout" +"0.0" +"--attention-dropout" +"0.0" +"--multi-latent-attention" +"--q-lora-rank" +"1024" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"512" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"512" +"--qk-layernorm" +"--rotary-scaling-factor" +"16" +"--rotary-base" +"10000" +"--original-max-position-embeddings" +"65536" +"--beta-fast" +"32" +"--beta-slow" +"1" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sqrtsoftplus" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"1.5" +"--experimental-attention-variant" +"dsv4" +"--dsv4-hc-mult" +"4" +"--dsv4-hc-sinkhorn-iters" +"20" +"--dsv4-compress-ratios" +"0" +"0" +"4" +"128" +"--dsv4-compress-rope-theta" +"160000" +"--dsv4-o-groups" +"8" +"--dsv4-o-lora-rank" +"1024" +"--dsv4-n-hash-layers" +"3" +"--dsv4-window-size" +"128" +"--dsa-indexer-n-heads" +"64" +"--dsa-indexer-head-dim" +"128" +"--dsa-indexer-topk" +"512" +"--spec" +"miles_plugins.models.deepseek_v4.deepseek_v4" +"get_dsv4_spec" +"--activation-func-clamp-value" +"10" +"--no-bias-swiglu-fusion" +"--no-activation-func-clamp-shared-expert" diff --git a/tests/snapshots/model_args/deepseek-v4-flash.txt b/tests/snapshots/model_args/deepseek-v4-flash.txt new file mode 100644 index 0000000000..9517c7d450 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v4-flash.txt @@ -0,0 +1,144 @@ +"--disable-bias-linear" +"--num-layers" +"43" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"2048" +"--num-attention-heads" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--hidden-dropout" +"0.0" +"--attention-dropout" +"0.0" +"--multi-latent-attention" +"--q-lora-rank" +"1024" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"512" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"512" +"--qk-layernorm" +"--rotary-scaling-factor" +"16" +"--rotary-base" +"10000" +"--original-max-position-embeddings" +"65536" +"--beta-fast" +"32" +"--beta-slow" +"1" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sqrtsoftplus" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"1.5" +"--experimental-attention-variant" +"dsv4" +"--dsv4-hc-mult" +"4" +"--dsv4-hc-sinkhorn-iters" +"20" +"--dsv4-compress-ratios" +"0" +"0" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"0" +"--dsv4-compress-rope-theta" +"160000" +"--dsv4-o-groups" +"8" +"--dsv4-o-lora-rank" +"1024" +"--dsv4-n-hash-layers" +"3" +"--dsv4-window-size" +"128" +"--dsa-indexer-n-heads" +"64" +"--dsa-indexer-head-dim" +"128" +"--dsa-indexer-topk" +"512" +"--spec" +"miles_plugins.models.deepseek_v4.deepseek_v4" +"get_dsv4_spec" +"--activation-func-clamp-value" +"10" +"--no-bias-swiglu-fusion" +"--no-activation-func-clamp-shared-expert" diff --git a/tests/snapshots/model_args/deepseek-v4-pro.txt b/tests/snapshots/model_args/deepseek-v4-pro.txt new file mode 100644 index 0000000000..99383e5c96 --- /dev/null +++ b/tests/snapshots/model_args/deepseek-v4-pro.txt @@ -0,0 +1,162 @@ +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"3072" +"--num-attention-heads" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--hidden-dropout" +"0.0" +"--attention-dropout" +"0.0" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"512" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"512" +"--qk-layernorm" +"--rotary-scaling-factor" +"16" +"--rotary-base" +"10000" +"--original-max-position-embeddings" +"65536" +"--beta-fast" +"32" +"--beta-slow" +"1" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"3072" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"3072" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sqrtsoftplus" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--experimental-attention-variant" +"dsv4" +"--dsv4-hc-mult" +"4" +"--dsv4-hc-sinkhorn-iters" +"20" +"--dsv4-compress-ratios" +"128" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"128" +"4" +"0" +"--dsv4-compress-rope-theta" +"160000" +"--dsv4-o-groups" +"16" +"--dsv4-o-lora-rank" +"1024" +"--dsv4-n-hash-layers" +"3" +"--dsv4-window-size" +"128" +"--dsa-indexer-n-heads" +"64" +"--dsa-indexer-head-dim" +"128" +"--dsa-indexer-topk" +"1024" +"--spec" +"miles_plugins.models.deepseek_v4.deepseek_v4" +"get_dsv4_spec" +"--activation-func-clamp-value" +"10" +"--no-bias-swiglu-fusion" +"--no-activation-func-clamp-shared-expert" diff --git a/tests/snapshots/model_args/gemma-4-26b-a4b-it.txt b/tests/snapshots/model_args/gemma-4-26b-a4b-it.txt new file mode 100644 index 0000000000..869640061a --- /dev/null +++ b/tests/snapshots/model_args/gemma-4-26b-a4b-it.txt @@ -0,0 +1,49 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"8" +"--kv-channels" +"256" +"--num-layers" +"30" +"--hidden-size" +"2816" +"--ffn-hidden-size" +"2112" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-06" +"--position-embedding-type" +"rope" +"--rotary-base" +"1000000" +"--vocab-size" +"262144" +"--make-vocab-size-divisible-by" +"128" +"--max-position-embeddings" +"262144" +"--num-experts" +"128" +"--moe-router-topk" +"8" +"--moe-ffn-hidden-size" +"704" +"--moe-router-score-function" +"softmax" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/gemma-4-31b-it.txt b/tests/snapshots/model_args/gemma-4-31b-it.txt new file mode 100644 index 0000000000..23eb5169af --- /dev/null +++ b/tests/snapshots/model_args/gemma-4-31b-it.txt @@ -0,0 +1,28 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"16" +"--kv-channels" +"256" +"--num-layers" +"60" +"--hidden-size" +"5376" +"--ffn-hidden-size" +"21504" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-06" +"--position-embedding-type" +"rope" +"--rotary-base" +"1000000" +"--vocab-size" +"262144" +"--make-vocab-size-divisible-by" +"128" +"--max-position-embeddings" +"262144" diff --git a/tests/snapshots/model_args/glm4-32B.txt b/tests/snapshots/model_args/glm4-32B.txt new file mode 100644 index 0000000000..db67722397 --- /dev/null +++ b/tests/snapshots/model_args/glm4-32B.txt @@ -0,0 +1,36 @@ +"--spec" +"miles_plugins.models.glm4" +"get_glm_spec" +"--swiglu" +"--num-layers" +"64" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"23040" +"--num-attention-heads" +"48" +"--max-position-embeddings" +"32768" +"--seq-length" +"32768" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"10000" +"--group-query-attention" +"--num-query-groups" +"8" +"--vocab-size" +"151552" +"--post-self-attn-layernorm" +"--post-mlp-layernorm" +"--rotary-interleaved" +"--rotary-percent" +"0.5" +"--no-rope-fusion" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/glm4-9B.txt b/tests/snapshots/model_args/glm4-9B.txt new file mode 100644 index 0000000000..06c47fc509 --- /dev/null +++ b/tests/snapshots/model_args/glm4-9B.txt @@ -0,0 +1,33 @@ +"--spec" +"miles_plugins.models.glm4" +"get_glm_spec" +"--swiglu" +"--num-layers" +"40" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"13696" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"2" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"10000" +"--vocab-size" +"151552" +"--post-self-attn-layernorm" +"--post-mlp-layernorm" +"--rotary-interleaved" +"--rotary-percent" +"0.5" +"--no-rope-fusion" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/glm4.5-106B-A12B.txt b/tests/snapshots/model_args/glm4.5-106B-A12B.txt new file mode 100644 index 0000000000..3ce803e637 --- /dev/null +++ b/tests/snapshots/model_args/glm4.5-106B-A12B.txt @@ -0,0 +1,53 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"96" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"46" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"10944" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--rotary-percent" +"0.5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151552" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1408" +"--moe-shared-expert-intermediate-size" +"1408" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[0]*1+[1]*45" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/glm4.5-355B-A32B.txt b/tests/snapshots/model_args/glm4.5-355B-A32B.txt new file mode 100644 index 0000000000..15552b1177 --- /dev/null +++ b/tests/snapshots/model_args/glm4.5-355B-A32B.txt @@ -0,0 +1,56 @@ +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"96" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"92" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"12288" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--rotary-percent" +"0.5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151552" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-shared-expert-intermediate-size" +"1536" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-layer-freq" +"[0]*3+[1]*89" +"--num-experts" +"160" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/glm4.7-flash.txt b/tests/snapshots/model_args/glm4.7-flash.txt new file mode 100644 index 0000000000..2528188ef8 --- /dev/null +++ b/tests/snapshots/model_args/glm4.7-flash.txt @@ -0,0 +1,68 @@ +"--moe-layer-freq" +"[0]*1+[1]*46" +"--num-experts" +"64" +"--moe-shared-expert-intermediate-size" +"1536" +"--moe-router-topk" +"4" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"1.8" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"64" +"--num-layers" +"47" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"10240" +"--num-attention-heads" +"20" +"--disable-bias-linear" +"--add-qkv-bias" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"768" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--no-rope-fusion" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/glm5-744B-A40B.txt b/tests/snapshots/model_args/glm5-744B-A40B.txt new file mode 100644 index 0000000000..6d5e75bca0 --- /dev/null +++ b/tests/snapshots/model_args/glm5-744B-A40B.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*75" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"78" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5-744B-A40B_20layer.txt b/tests/snapshots/model_args/glm5-744B-A40B_20layer.txt new file mode 100644 index 0000000000..119799a40b --- /dev/null +++ b/tests/snapshots/model_args/glm5-744B-A40B_20layer.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*17" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"20" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5-744B-A40B_4layer.txt b/tests/snapshots/model_args/glm5-744B-A40B_4layer.txt new file mode 100644 index 0000000000..c628609775 --- /dev/null +++ b/tests/snapshots/model_args/glm5-744B-A40B_4layer.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*1" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"4" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.1-744B-A40B_6layer.txt b/tests/snapshots/model_args/glm5.1-744B-A40B_6layer.txt new file mode 100644 index 0000000000..7d91f56a61 --- /dev/null +++ b/tests/snapshots/model_args/glm5.1-744B-A40B_6layer.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*3" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"6" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.1-744B-A40B_6layer_lora.txt b/tests/snapshots/model_args/glm5.1-744B-A40B_6layer_lora.txt new file mode 100644 index 0000000000..7d91f56a61 --- /dev/null +++ b/tests/snapshots/model_args/glm5.1-744B-A40B_6layer_lora.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*3" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"6" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.1-744B-A40B_lora.txt b/tests/snapshots/model_args/glm5.1-744B-A40B_lora.txt new file mode 100644 index 0000000000..6d5e75bca0 --- /dev/null +++ b/tests/snapshots/model_args/glm5.1-744B-A40B_lora.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*75" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"78" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"1000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.2-744B-A40B.txt b/tests/snapshots/model_args/glm5.2-744B-A40B.txt new file mode 100644 index 0000000000..4d1d1b346d --- /dev/null +++ b/tests/snapshots/model_args/glm5.2-744B-A40B.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*75" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"78" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"8000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.2-744B-A40B_5layer.txt b/tests/snapshots/model_args/glm5.2-744B-A40B_5layer.txt new file mode 100644 index 0000000000..469c4d2394 --- /dev/null +++ b/tests/snapshots/model_args/glm5.2-744B-A40B_5layer.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*2" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"5" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"8000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.2-744B-A40B_5layer_lora.txt b/tests/snapshots/model_args/glm5.2-744B-A40B_5layer_lora.txt new file mode 100644 index 0000000000..469c4d2394 --- /dev/null +++ b/tests/snapshots/model_args/glm5.2-744B-A40B_5layer_lora.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*2" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"5" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"8000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/glm5.2-744B-A40B_lora.txt b/tests/snapshots/model_args/glm5.2-744B-A40B_lora.txt new file mode 100644 index 0000000000..4d1d1b346d --- /dev/null +++ b/tests/snapshots/model_args/glm5.2-744B-A40B_lora.txt @@ -0,0 +1,66 @@ +"--spec" +"miles_plugins.models.glm5.glm5" +"get_glm5_spec" +"--moe-layer-freq" +"[0]*3+[1]*75" +"--num-experts" +"256" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-topk" +"8" +"--moe-grouped-gemm" +"--moe-permute-fusion" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-pre-softmax" +"--moe-router-enable-expert-bias" +"--moe-router-bias-update-rate" +"0" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-aux-loss-coeff" +"0" +"--moe-router-dtype" +"fp32" +"--make-vocab-size-divisible-by" +"16" +"--num-layers" +"78" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"64" +"--disable-bias-linear" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--position-embedding-type" +"rope" +"--no-position-embedding" +"--normalization" +"RMSNorm" +"--qk-layernorm" +"--multi-latent-attention" +"--q-lora-rank" +"2048" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"192" +"--v-head-dim" +"256" +"--kv-channels" +"192" +"--qk-pos-emb-head-dim" +"64" +"--vocab-size" +"154880" +"--rotary-base" +"8000000" +"--enable-experimental" diff --git a/tests/snapshots/model_args/gpt-oss-20b.txt b/tests/snapshots/model_args/gpt-oss-20b.txt new file mode 100644 index 0000000000..5e270ed877 --- /dev/null +++ b/tests/snapshots/model_args/gpt-oss-20b.txt @@ -0,0 +1,47 @@ +"--num-layers" +"24" +"--hidden-size" +"2880" +"--ffn-hidden-size" +"2880" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--kv-channels" +"64" +"--use-rotary-position-embeddings" +"--rotary-percent" +"1.0" +"--rotary-base" +"150000" +"--max-position-embeddings" +"131072" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"201088" +"--softmax-type" +"learnable" +"--window-size" +"128,0" +"--window-attn-skip-freq" +"2" +"--no-masked-softmax-fusion" +"--no-rope-fusion" +"--num-experts" +"32" +"--moe-router-topk" +"4" +"--moe-aux-loss-coeff" +"0.0" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-dtype" +"fp32" +"--moe-grouped-gemm" diff --git a/tests/snapshots/model_args/inkling-small.txt b/tests/snapshots/model_args/inkling-small.txt new file mode 100644 index 0000000000..95826a4bfa --- /dev/null +++ b/tests/snapshots/model_args/inkling-small.txt @@ -0,0 +1,55 @@ +"--disable-bias-linear" +"--num-layers" +"42" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"2048" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"201024" +"--hidden-dropout" +"0.0" +"--attention-dropout" +"0.0" +"--attention-softmax-in-fp32" +"--position-embedding-type" +"none" +"--no-rope-fusion" +"--no-masked-softmax-fusion" +"--max-position-embeddings" +"1048576" +"--num-experts" +"256" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-grouped-gemm" +"--qk-layernorm" +"--custom-model-provider-path" +"miles_plugins.models.inkling.model.inkling_model_provider" diff --git a/tests/snapshots/model_args/inkling.txt b/tests/snapshots/model_args/inkling.txt new file mode 100644 index 0000000000..ba8fff3388 --- /dev/null +++ b/tests/snapshots/model_args/inkling.txt @@ -0,0 +1,55 @@ +"--disable-bias-linear" +"--num-layers" +"66" +"--hidden-size" +"6144" +"--ffn-hidden-size" +"3072" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"201024" +"--hidden-dropout" +"0.0" +"--attention-dropout" +"0.0" +"--attention-softmax-in-fp32" +"--position-embedding-type" +"none" +"--no-rope-fusion" +"--no-masked-softmax-fusion" +"--max-position-embeddings" +"1048576" +"--num-experts" +"256" +"--moe-ffn-hidden-size" +"3072" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"3072" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-grouped-gemm" +"--qk-layernorm" +"--custom-model-provider-path" +"miles_plugins.models.inkling.model.inkling_model_provider" diff --git a/tests/snapshots/model_args/joyai-llm-flash.txt b/tests/snapshots/model_args/joyai-llm-flash.txt new file mode 100644 index 0000000000..fc5da8444f --- /dev/null +++ b/tests/snapshots/model_args/joyai-llm-flash.txt @@ -0,0 +1,73 @@ +"--disable-bias-linear" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"7168" +"--num-attention-heads" +"32" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"129280" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-base" +"32000000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"256" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"768" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"768" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/kimi-k2-thinking.txt b/tests/snapshots/model_args/kimi-k2-thinking.txt new file mode 100644 index 0000000000..d2b68bbf87 --- /dev/null +++ b/tests/snapshots/model_args/kimi-k2-thinking.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/kimi-k2.txt b/tests/snapshots/model_args/kimi-k2.txt new file mode 100644 index 0000000000..a60319abc0 --- /dev/null +++ b/tests/snapshots/model_args/kimi-k2.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"61" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"32.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/kimi-k25_2layer.txt b/tests/snapshots/model_args/kimi-k25_2layer.txt new file mode 100644 index 0000000000..325ebf082b --- /dev/null +++ b/tests/snapshots/model_args/kimi-k25_2layer.txt @@ -0,0 +1,75 @@ +"--disable-bias-linear" +"--num-layers" +"2" +"--hidden-size" +"7168" +"--ffn-hidden-size" +"18432" +"--num-attention-heads" +"64" +"--kv-channels" +"64" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--q-lora-rank" +"1536" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"64.0" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"384" +"--moe-layer-freq" +"[0,1]" +"--moe-ffn-hidden-size" +"2048" +"--moe-router-topk" +"8" +"--moe-shared-expert-intermediate-size" +"2048" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.827" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/llama3.1-8B-Instruct.txt b/tests/snapshots/model_args/llama3.1-8B-Instruct.txt new file mode 100644 index 0000000000..05634a9211 --- /dev/null +++ b/tests/snapshots/model_args/llama3.1-8B-Instruct.txt @@ -0,0 +1,30 @@ +"--swiglu" +"--num-layers" +"32" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"14336" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--max-position-embeddings" +"131072" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"500000" +"--vocab-size" +"128256" +"--kv-channels" +"128" +"--use-rope-scaling" +"--rotary-scaling-factor" +"8.0" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/llama3.2-3B-Instruct-amd.txt b/tests/snapshots/model_args/llama3.2-3B-Instruct-amd.txt new file mode 100644 index 0000000000..46142bbe0f --- /dev/null +++ b/tests/snapshots/model_args/llama3.2-3B-Instruct-amd.txt @@ -0,0 +1,29 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"3072" +"--ffn-hidden-size" +"8192" +"--num-attention-heads" +"24" +"--group-query-attention" +"--num-query-groups" +"8" +"--max-position-embeddings" +"131072" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"500000" +"--vocab-size" +"128256" +"--kv-channels" +"128" +"--use-rope-scaling" +"--rotary-scaling-factor" +"32.0" diff --git a/tests/snapshots/model_args/llama3.2-3B-Instruct.txt b/tests/snapshots/model_args/llama3.2-3B-Instruct.txt new file mode 100644 index 0000000000..46142bbe0f --- /dev/null +++ b/tests/snapshots/model_args/llama3.2-3B-Instruct.txt @@ -0,0 +1,29 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"3072" +"--ffn-hidden-size" +"8192" +"--num-attention-heads" +"24" +"--group-query-attention" +"--num-query-groups" +"8" +"--max-position-embeddings" +"131072" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"500000" +"--vocab-size" +"128256" +"--kv-channels" +"128" +"--use-rope-scaling" +"--rotary-scaling-factor" +"32.0" diff --git a/tests/snapshots/model_args/mimo-7B-rl.txt b/tests/snapshots/model_args/mimo-7B-rl.txt new file mode 100644 index 0000000000..aff1eaec77 --- /dev/null +++ b/tests/snapshots/model_args/mimo-7B-rl.txt @@ -0,0 +1,28 @@ +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-05" +"--rotary-base" +"640000" +"--vocab-size" +"151680" +"--untie-embeddings-and-output-weights" +"--max-position-embeddings" +"32768" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/moonlight.txt b/tests/snapshots/model_args/moonlight.txt new file mode 100644 index 0000000000..3b0b625f9f --- /dev/null +++ b/tests/snapshots/model_args/moonlight.txt @@ -0,0 +1,78 @@ +"--disable-bias-linear" +"--num-layers" +"27" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11264" +"--num-attention-heads" +"16" +"--kv-channels" +"128" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-5" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--no-masked-softmax-fusion" +"--vocab-size" +"163840" +"--multi-latent-attention" +"--kv-lora-rank" +"512" +"--qk-head-dim" +"128" +"--qk-pos-emb-head-dim" +"64" +"--v-head-dim" +"128" +"--qk-layernorm" +"--rotary-scaling-factor" +"1" +"--rotary-base" +"50000" +"--mscale" +"1.0" +"--mscale-all-dim" +"1.0" +"--attention-softmax-in-fp32" +"--no-rope-fusion" +"--num-experts" +"64" +"--moe-layer-freq" +"[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--moe-ffn-hidden-size" +"1408" +"--moe-router-topk" +"6" +"--moe-shared-expert-intermediate-size" +"2816" +"--moe-router-pre-softmax" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-aux-loss-coeff" +"0" +"--moe-router-bias-update-rate" +"0" +"--moe-router-group-topk" +"1" +"--moe-router-num-groups" +"1" +"--moe-grouped-gemm" +"--moe-router-topk-scaling-factor" +"2.446" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" diff --git a/tests/snapshots/model_args/nemotron-3-nano-30b-a3b.txt b/tests/snapshots/model_args/nemotron-3-nano-30b-a3b.txt new file mode 100644 index 0000000000..ef5e63743c --- /dev/null +++ b/tests/snapshots/model_args/nemotron-3-nano-30b-a3b.txt @@ -0,0 +1,50 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"52" +"--hidden-size" +"2688" +"--ffn-hidden-size" +"1856" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"128" +"--moe-router-topk" +"6" +"--moe-ffn-hidden-size" +"1856" +"--moe-shared-expert-intermediate-size" +"3712" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"2.5" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/nemotron-3-nano-4b.txt b/tests/snapshots/model_args/nemotron-3-nano-4b.txt new file mode 100644 index 0000000000..876b7831a7 --- /dev/null +++ b/tests/snapshots/model_args/nemotron-3-nano-4b.txt @@ -0,0 +1,23 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"40" +"--num-query-groups" +"8" +"--kv-channels" +"128" +"--num-layers" +"42" +"--hidden-size" +"3136" +"--ffn-hidden-size" +"12544" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/nemotron-3-super-120b-a12b.txt b/tests/snapshots/model_args/nemotron-3-super-120b-a12b.txt new file mode 100644 index 0000000000..c59288c7ff --- /dev/null +++ b/tests/snapshots/model_args/nemotron-3-super-120b-a12b.txt @@ -0,0 +1,52 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"88" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"2688" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"512" +"--moe-router-topk" +"22" +"--moe-ffn-hidden-size" +"2688" +"--moe-shared-expert-intermediate-size" +"5376" +"--moe-latent-size" +"1024" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"5.0" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b-4layer.txt b/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b-4layer.txt new file mode 100644 index 0000000000..d05faadb3a --- /dev/null +++ b/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b-4layer.txt @@ -0,0 +1,52 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"4" +"--hidden-size" +"8192" +"--ffn-hidden-size" +"5120" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"512" +"--moe-router-topk" +"22" +"--moe-ffn-hidden-size" +"5120" +"--moe-shared-expert-intermediate-size" +"10240" +"--moe-latent-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"5.0" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b.txt b/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b.txt new file mode 100644 index 0000000000..1c122bf16e --- /dev/null +++ b/tests/snapshots/model_args/nemotron-3-ultra-550b-a55b.txt @@ -0,0 +1,52 @@ +"--disable-bias-linear" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"2" +"--kv-channels" +"128" +"--num-layers" +"108" +"--hidden-size" +"8192" +"--ffn-hidden-size" +"5120" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"none" +"--vocab-size" +"131072" +"--make-vocab-size-divisible-by" +"128" +"--untie-embeddings-and-output-weights" +"--num-experts" +"512" +"--moe-router-topk" +"22" +"--moe-ffn-hidden-size" +"5120" +"--moe-shared-expert-intermediate-size" +"10240" +"--moe-latent-size" +"2048" +"--moe-router-score-function" +"sigmoid" +"--moe-router-enable-expert-bias" +"--moe-grouped-gemm" +"--moe-router-dtype" +"fp32" +"--moe-router-num-groups" +"1" +"--moe-router-group-topk" +"1" +"--moe-router-topk-scaling-factor" +"5.0" +"--moe-router-pre-softmax" +"--moe-router-load-balancing-type" +"seq_aux_loss" +"--moe-router-bias-update-rate" +"0" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/qwen2.5-0.5B.txt b/tests/snapshots/model_args/qwen2.5-0.5B.txt new file mode 100644 index 0000000000..721c4470a0 --- /dev/null +++ b/tests/snapshots/model_args/qwen2.5-0.5B.txt @@ -0,0 +1,23 @@ +"--swiglu" +"--num-layers" +"24" +"--hidden-size" +"896" +"--ffn-hidden-size" +"4864" +"--num-attention-heads" +"14" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" diff --git a/tests/snapshots/model_args/qwen2.5-1.5B.txt b/tests/snapshots/model_args/qwen2.5-1.5B.txt new file mode 100644 index 0000000000..9bbcf46404 --- /dev/null +++ b/tests/snapshots/model_args/qwen2.5-1.5B.txt @@ -0,0 +1,23 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"1536" +"--ffn-hidden-size" +"8960" +"--num-attention-heads" +"12" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"10000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" diff --git a/tests/snapshots/model_args/qwen2.5-32B.txt b/tests/snapshots/model_args/qwen2.5-32B.txt new file mode 100644 index 0000000000..050c409fe7 --- /dev/null +++ b/tests/snapshots/model_args/qwen2.5-32B.txt @@ -0,0 +1,24 @@ +"--swiglu" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"27648" +"--num-attention-heads" +"40" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-5" +"--rotary-base" +"1000000" +"--vocab-size" +"152064" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/qwen2.5-3B.txt b/tests/snapshots/model_args/qwen2.5-3B.txt new file mode 100644 index 0000000000..13a1a611d6 --- /dev/null +++ b/tests/snapshots/model_args/qwen2.5-3B.txt @@ -0,0 +1,23 @@ +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"11008" +"--num-attention-heads" +"16" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--group-query-attention" +"--num-query-groups" +"2" +"--vocab-size" +"151936" diff --git a/tests/snapshots/model_args/qwen2.5-7B.txt b/tests/snapshots/model_args/qwen2.5-7B.txt new file mode 100644 index 0000000000..bb532c7949 --- /dev/null +++ b/tests/snapshots/model_args/qwen2.5-7B.txt @@ -0,0 +1,24 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"3584" +"--ffn-hidden-size" +"18944" +"--num-attention-heads" +"28" +"--group-query-attention" +"--num-query-groups" +"4" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--add-qkv-bias" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-06" +"--rotary-base" +"1000000" +"--vocab-size" +"152064" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/qwen3-0.6B.txt b/tests/snapshots/model_args/qwen3-0.6B.txt new file mode 100644 index 0000000000..a95a4bae12 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-0.6B.txt @@ -0,0 +1,25 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"1024" +"--ffn-hidden-size" +"3072" +"--num-attention-heads" +"16" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" diff --git a/tests/snapshots/model_args/qwen3-1.7B.txt b/tests/snapshots/model_args/qwen3-1.7B.txt new file mode 100644 index 0000000000..9229b5db72 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-1.7B.txt @@ -0,0 +1,25 @@ +"--swiglu" +"--num-layers" +"28" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--num-attention-heads" +"16" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" diff --git a/tests/snapshots/model_args/qwen3-14B.txt b/tests/snapshots/model_args/qwen3-14B.txt new file mode 100644 index 0000000000..a5d2a6fd70 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-14B.txt @@ -0,0 +1,26 @@ +"--swiglu" +"--num-layers" +"40" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"17408" +"--num-attention-heads" +"40" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/qwen3-235B-A22B.txt b/tests/snapshots/model_args/qwen3-235B-A22B.txt new file mode 100644 index 0000000000..ca309da296 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-235B-A22B.txt @@ -0,0 +1,49 @@ +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"64" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"94" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"1536" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/qwen3-30B-A3B-5layer.txt b/tests/snapshots/model_args/qwen3-30B-A3B-5layer.txt new file mode 100644 index 0000000000..7c51b33caf --- /dev/null +++ b/tests/snapshots/model_args/qwen3-30B-A3B-5layer.txt @@ -0,0 +1,49 @@ +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"5" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/qwen3-30B-A3B.txt b/tests/snapshots/model_args/qwen3-30B-A3B.txt new file mode 100644 index 0000000000..731752d9ad --- /dev/null +++ b/tests/snapshots/model_args/qwen3-30B-A3B.txt @@ -0,0 +1,49 @@ +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"32" +"--num-query-groups" +"4" +"--kv-channels" +"128" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"6144" +"--normalization" +"RMSNorm" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"1.0" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"1000000" +"--moe-ffn-hidden-size" +"768" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"128" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" diff --git a/tests/snapshots/model_args/qwen3-32B.txt b/tests/snapshots/model_args/qwen3-32B.txt new file mode 100644 index 0000000000..68a58fad54 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-32B.txt @@ -0,0 +1,26 @@ +"--swiglu" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"25600" +"--num-attention-heads" +"64" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/qwen3-4B-Instruct-2507.txt b/tests/snapshots/model_args/qwen3-4B-Instruct-2507.txt new file mode 100644 index 0000000000..449fe6e120 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-4B-Instruct-2507.txt @@ -0,0 +1,25 @@ +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"5000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" diff --git a/tests/snapshots/model_args/qwen3-4B.txt b/tests/snapshots/model_args/qwen3-4B.txt new file mode 100644 index 0000000000..79493f6771 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-4B.txt @@ -0,0 +1,25 @@ +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9728" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" diff --git a/tests/snapshots/model_args/qwen3-8B.txt b/tests/snapshots/model_args/qwen3-8B.txt new file mode 100644 index 0000000000..aa79e8c0c7 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-8B.txt @@ -0,0 +1,26 @@ +"--swiglu" +"--num-layers" +"36" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--num-attention-heads" +"32" +"--group-query-attention" +"--num-query-groups" +"8" +"--use-rotary-position-embeddings" +"--disable-bias-linear" +"--normalization" +"RMSNorm" +"--norm-epsilon" +"1e-6" +"--rotary-base" +"1000000" +"--vocab-size" +"151936" +"--kv-channels" +"128" +"--qk-layernorm" +"--untie-embeddings-and-output-weights" diff --git a/tests/snapshots/model_args/qwen3-next-80B-A3B.txt b/tests/snapshots/model_args/qwen3-next-80B-A3B.txt new file mode 100644 index 0000000000..ef7df18245 --- /dev/null +++ b/tests/snapshots/model_args/qwen3-next-80B-A3B.txt @@ -0,0 +1,59 @@ +"--spec" +"miles_plugins.models.qwen3_next" +"get_qwen3_next_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"48" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"5120" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"151936" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"10" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"512" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/qwen3.5-27B.txt b/tests/snapshots/model_args/qwen3.5-27B.txt new file mode 100644 index 0000000000..f86af18031 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.5-27B.txt @@ -0,0 +1,34 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"24" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"17408" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" diff --git a/tests/snapshots/model_args/qwen3.5-35B-A3B.txt b/tests/snapshots/model_args/qwen3.5-35B-A3B.txt new file mode 100644 index 0000000000..fd38888427 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.5-35B-A3B.txt @@ -0,0 +1,59 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/qwen3.5-35B-A3B_lora.txt b/tests/snapshots/model_args/qwen3.5-35B-A3B_lora.txt new file mode 100644 index 0000000000..fd38888427 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.5-35B-A3B_lora.txt @@ -0,0 +1,59 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/qwen3.5-4B.txt b/tests/snapshots/model_args/qwen3.5-4B.txt new file mode 100644 index 0000000000..5c990870d4 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.5-4B.txt @@ -0,0 +1,33 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"32" +"--hidden-size" +"2560" +"--ffn-hidden-size" +"9216" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" diff --git a/tests/snapshots/model_args/qwen3.5-9B.txt b/tests/snapshots/model_args/qwen3.5-9B.txt new file mode 100644 index 0000000000..a0ffd5de33 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.5-9B.txt @@ -0,0 +1,34 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"32" +"--hidden-size" +"4096" +"--ffn-hidden-size" +"12288" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" diff --git a/tests/snapshots/model_args/qwen3.6-27B.txt b/tests/snapshots/model_args/qwen3.6-27B.txt new file mode 100644 index 0000000000..f86af18031 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.6-27B.txt @@ -0,0 +1,34 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"24" +"--num-query-groups" +"4" +"--kv-channels" +"256" +"--num-layers" +"64" +"--hidden-size" +"5120" +"--ffn-hidden-size" +"17408" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--attention-output-gate" diff --git a/tests/snapshots/model_args/qwen3.6-35B-A3B.txt b/tests/snapshots/model_args/qwen3.6-35B-A3B.txt new file mode 100644 index 0000000000..fd38888427 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.6-35B-A3B.txt @@ -0,0 +1,59 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" diff --git a/tests/snapshots/model_args/qwen3.6-35B-A3B_lora.txt b/tests/snapshots/model_args/qwen3.6-35B-A3B_lora.txt new file mode 100644 index 0000000000..fd38888427 --- /dev/null +++ b/tests/snapshots/model_args/qwen3.6-35B-A3B_lora.txt @@ -0,0 +1,59 @@ +"--spec" +"miles_plugins.models.qwen3_5" +"get_qwen3_5_spec" +"--disable-bias-linear" +"--qk-layernorm" +"--group-query-attention" +"--num-attention-heads" +"16" +"--num-query-groups" +"2" +"--kv-channels" +"256" +"--num-layers" +"40" +"--hidden-size" +"2048" +"--ffn-hidden-size" +"512" +"--normalization" +"RMSNorm" +"--apply-layernorm-1p" +"--position-embedding-type" +"rope" +"--norm-epsilon" +"1e-6" +"--rotary-percent" +"0.25" +"--swiglu" +"--untie-embeddings-and-output-weights" +"--vocab-size" +"248320" +"--rotary-base" +"10000000" +"--moe-ffn-hidden-size" +"512" +"--moe-shared-expert-intermediate-size" +"512" +"--moe-router-score-function" +"softmax" +"--moe-token-dispatcher-type" +"alltoall" +"--moe-router-topk" +"8" +"--moe-layer-freq" +"[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]" +"--num-experts" +"256" +"--moe-grouped-gemm" +"--moe-token-drop-policy" +"probs" +"--moe-router-dtype" +"fp32" +"--moe-permute-fusion" +"--moe-aux-loss-coeff" +"0" +"--attention-output-gate" +"--moe-shared-expert-gate" +"--mtp-num-layers" +"1" From 08b5d3b97f2b2740ddcb519ad7f6cc561b88fe3d Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 15:11:51 +0800 Subject: [PATCH 15/18] Expand the model args in python before building the command Squashed from: - Expand the model args in python before building the command - Update the launcher snapshots for the inlined model args - Point the command_utils tests at the expanded model args - Freeze the model-args knobs the snapshots now depend on - Skip non-files when scanning the model scripts for environment knobs --- miles/utils/external_utils/command_utils.py | 25 ++-- tests/fast/launch_scripts/py_harness.py | 8 +- .../launch_scripts/test_py_launch_scripts.py | 15 +++ tests/fast/utils/test_command_utils.py | 23 ++-- .../amd/run_deepseek_v4.py/full_train.txt | 120 +++++++++++++++++- .../amd/run_deepseek_v4.py/prepare_spmd.txt | 60 ++++++++- .../scripts/amd/run_deepseek_v4.py/train.txt | 60 ++++++++- .../amd/run_qwen3_30b_a3b.py/execute.txt | 32 ++++- .../amd/run_qwen3_30b_a3b.py/prepare.txt | 32 ++++- .../py/scripts/run_deepseek.py/train.txt | 94 +++++++++++++- .../run_deepseek_v32.py/full_train.txt | 96 +++++++++++++- .../scripts/run_deepseek_v32.py/prepare.txt | 48 ++++++- .../prepare_megatron_ckpt.txt | 48 ++++++- .../py/scripts/run_deepseek_v32.py/train.txt | 48 ++++++- .../scripts/run_deepseek_v4.py/full_train.txt | 120 +++++++++++++++++- .../run_deepseek_v4.py/prepare_spmd.txt | 60 ++++++++- .../py/scripts/run_deepseek_v4.py/train.txt | 60 ++++++++- .../run_gemma_4_26b_a4b.py/full_train.txt | 30 ++++- .../scripts/run_gemma_4_26b_a4b.py/train.txt | 30 ++++- .../scripts/run_gemma_4_31b.py/full_train.txt | 19 ++- .../py/scripts/run_gemma_4_31b.py/train.txt | 19 ++- .../scripts/run_glm45_355b_a32b.py/train.txt | 74 ++++++++++- .../py/scripts/run_glm47_flash.py/execute.txt | 44 ++++++- .../py/scripts/run_glm47_flash.py/prepare.txt | 44 ++++++- .../full_train.txt | 42 +++++- .../run_glm5_1_744b_a40b_lora.py/train.txt | 42 +++++- .../run_glm5_2_744b_a40b.py/full_train.txt | 84 +++++++++++- .../run_glm5_2_744b_a40b.py/prepare.txt | 42 +++++- .../scripts/run_glm5_2_744b_a40b.py/train.txt | 42 +++++- .../full_train.txt | 42 +++++- .../run_glm5_2_744b_a40b_lora.py/train.txt | 42 +++++- .../run_glm5_744b_a40b.py/full_train.txt | 84 +++++++++++- .../scripts/run_glm5_744b_a40b.py/prepare.txt | 42 +++++- .../scripts/run_glm5_744b_a40b.py/train.txt | 42 +++++- .../py/scripts/run_inkling.py/full_train.txt | 37 +++++- .../py/scripts/run_inkling.py/train.txt | 37 +++++- .../run_joy_ai_llm_flash.py/execute.txt | 46 ++++++- .../run_joy_ai_llm_flash.py/prepare.txt | 46 ++++++- .../py/scripts/run_kimi_k25.py/full_train.txt | 47 ++++++- .../py/scripts/run_kimi_k25.py/train.txt | 47 ++++++- .../full_train.txt | 33 ++++- .../train.txt | 33 ++++- .../scripts/run_qwen3_30b_a3b.py/execute.txt | 32 ++++- .../scripts/run_qwen3_30b_a3b.py/prepare.txt | 32 ++++- .../py/scripts/run_qwen3_4b.py/execute.txt | 19 ++- .../py/scripts/run_qwen3_4b.py/prepare.txt | 19 ++- .../full_train.txt | 38 +++++- .../run_qwen3_5_35b_a3b_lora.py/train.txt | 38 +++++- .../execute.txt | 38 +++++- .../prepare.txt | 38 +++++- .../run_qwen3_6_35b_a3b_mtp.py/execute.txt | 38 +++++- .../run_qwen3_6_35b_a3b_mtp.py/prepare.txt | 38 +++++- 52 files changed, 2236 insertions(+), 133 deletions(-) diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index c6e9331735..d296734ba6 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -9,6 +9,7 @@ import random import shlex import socket +import subprocess from dataclasses import dataclass, field from functools import partial from pathlib import Path @@ -31,6 +32,18 @@ def _pythonpath_with_sources(megatron_path: str, *additional_pythonpaths: str | return os.pathsep.join(dict.fromkeys(entries)) +def load_model_args(megatron_model_type: str) -> list[str]: + """Expand the MODEL_ARGS array that scripts/models/.sh declares.""" + script = f"{repo_base_dir}/scripts/models/{megatron_model_type}.sh" + assert os.path.exists(script), f"no model args script at {script}" + expansion = f'source {shlex.quote(script)} && printf "%s\\0" "${{MODEL_ARGS[@]}}"' + result = subprocess.run(["bash", "-c", expansion], capture_output=True, text=True, check=True) + tokens = result.stdout.split("\0")[:-1] + for token in tokens: + assert token.split() == [token], f"model args token must be one whitespace-free word: {token!r}" + return tokens + + def convert_checkpoint( model_name, megatron_model_type, @@ -63,13 +76,12 @@ def convert_checkpoint( fn = exec_command_gpu pythonpath = shlex.quote(_pythonpath_with_sources(megatron_path)) fn( - f"source {repo_base_dir}/scripts/models/{megatron_model_type}.sh && " f"PYTHONPATH={pythonpath} " f"torchrun " f"--nproc-per-node {num_gpus_per_node} " f"{multinode_args}" f"{repo_base_dir}/tools/convert_hf_to_torch_dist.py " - "${MODEL_ARGS[@]} " + f"{' '.join(load_model_args(megatron_model_type))} " f"--hf-checkpoint {hf_checkpoint} " f"--save {path_dst} " f"{extra_args}" @@ -195,18 +207,13 @@ def execute_train( runtime_env_json = json.dumps({"env_vars": runtime_env_vars}) if get_bool_env_var("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1"): - cmd_megatron_model_source = ( - f'source "{repo_base_dir}/scripts/models/{megatron_model_type}.sh" && ' - if megatron_model_type is not None - else "" - ) + model_args = " ".join(load_model_args(megatron_model_type)) if megatron_model_type is not None else "" exec_command_cpu( f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " - f"{cmd_megatron_model_source}" f"""ray job submit {'' if 'RAY_ADDRESS' in os.environ else '--address="http://127.0.0.1:8265" '}""" f"--runtime-env-json={shlex.quote(runtime_env_json)} " f"-- python3 {train_script} " - f"{'${MODEL_ARGS[@]}' if megatron_model_type is not None else ''} " + f"{model_args} " f"{train_args}" ) diff --git a/tests/fast/launch_scripts/py_harness.py b/tests/fast/launch_scripts/py_harness.py index 5c2597a5dd..d50baf9e67 100644 --- a/tests/fast/launch_scripts/py_harness.py +++ b/tests/fast/launch_scripts/py_harness.py @@ -30,12 +30,15 @@ "WANDB_API_KEY": "frozen-wandb-api-key", } -_CLEARED_ENV = ( +CLEARED_ENV = ( "CUDA_VISIBLE_DEVICES", "GITHUB_COMMIT_NAME", "GLOO_SOCKET_IFNAME", "KEEP_MOE_LORA", "MILES_SCRIPT_EXTERNAL_RAY", + "MODEL_ARGS_FIRST_K_DENSE_REPLACE", + "MODEL_ARGS_NUM_LAYERS", + "MODEL_ARGS_ROTARY_BASE", "NCCL_DEBUG", "NCCL_DEBUG_FILE", "NCCL_NVLS_ENABLE", @@ -43,6 +46,7 @@ "NO_PROXY", "OPTIMIZER_CPU_OFFLOAD", "RAY_ADDRESS", + "ROTARY_SCALING_FACTOR", "SLURM_JOB_NUM_NODES", ) @@ -103,7 +107,7 @@ def fake_run(command, *args, **kwargs): def freeze_environment(monkeypatch) -> None: for key, value in _FROZEN_ENV.items(): monkeypatch.setenv(key, value) - for key in _CLEARED_ENV: + for key in CLEARED_ENV: monkeypatch.delenv(key, raising=False) diff --git a/tests/fast/launch_scripts/test_py_launch_scripts.py b/tests/fast/launch_scripts/test_py_launch_scripts.py index ee8ae09ab9..59bbbb72ef 100644 --- a/tests/fast/launch_scripts/test_py_launch_scripts.py +++ b/tests/fast/launch_scripts/test_py_launch_scripts.py @@ -1,10 +1,12 @@ import json +import re from collections.abc import Callable from pathlib import Path import pytest from tests.fast.launch_scripts.py_harness import ( + CLEARED_ENV, call_entrypoint, format_recording, freeze_environment, @@ -147,6 +149,19 @@ def test_the_uncovered_launcher_really_is_uncoverable_here(self, rel): with pytest.raises(ImportError, match="execute_train_npu"): import_launch_script(REPO_ROOT / rel) + def test_every_environment_knob_a_model_script_reads_is_frozen(self): + """The snapshots now pin expanded model args, so a developer's exported override would fail them.""" + knobs = set() + for script in sorted((REPO_ROOT / "scripts" / "models").iterdir()): + if not script.is_file(): + continue + text = script.read_text() + knobs |= set(re.findall(r"\$\{([A-Z][A-Z0-9_]*):-", text)) + knobs |= set(re.findall(r"environ\.get\(\s*\"([A-Z][A-Z0-9_]*)\"", text)) + + assert knobs + assert knobs <= set(CLEARED_ENV) + def test_execute_train_config_defaults_are_not_taken_from_a_slurm_allocation(self, monkeypatch): """SLURM_JOB_NUM_NODES is read at import time, so a stale allocation would skew every snapshot.""" import miles.utils.external_utils.command_utils as command_utils diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 2bddcb909e..28b9c0b15f 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -44,7 +44,7 @@ def test_preserves_source_paths_on_the_pythonpath(self, monkeypatch, tmp_path): command_utils.convert_checkpoint( model_name="model", - megatron_model_type="model_type", + megatron_model_type="qwen3-4B", num_gpus_per_node=1, dir_dst=str(tmp_path), megatron_path="/megatron", @@ -234,7 +234,7 @@ def test_exports_unbuffered_python_to_ray(self, monkeypatch): command_utils.execute_train( train_args="", num_gpus_per_node=1, - megatron_model_type="model_type", + megatron_model_type="qwen3-4B", ) exports = [command for command in commands if "export PYTHONUNBUFFERED" in command] @@ -250,7 +250,7 @@ def test_unbuffers_the_ray_workers_too(self, monkeypatch): monkeypatch.setattr(command_utils, "exec_command_cpu", commands.append) monkeypatch.setattr(command_utils, "check_has_nvlink", lambda: False) - command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="model_type") + command_utils.execute_train(train_args="", num_gpus_per_node=1, megatron_model_type="qwen3-4B") runtime_env_arg = next(arg for arg in shlex.split(commands[-1]) if arg.startswith("--runtime-env-json=")) assert json.loads(runtime_env_arg.split("=", 1)[1])["env_vars"]["PYTHONUNBUFFERED"] == "1" @@ -267,7 +267,7 @@ def test_preserves_source_paths_in_the_ray_runtime(self, monkeypatch): command_utils.execute_train( train_args="", num_gpus_per_node=1, - megatron_model_type="model_type", + megatron_model_type="qwen3-4B", megatron_path="/megatron", extra_env_vars={"PYTHONPATH": "/custom:/sglang", "QUOTED_VALUE": "it's preserved"}, ) @@ -328,21 +328,20 @@ def test_can_skip_the_ray_job_submit(self, commands, monkeypatch): assert not any("ray job submit" in command for command in commands) - def test_sources_the_model_config_and_expands_model_args(self, commands): - """The megatron model type is turned into a `source` plus a ${MODEL_ARGS[@]} expansion.""" + def test_expands_the_model_config_into_the_submitted_command(self, commands): + """The megatron model type is expanded into the argv its model script declares.""" command_utils.execute_train(train_args="--x 1", num_gpus_per_node=8, megatron_model_type="qwen3-4B") submit = commands[-1] - assert f'source "{command_utils.repo_base_dir}/scripts/models/qwen3-4B.sh" && ' in submit - assert "${MODEL_ARGS[@]}" in submit + assert "--num-layers 36 " in submit + assert "source" not in submit assert submit.endswith("--x 1") - def test_omits_the_model_source_for_fsdp(self, commands): - """FSDP has no megatron model config to source.""" + def test_omits_the_model_args_for_fsdp(self, commands): + """FSDP has no megatron model config to expand.""" command_utils.execute_train(train_args="--train-backend fsdp", num_gpus_per_node=8, megatron_model_type=None) - assert "scripts/models/" not in commands[-1] - assert "${MODEL_ARGS[@]}" not in commands[-1] + assert "--num-layers" not in commands[-1] def test_drops_cuda_device_max_connections_for_fsdp(self, commands): """Pinning it to 1 breaks computation/communication overlap on FSDP.""" diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt index c12b362f2c..e13b718821 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt @@ -31,8 +31,64 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-bf16/ ### 7 -source /scripts/models/deepseek-v4-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 43 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 0 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-bf16 --save /root/models/DeepSeek-V4-Flash-FP8_torch_dist --expert-tensor-parallel-size 1 @@ -56,10 +112,66 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 11 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HACK_FLASHMLA_BACKEND": "unified_kv_triton", "SGLANG_OPT_USE_COMPRESSOR_V2": "true", "SGLANG_OPT_USE_TILELANG_INDEXER": "true", "SGLANG_OPT_USE_JIT_NORM": "true", "SGLANG_OPT_USE_FUSED_COMPRESS": "true", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "AITER_BF16_FP8_MOE_BOUND": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 43 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 0 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8 --ref-load /root/models/DeepSeek-V4-Flash-FP8_torch_dist --load /root/models/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt index d8521befd5..a628e78167 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt @@ -1,6 +1,62 @@ ### 0 -source /scripts/models/deepseek-v4-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 43 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 0 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-bf16 --save /root/models/DeepSeek-V4-Flash-FP8_torch_dist --expert-tensor-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt index bab1b53696..5ea025564a 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt @@ -13,10 +13,66 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HACK_FLASHMLA_BACKEND": "unified_kv_triton", "SGLANG_OPT_USE_COMPRESSOR_V2": "true", "SGLANG_OPT_USE_TILELANG_INDEXER": "true", "SGLANG_OPT_USE_JIT_NORM": "true", "SGLANG_OPT_USE_FUSED_COMPRESS": "true", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "AITER_BF16_FP8_MOE_BOUND": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 43 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 0 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint None --ref-load /root/models/DeepSeek-V4-Flash-FP8_torch_dist --load /root/models/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt index 16cf596613..baff9e14df 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt @@ -13,10 +13,38 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 32 + --num-query-groups 4 + --kv-channels 128 + --num-layers 48 + --hidden-size 2048 + --ffn-hidden-size 6144 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 1.0 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151936 + --rotary-base 1000000 + --moe-ffn-hidden-size 768 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 128 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/Qwen3-30B-A3B/ --ref-load /root/models/Qwen3-30B-A3B_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt index 76254f6091..99783d0289 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt @@ -16,7 +16,35 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/qwen3-30B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 32 + --num-query-groups 4 + --kv-channels 128 + --num-layers 48 + --hidden-size 2048 + --ffn-hidden-size 6144 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 1.0 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151936 + --rotary-base 1000000 + --moe-ffn-hidden-size 768 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 128 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/Qwen3-30B-A3B --save /root/models/Qwen3-30B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt index 4dae586339..300d7a98f8 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt @@ -21,12 +21,55 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3-bf16/ ### 5 -[multi_node num_nodes=None] source /scripts/models/deepseek-v3.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 4 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3-bf16 --save /root/models/DeepSeek-V3_torch_dist --tensor-model-parallel-size 1 @@ -59,10 +102,53 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 11 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v3.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/local_data/DeepSeek-V3 --ref-load /root/local_data/DeepSeek-V3_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt index d7a9db10aa..c74183d685 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt @@ -21,12 +21,56 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ ### 5 -[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 --save /root/models/DeepSeek-V3.2_torch_dist --tensor-model-parallel-size 4 @@ -50,10 +94,54 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 9 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v32.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_NSA_FORCE_MLA": "1", "SGLANG_NSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3.2/ --ref-load /root/models/DeepSeek-V3.2_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt index 0c76a74268..34fc8fcfbb 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt @@ -21,12 +21,56 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V3.2-bf16/ ### 5 -[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 --save /root/models/DeepSeek-V3.2_torch_dist --tensor-model-parallel-size 4 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt index 3337c300bb..50b7d6b52c 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt @@ -1,10 +1,54 @@ ### 0 -[multi_node num_nodes=None] source /scripts/models/deepseek-v32.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3.2-bf16 --save /root/models/DeepSeek-V3.2_torch_dist --tensor-model-parallel-size 4 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt index 4e459895d3..59bfcd7d6d 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt @@ -13,10 +13,54 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v32.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_NSA_FORCE_MLA": "1", "SGLANG_NSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 128 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 40 + --rotary-base 10000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 4 + --moe-router-num-groups 8 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/DeepSeek-V3.2/ --ref-load /root/models/DeepSeek-V3.2_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt index 9e35c427b8..2098bd0d89 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt @@ -31,8 +31,64 @@ python /tools/fp8_cast_bf16.py --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16/ ### 7 -source /scripts/models/deepseek-v4-flash-4layer.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 4 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16 --save /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist --expert-tensor-parallel-size 1 @@ -56,10 +112,66 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 11 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash-4layer.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "SGLANG_DG_CACHE_DIR_PER_PROCESS": "1", "SGLANG_OPT_FP8_WO_A_GEMM": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 4 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer --ref-load /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist --load /root/models/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt index 7c23cc53bc..85964a5eb1 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt @@ -1,6 +1,62 @@ ### 0 -source /scripts/models/deepseek-v4-flash-4layer.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 4 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer-bf16 --save /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist --expert-tensor-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt index cddde08377..b21954850e 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt @@ -13,10 +13,66 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/deepseek-v4-flash-4layer.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_CHECKPOINT_LOAD_CHECK": "1", "SGLANG_DSV4_FP4_EXPERTS": "0", "SGLANG_HEALTH_CHECK_TIMEOUT": "120", "SGLANG_DG_CACHE_DIR_PER_PROCESS": "1", "SGLANG_OPT_FP8_WO_A_GEMM": "0", "NCCL_ALGO": "Ring", "NVTE_ALLOW_NONDETERMINISTIC_ALGO": "0", "CUBLAS_WORKSPACE_CONFIG": ":4096:8", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 4 + --hidden-size 4096 + --ffn-hidden-size 2048 + --num-attention-heads 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --multi-latent-attention + --q-lora-rank 1024 + --kv-lora-rank 512 + --qk-head-dim 512 + --qk-pos-emb-head-dim 64 + --v-head-dim 512 + --qk-layernorm + --rotary-scaling-factor 16 + --rotary-base 10000 + --original-max-position-embeddings 65536 + --beta-fast 32 + --beta-slow 1 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sqrtsoftplus + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 1.5 + --experimental-attention-variant dsv4 + --dsv4-hc-mult 4 + --dsv4-hc-sinkhorn-iters 20 + --dsv4-compress-ratios 0 0 4 128 + --dsv4-compress-rope-theta 160000 + --dsv4-o-groups 8 + --dsv4-o-lora-rank 1024 + --dsv4-n-hash-layers 3 + --dsv4-window-size 128 + --dsa-indexer-n-heads 64 + --dsa-indexer-head-dim 128 + --dsa-indexer-topk 512 + --spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec + --activation-func-clamp-value 10 + --no-bias-swiglu-fusion + --no-activation-func-clamp-shared-expert --hf-checkpoint /root/models/DeepSeek-V4-Flash-FP8-4layer --ref-load /root/models/DeepSeek-V4-Flash-FP8-4layer_torch_dist --load /root/models/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt index 84324ace64..059e8c799b 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/full_train.txt @@ -25,10 +25,36 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-26b-a4b-it.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 16 + --num-query-groups 8 + --kv-channels 256 + --num-layers 30 + --hidden-size 2816 + --ffn-hidden-size 2112 + --normalization RMSNorm + --norm-epsilon 1e-06 + --position-embedding-type rope + --rotary-base 1000000 + --vocab-size 262144 + --make-vocab-size-divisible-by 128 + --max-position-embeddings 262144 + --num-experts 128 + --moe-router-topk 8 + --moe-ffn-hidden-size 704 + --moe-router-score-function softmax + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-router-num-groups 1 + --moe-router-group-topk 1 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-bias-update-rate 0 + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/gemma-4-26B-A4B-it --ref-load /root/models/gemma-4-26B-A4B-it --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt index 17e9602c44..5da1b18f28 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_26b_a4b.py/train.txt @@ -13,10 +13,36 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-26b-a4b-it.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 16 + --num-query-groups 8 + --kv-channels 256 + --num-layers 30 + --hidden-size 2816 + --ffn-hidden-size 2112 + --normalization RMSNorm + --norm-epsilon 1e-06 + --position-embedding-type rope + --rotary-base 1000000 + --vocab-size 262144 + --make-vocab-size-divisible-by 128 + --max-position-embeddings 262144 + --num-experts 128 + --moe-router-topk 8 + --moe-ffn-hidden-size 704 + --moe-router-score-function softmax + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-router-num-groups 1 + --moe-router-group-topk 1 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-bias-update-rate 0 + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/gemma-4-26B-A4B-it --ref-load /root/models/gemma-4-26B-A4B-it --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt index e385bda2a6..b3e6844d75 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/full_train.txt @@ -25,10 +25,25 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-31b-it.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 32 + --num-query-groups 16 + --kv-channels 256 + --num-layers 60 + --hidden-size 5376 + --ffn-hidden-size 21504 + --normalization RMSNorm + --norm-epsilon 1e-06 + --position-embedding-type rope + --rotary-base 1000000 + --vocab-size 262144 + --make-vocab-size-divisible-by 128 + --max-position-embeddings 262144 --hf-checkpoint /root/models/gemma-4-31B-it --ref-load /root/models/gemma-4-31B-it --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt index 58f0d09dbc..66dfd88241 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_gemma_4_31b.py/train.txt @@ -13,10 +13,25 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/gemma-4-31b-it.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 32 + --num-query-groups 16 + --kv-channels 256 + --num-layers 60 + --hidden-size 5376 + --ffn-hidden-size 21504 + --normalization RMSNorm + --norm-epsilon 1e-06 + --position-embedding-type rope + --rotary-base 1000000 + --vocab-size 262144 + --make-vocab-size-divisible-by 128 + --max-position-embeddings 262144 --hf-checkpoint /root/models/gemma-4-31B-it --ref-load /root/models/gemma-4-31B-it --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt index 36dfe44709..cf459fe44e 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt @@ -21,12 +21,45 @@ hf download --local-dir /root/datasets/aime-2025 ### 5 -[multi_node num_nodes=None] source /scripts/models/glm4.5-355B-A32B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 4 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 96 + --num-query-groups 8 + --kv-channels 128 + --num-layers 92 + --hidden-size 5120 + --ffn-hidden-size 12288 + --add-qkv-bias + --normalization RMSNorm + --position-embedding-type rope + --rotary-percent 0.5 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151552 + --rotary-base 1000000 + --moe-ffn-hidden-size 1536 + --moe-shared-expert-intermediate-size 1536 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-router-topk-scaling-factor 2.5 + --moe-layer-freq [0]*3+[1]*89 + --num-experts 160 + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/GLM-4.5 --save /root/models/GLM-4.5_torch_dist @@ -53,10 +86,43 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 11 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm4.5-355B-A32B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 96 + --num-query-groups 8 + --kv-channels 128 + --num-layers 92 + --hidden-size 5120 + --ffn-hidden-size 12288 + --add-qkv-bias + --normalization RMSNorm + --position-embedding-type rope + --rotary-percent 0.5 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151552 + --rotary-base 1000000 + --moe-ffn-hidden-size 1536 + --moe-shared-expert-intermediate-size 1536 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-router-topk-scaling-factor 2.5 + --moe-layer-freq [0]*3+[1]*89 + --num-experts 160 + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/local_data/GLM-4.5 --ref-load /root/local_data/GLM-4.5_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt index 83666320ac..7782666556 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt @@ -13,10 +13,50 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm4.7-flash.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --moe-layer-freq [0]*1+[1]*46 + --num-experts 64 + --moe-shared-expert-intermediate-size 1536 + --moe-router-topk 4 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 1536 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 1.8 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 64 + --num-layers 47 + --hidden-size 2048 + --ffn-hidden-size 10240 + --num-attention-heads 20 + --disable-bias-linear + --add-qkv-bias + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --norm-epsilon 1e-5 + --qk-layernorm + --multi-latent-attention + --q-lora-rank 768 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --no-rope-fusion + --mtp-num-layers 1 --hf-checkpoint /root/models/GLM-4.7-Flash --ref-load /root/models/GLM-4.7-Flash_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt index db4971d4a9..cc01da0288 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt @@ -16,7 +16,47 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/glm4.7-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --moe-layer-freq [0]*1+[1]*46 + --num-experts 64 + --moe-shared-expert-intermediate-size 1536 + --moe-router-topk 4 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 1536 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 1.8 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 64 + --num-layers 47 + --hidden-size 2048 + --ffn-hidden-size 10240 + --num-attention-heads 20 + --disable-bias-linear + --add-qkv-bias + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --norm-epsilon 1e-5 + --qk-layernorm + --multi-latent-attention + --q-lora-rank 768 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --no-rope-fusion + --mtp-num-layers 1 --hf-checkpoint /root/models/GLM-4.7-Flash --save /root/models/GLM-4.7-Flash_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt index 95f8b536a2..3076db8edb 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt @@ -25,10 +25,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.1-744B-A40B_6layer_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*3 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 6 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.1-6layer --megatron-to-hf-mode bridge --dsa-attention-backend tilelang diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt index 7ed4f93fd0..7a1a1e2933 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt @@ -13,10 +13,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.1-744B-A40B_6layer_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*3 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 6 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.1-6layer --megatron-to-hf-mode bridge --dsa-attention-backend tilelang diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt index 808ad82115..914ecdaadb 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt @@ -11,12 +11,50 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[multi_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /models/GLM-5.2 --save /models/GLM-5.2_torch_dist --tensor-model-parallel-size 1 @@ -49,10 +87,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 9 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.2 --ref-load /root/models/GLM-5.2_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt index 47e978b1dc..eb959cfbc5 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt @@ -11,12 +11,50 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[multi_node num_nodes=None] source /scripts/models/glm5.2-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /models/GLM-5.2 --save /models/GLM-5.2_torch_dist --tensor-model-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt index b37f83ca52..d65c48f28a 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt @@ -13,10 +13,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.2 --ref-load /root/models/GLM-5.2_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt index 3f46dc356e..988ca39322 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt @@ -25,10 +25,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B_5layer_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*2 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 5 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.2_5layer --megatron-to-hf-mode bridge --dsa-attention-backend tilelang diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt index 1af8cd6a87..c85da53edd 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt @@ -13,10 +13,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5.2-744B-A40B_5layer_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*2 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 5 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 8000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5.2_5layer --megatron-to-hf-mode bridge --dsa-attention-backend tilelang diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt index 4aa1775d42..291ab823e7 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt @@ -11,12 +11,50 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[multi_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /models/GLM-5 --save /models/GLM-5_torch_dist --tensor-model-parallel-size 1 @@ -48,10 +86,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 9 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5-744B-A40B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5 --ref-load /root/models/GLM-5_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt index 869fca6eb6..04916b0b5a 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt @@ -11,12 +11,50 @@ hf download --local-dir /root/datasets/dapo-math-17k ### 3 -[multi_node num_nodes=None] source /scripts/models/glm5-744B-A40B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun +[multi_node num_nodes=None] PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 --master-addr {{master_addr}} --master-port 23456 --nnodes={{nnodes}} - --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} + --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /models/GLM-5 --save /models/GLM-5_torch_dist --tensor-model-parallel-size 1 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt index 00b09e03d6..ba368a85ba 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt @@ -13,10 +13,48 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/glm5-744B-A40B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.glm5.glm5 get_glm5_spec + --moe-layer-freq [0]*3+[1]*75 + --num-experts 256 + --moe-shared-expert-intermediate-size 2048 + --moe-router-topk 8 + --moe-grouped-gemm + --moe-permute-fusion + --moe-ffn-hidden-size 2048 + --moe-router-score-function sigmoid + --moe-router-pre-softmax + --moe-router-enable-expert-bias + --moe-router-bias-update-rate 0 + --moe-router-load-balancing-type seq_aux_loss + --moe-router-topk-scaling-factor 2.5 + --moe-aux-loss-coeff 0 + --moe-router-dtype fp32 + --make-vocab-size-divisible-by 16 + --num-layers 78 + --hidden-size 6144 + --ffn-hidden-size 12288 + --num-attention-heads 64 + --disable-bias-linear + --swiglu + --untie-embeddings-and-output-weights + --position-embedding-type rope + --no-position-embedding + --normalization RMSNorm + --qk-layernorm + --multi-latent-attention + --q-lora-rank 2048 + --kv-lora-rank 512 + --qk-head-dim 192 + --v-head-dim 256 + --kv-channels 192 + --qk-pos-emb-head-dim 64 + --vocab-size 154880 + --rotary-base 1000000 + --enable-experimental --hf-checkpoint /root/models/GLM-5 --ref-load /root/models/GLM-5_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt index adef4b4812..02f3f3bc73 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/full_train.txt @@ -13,10 +13,43 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/inkling.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1", "SGLANG_OPT_USE_INKLING_FUSED_AR_SCONV_NORM": "false", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "MILES_SGLANG_DUMMY_LOAD": "0", "SGLANG_SERVER_ENGINE_ROLLOUT_RETURN_LOGPROB": "1", "RAY_memory_monitor_refresh_ms": "0", "NCCL_MNNVL_ENABLE": "1", "NCCL_RAS_ENABLE": "0", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 4 + --hidden-size 6144 + --ffn-hidden-size 3072 + --num-attention-heads 64 + --group-query-attention + --num-query-groups 8 + --kv-channels 128 + --normalization RMSNorm + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 201024 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --attention-softmax-in-fp32 + --position-embedding-type none + --no-rope-fusion + --no-masked-softmax-fusion + --max-position-embeddings 1048576 + --num-experts 256 + --moe-ffn-hidden-size 3072 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 3072 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --qk-layernorm + --custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider --hf-checkpoint /root/models/Inkling-4layer --load /root/models/Inkling-4layer_torch_dist --model-name inkling diff --git a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt index adef4b4812..02f3f3bc73 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_inkling.py/train.txt @@ -13,10 +13,43 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/inkling.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_UNIFIED_RADIX_TREE": "1", "SGLANG_OPT_USE_INKLING_FUSED_AR_SCONV_NORM": "false", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "MILES_SGLANG_DUMMY_LOAD": "0", "SGLANG_SERVER_ENGINE_ROLLOUT_RETURN_LOGPROB": "1", "RAY_memory_monitor_refresh_ms": "0", "NCCL_MNNVL_ENABLE": "1", "NCCL_RAS_ENABLE": "0", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 4 + --hidden-size 6144 + --ffn-hidden-size 3072 + --num-attention-heads 64 + --group-query-attention + --num-query-groups 8 + --kv-channels 128 + --normalization RMSNorm + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 201024 + --hidden-dropout 0.0 + --attention-dropout 0.0 + --attention-softmax-in-fp32 + --position-embedding-type none + --no-rope-fusion + --no-masked-softmax-fusion + --max-position-embeddings 1048576 + --num-experts 256 + --moe-ffn-hidden-size 3072 + --moe-router-topk 6 + --moe-shared-expert-intermediate-size 3072 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-grouped-gemm + --qk-layernorm + --custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider --hf-checkpoint /root/models/Inkling-4layer --load /root/models/Inkling-4layer_torch_dist --model-name inkling diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt index 66bf8c6467..c4916847fd 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt @@ -13,10 +13,52 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/joyai-llm-flash.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 7168 + --num-attention-heads 32 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-base 32000000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 768 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 768 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 1 + --moe-router-num-groups 1 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/JoyAI-LLM-Flash/ --ref-load /root/models/JoyAI-LLM-Flash_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt index 306cf1e0ec..0d7f5fc082 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt @@ -16,7 +16,49 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/joyai-llm-flash.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 4 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 7168 + --num-attention-heads 32 + --kv-channels 128 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 129280 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-base 32000000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 256 + --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 768 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 768 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 1 + --moe-router-num-groups 1 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.5 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/JoyAI-LLM-Flash --save /root/models/JoyAI-LLM-Flash_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt index ff3ca5b01f..420a9dbba9 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt @@ -30,10 +30,53 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 7 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/kimi-k2-thinking.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "NCCL_TIMEOUT": "3600", "OPEN_TRAINING_INT4_FAKE_QAT_FLAG": "1", "OPEN_TRAINING_INT4_GROUP_SIZE": "32", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 64 + --kv-channels 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-5 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 163840 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 64.0 + --rotary-base 50000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 384 + --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 1 + --moe-router-num-groups 1 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.827 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/Kimi-K2.5 --ref-load /root/models/Kimi-K2.5-bf16 --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt index 19ad8247eb..a735595ce1 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt @@ -13,10 +13,53 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/kimi-k2-thinking.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "NCCL_TIMEOUT": "3600", "OPEN_TRAINING_INT4_FAKE_QAT_FLAG": "1", "OPEN_TRAINING_INT4_GROUP_SIZE": "32", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --num-layers 61 + --hidden-size 7168 + --ffn-hidden-size 18432 + --num-attention-heads 64 + --kv-channels 64 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-5 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 163840 + --multi-latent-attention + --q-lora-rank 1536 + --kv-lora-rank 512 + --qk-head-dim 128 + --qk-pos-emb-head-dim 64 + --v-head-dim 128 + --qk-layernorm + --rotary-scaling-factor 64.0 + --rotary-base 50000 + --mscale 1.0 + --mscale-all-dim 1.0 + --attention-softmax-in-fp32 + --no-rope-fusion + --num-experts 384 + --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-ffn-hidden-size 2048 + --moe-router-topk 8 + --moe-shared-expert-intermediate-size 2048 + --moe-router-pre-softmax + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-router-load-balancing-type seq_aux_loss + --moe-token-dispatcher-type alltoall + --moe-aux-loss-coeff 0 + --moe-router-bias-update-rate 0 + --moe-router-group-topk 1 + --moe-router-num-groups 1 + --moe-grouped-gemm + --moe-router-topk-scaling-factor 2.827 + --moe-router-dtype fp32 + --moe-permute-fusion --hf-checkpoint /root/models/Kimi-K2.5 --ref-load /root/models/Kimi-K2.5-bf16 --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt index bb68d87dba..9073cac478 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/full_train.txt @@ -25,10 +25,39 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 64 + --num-query-groups 2 + --kv-channels 128 + --num-layers 4 + --hidden-size 8192 + --ffn-hidden-size 5120 + --normalization RMSNorm + --position-embedding-type none + --vocab-size 131072 + --make-vocab-size-divisible-by 128 + --untie-embeddings-and-output-weights + --num-experts 512 + --moe-router-topk 22 + --moe-ffn-hidden-size 5120 + --moe-shared-expert-intermediate-size 10240 + --moe-latent-size 2048 + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-router-num-groups 1 + --moe-router-group-topk 1 + --moe-router-topk-scaling-factor 5.0 + --moe-router-pre-softmax + --moe-router-load-balancing-type seq_aux_loss + --moe-router-bias-update-rate 0 + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer --ref-load /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt index 99d3f6320c..03f21ecefa 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_nemotron_3_ultra_550b_a55b.py/train.txt @@ -13,10 +13,39 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --group-query-attention + --num-attention-heads 64 + --num-query-groups 2 + --kv-channels 128 + --num-layers 4 + --hidden-size 8192 + --ffn-hidden-size 5120 + --normalization RMSNorm + --position-embedding-type none + --vocab-size 131072 + --make-vocab-size-divisible-by 128 + --untie-embeddings-and-output-weights + --num-experts 512 + --moe-router-topk 22 + --moe-ffn-hidden-size 5120 + --moe-shared-expert-intermediate-size 10240 + --moe-latent-size 2048 + --moe-router-score-function sigmoid + --moe-router-enable-expert-bias + --moe-grouped-gemm + --moe-router-dtype fp32 + --moe-router-num-groups 1 + --moe-router-group-topk 1 + --moe-router-topk-scaling-factor 5.0 + --moe-router-pre-softmax + --moe-router-load-balancing-type seq_aux_loss + --moe-router-bias-update-rate 0 + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer --ref-load /root/models/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16-4layer --megatron-to-hf-mode bridge diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt index ec94532cfd..6e61f1336b 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt @@ -13,10 +13,38 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 32 + --num-query-groups 4 + --kv-channels 128 + --num-layers 48 + --hidden-size 2048 + --ffn-hidden-size 6144 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 1.0 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151936 + --rotary-base 1000000 + --moe-ffn-hidden-size 768 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 128 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/Qwen3-30B-A3B/ --ref-load /root/models/Qwen3-30B-A3B_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt index 76254f6091..99783d0289 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt @@ -16,7 +16,35 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/qwen3-30B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 32 + --num-query-groups 4 + --kv-channels 128 + --num-layers 48 + --hidden-size 2048 + --ffn-hidden-size 6144 + --normalization RMSNorm + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 1.0 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 151936 + --rotary-base 1000000 + --moe-ffn-hidden-size 768 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 128 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 --hf-checkpoint /root/models/Qwen3-30B-A3B --save /root/models/Qwen3-30B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt index d7553165a4..fff44da0dc 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/execute.txt @@ -13,10 +13,25 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-4B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --swiglu + --num-layers 36 + --hidden-size 2560 + --ffn-hidden-size 9728 + --num-attention-heads 32 + --group-query-attention + --num-query-groups 8 + --use-rotary-position-embeddings + --disable-bias-linear + --normalization RMSNorm + --norm-epsilon 1e-6 + --rotary-base 1000000 + --vocab-size 151936 + --kv-channels 128 + --qk-layernorm --hf-checkpoint /root/models/Qwen3-4B --save /root/shared_data/260101-000000-000/checkpoints --save-interval 20 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt index e0a453fe6b..dc0278d878 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_4b.py/prepare.txt @@ -16,7 +16,22 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/qwen3-4B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --swiglu + --num-layers 36 + --hidden-size 2560 + --ffn-hidden-size 9728 + --num-attention-heads 32 + --group-query-attention + --num-query-groups 8 + --use-rotary-position-embeddings + --disable-bias-linear + --normalization RMSNorm + --norm-epsilon 1e-6 + --rotary-base 1000000 + --vocab-size 151936 + --kv-channels 128 + --qk-layernorm --hf-checkpoint /root/models/Qwen3-4B --save /root/models/Qwen3-4B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt index a72d043fea..7414680ef1 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt @@ -25,10 +25,44 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 6 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.5-35B-A3B --megatron-to-hf-mode bridge --lora-rank 16 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt index a4e7216fed..3607c0f02b 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt @@ -13,10 +13,44 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B_lora.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.5-35B-A3B --megatron-to-hf-mode bridge --lora-rank 16 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt index abc49ff53e..d4d384601f 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt @@ -13,10 +13,44 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.5-35B-A3B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_SPEC_V2": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.5-35B-A3B --ref-load /root/models/Qwen3.5-35B-A3B_torch_dist --load /root/shared_data/260101-000000-000/checkpoints diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt index 080f66d974..a218e41481 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt @@ -16,7 +16,41 @@ hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/qwen3.5-35B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.5-35B-A3B --save /root/models/Qwen3.5-35B-A3B_torch_dist diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt index c0d20eaf53..57ebd89049 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt @@ -13,10 +13,44 @@ export PYTHONUNBUFFERED=1 && ray start nvidia-smi topo -m 2>/dev/null | grep -o 'NV[0-9][0-9]*' | wc -l ### 3 -export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3.6-35B-A3B.sh" && ray job submit +export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_ENABLE_SPEC_V2": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' - -- python3 /train.py ${MODEL_ARGS[@]} + -- python3 /train.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.6-35B-A3B --ref-load /root/models/Qwen3.6-35B-A3B_torch_dist --prompt-data /root/datasets/dapo-math-17k/dapo-math-17k.jsonl diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt index 1699858b4f..1b4076f510 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt @@ -16,7 +16,41 @@ test -e /root/datasets/aime-2024 || hf download --local-dir /root/datasets/aime-2024 ### 4 -source /scripts/models/qwen3.6-35B-A3B.sh && PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun - --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py ${MODEL_ARGS[@]} +PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun + --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py + --spec miles_plugins.models.qwen3_5 get_qwen3_5_spec + --disable-bias-linear + --qk-layernorm + --group-query-attention + --num-attention-heads 16 + --num-query-groups 2 + --kv-channels 256 + --num-layers 40 + --hidden-size 2048 + --ffn-hidden-size 512 + --normalization RMSNorm + --apply-layernorm-1p + --position-embedding-type rope + --norm-epsilon 1e-6 + --rotary-percent 0.25 + --swiglu + --untie-embeddings-and-output-weights + --vocab-size 248320 + --rotary-base 10000000 + --moe-ffn-hidden-size 512 + --moe-shared-expert-intermediate-size 512 + --moe-router-score-function softmax + --moe-token-dispatcher-type alltoall + --moe-router-topk 8 + --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --num-experts 256 + --moe-grouped-gemm + --moe-token-drop-policy probs + --moe-router-dtype fp32 + --moe-permute-fusion + --moe-aux-loss-coeff 0 + --attention-output-gate + --moe-shared-expert-gate + --mtp-num-layers 1 --hf-checkpoint /root/models/Qwen3.6-35B-A3B --save /root/models/Qwen3.6-35B-A3B_torch_dist From c77d60aa1e3c71e74b5b9e454c1c7dae91233f11 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 16:25:26 +0800 Subject: [PATCH 16/18] Replace the model config shell scripts with python Squashed from: - Replace the model config shell scripts with python - Point the run_megatron CLI tests at the model args loader - Preserve the rotary base override in the 16-node profile launcher - Convert the shell model configs to python and load them through one CLI - Apply pre-commit formatting - Keep the environment overrides and the failure path the sourced scripts had - Point the NPU docker patch at the python model definitions - Read each model's environment override where the shell script read it - Match the shell mask when the model is shorter than its dense prefix - Require keyword arguments for the moe layer frequency - Take the model args overrides from the environment the shell already used - Run the model args loader itself instead of a script that only forwards to it - Let the model scripts be plain lists and read their environment at call time - Group the model args utilities by what calls them - Regenerate the shell launcher snapshots for the model args entry point - Expect the TypeError an unknown model args keyword now raises - Drop the override argument the restored environment reading made redundant - Let a model script declare its arguments as one block of text - Concatenate the model argument lines instead of parsing them - Fix the callers that still joined the model args, and pin the contract - Repair the two paths the model args conversion left behind - Treat an explicit zero override as a value, not as a missing argument - Let a model script reach the loader without importing the miles package - Take the golden model args from the python loader instead of the shell - Record the model args lookup in the two concurrent launchers' snapshots - Point the p2p launcher at the loader and let it fail loudly - Regenerate the self-executing launcher snapshots for the python model args --- docker/npu_patch/miles.patch | 11 +- docs/advanced/on-policy-distillation.md | 3 +- docs/examples/openhermes-sft.md | 3 +- docs/examples/reproducibility.md | 3 +- docs/examples/search-r1.md | 3 +- docs/getting-started/quick-start.md | 3 +- docs/models/deepseek/deepseek-v4-flash.md | 3 +- docs/models/deepseek/deepseek.md | 3 +- docs/models/glm/glm4-5.md | 3 +- docs/models/glm/glm4-7-flash.md | 3 +- docs/models/glm/glm4.md | 3 +- docs/models/kimi/kimi-k2.5.md | 4 +- docs/models/kimi/kimi-k2.md | 3 +- docs/models/kimi/moonlight.md | 3 +- docs/models/mimo/mimo.md | 3 +- docs/models/nemotron/nemotron-3-nano-moe.md | 2 +- docs/models/nemotron/nemotron-3-nano.md | 2 +- docs/models/qwen/qwen3-5-moe.md | 5 +- docs/models/qwen/qwen3-5.md | 5 +- docs/models/qwen/qwen3-6-moe.md | 5 +- docs/models/qwen/qwen3-6.md | 5 +- docs/models/qwen/qwen3-moe.md | 3 +- docs/models/qwen/qwen3-next.md | 3 +- docs/models/qwen/qwen3.md | 7 +- docs/models/thinkingmachines/inkling-small.md | 2 +- docs/models/thinkingmachines/inkling.md | 5 +- docs/platforms/amd.md | 3 +- docs/user-guide/argument-groups.md | 4 +- .../user-guide/training-script-walkthrough.md | 12 +- docs/user-guide/usage.md | 3 +- .../experimental/eval/nemo_skills/README.md | 3 +- .../eval/scripts/run-qwen3-32B.sh | 3 +- .../experimental/eval/scripts/run-qwen3-4B.sh | 3 +- .../eval_multi_task/multi_task.sh | 3 +- .../formal_math/single_round/run_minimal.py | 5 +- .../run-qwen3-30B-A3B-multi-agent.sh | 4 +- .../experimental/reproducibility/README.md | 3 +- .../reproducibility/run-qwen2.5-0.5B-gsm8k.sh | 3 +- examples/experimental/search-r1/README.md | 8 +- .../experimental/search-r1/run_qwen2.5_3B.sh | 3 +- .../experimental/strands_sglang/README.md | 5 +- .../strands_sglang/strands_qwen3_8b.sh | 4 +- examples/experimental/tau-bench/README.md | 3 +- .../experimental/tau-bench/run_qwen3_4B.sh | 3 +- .../fully_async/run-qwen3-4b-fully_async.sh | 4 +- examples/geo3k_vlm/run_geo3k_vlm.sh | 3 +- examples/geo3k_vlm/run_geo3k_vlm_sft.sh | 3 +- .../run-kimi-k2-Thinking-int4.sh | 4 +- .../run-moonlight-16B-A3B-int4.sh | 4 +- .../low_precision/run-qwen3-235B-A22B-int4.sh | 4 +- .../low_precision/run-qwen3-30B-A3B-int4.sh | 4 +- .../run-qwen3-30b-a3b-fp8-two-nodes.sh | 3 +- .../low_precision/run-qwen3-4b-fp8.sh | 3 +- .../run-glm4.5-air-8node-profile.sh | 4 +- .../run-glm4.7-flash-2node-profile.sh | 4 +- .../run-glm5-disagg-profile.sh | 4 +- .../run-kimi-k2-64node-profile.sh | 5 +- .../run-qwen3-235B-A22B-16node-profile.sh | 5 +- .../run-qwen3-30B-A3B-4node-profile.sh | 4 +- .../infra_features/p2p_weight_transfer/run.py | 8 +- .../run-qwen3-4b-mis.sh | 3 +- examples/lora/dev.sh | 4 +- .../lora/run-gpt-oss-20B-megatron-moe-lora.sh | 4 +- examples/lora/run-kimi-k25-megatron-lora.sh | 4 +- .../lora/run-qwen2.5-0.5B-megatron-lora.sh | 4 +- ...-megatron-lora-disaggregated-multi-node.sh | 4 +- ...-qwen2.5-3B-megatron-lora-disaggregated.sh | 4 +- examples/lora/run-qwen3-4B-megatron-lora.sh | 3 +- .../lora/run-qwen3-4b-megatron-lora-result.sh | 4 +- .../run-qwen3-8B-opd-megatron.sh | 5 +- .../run-qwen3-8B-opd-multi-teacher.sh | 3 +- .../run-qwen3-8B-opd.sh | 5 +- .../run_megatron/cli/commands/args.py | 2 +- .../run_megatron/cli/commands/run.py | 14 +- .../run_megatron/cli/path_utils.py | 2 +- .../run_megatron/cli/worker_executor.py | 6 +- miles/utils/external_utils/command_utils.py | 18 +- .../utils/external_utils/model_args_utils.py | 59 +++ scripts/amd/run-qwen3-4B-amd.sh | 4 +- scripts/models/deepseek-v3-20layer.py | 5 + scripts/models/deepseek-v3-20layer.sh | 1 - scripts/models/deepseek-v3-5layer.py | 5 + scripts/models/deepseek-v3-5layer.sh | 1 - scripts/models/deepseek-v3.py | 56 ++ scripts/models/deepseek-v3.sh | 63 --- scripts/models/deepseek-v32-5layer.py | 5 + scripts/models/deepseek-v32-5layer.sh | 1 - scripts/models/deepseek-v32.py | 58 +++ scripts/models/deepseek-v32.sh | 62 --- scripts/models/deepseek-v4-flash-4layer.py | 5 + scripts/models/deepseek-v4-flash-4layer.sh | 3 - scripts/models/deepseek-v4-flash.py | 77 +++ scripts/models/deepseek-v4-flash.sh | 85 --- scripts/models/deepseek-v4-pro.py | 77 +++ scripts/models/deepseek-v4-pro.sh | 85 --- scripts/models/gemma-4-26b-a4b-it.py | 30 ++ scripts/models/gemma-4-26b-a4b-it.sh | 32 -- scripts/models/gemma-4-31b-it.py | 19 + scripts/models/gemma-4-31b-it.sh | 20 - scripts/models/glm4-32B.py | 25 + scripts/models/glm4-32B.sh | 24 - scripts/models/glm4-9B.py | 24 + scripts/models/glm4-9B.sh | 23 - scripts/models/glm4.5-106B-A12B.py | 39 ++ scripts/models/glm4.5-106B-A12B.sh | 40 -- scripts/models/glm4.5-355B-A32B.py | 41 ++ scripts/models/glm4.5-355B-A32B.sh | 43 -- scripts/models/glm4.7-flash.py | 55 ++ scripts/models/glm4.7-flash.sh | 54 -- scripts/models/glm5-744B-A40B.py | 52 ++ scripts/models/glm5-744B-A40B.sh | 52 -- scripts/models/glm5-744B-A40B_20layer.py | 6 + scripts/models/glm5-744B-A40B_20layer.sh | 12 - scripts/models/glm5-744B-A40B_4layer.py | 6 + scripts/models/glm5-744B-A40B_4layer.sh | 12 - scripts/models/glm5.1-744B-A40B_6layer.py | 7 + scripts/models/glm5.1-744B-A40B_6layer.sh | 14 - .../models/glm5.1-744B-A40B_6layer_lora.py | 7 + .../models/glm5.1-744B-A40B_6layer_lora.sh | 13 - scripts/models/glm5.1-744B-A40B_lora.py | 52 ++ scripts/models/glm5.1-744B-A40B_lora.sh | 58 --- scripts/models/glm5.2-744B-A40B.py | 52 ++ scripts/models/glm5.2-744B-A40B.sh | 59 --- scripts/models/glm5.2-744B-A40B_5layer.py | 8 + scripts/models/glm5.2-744B-A40B_5layer.sh | 14 - .../models/glm5.2-744B-A40B_5layer_lora.py | 7 + .../models/glm5.2-744B-A40B_5layer_lora.sh | 13 - scripts/models/glm5.2-744B-A40B_lora.py | 52 ++ scripts/models/glm5.2-744B-A40B_lora.sh | 58 --- scripts/models/gpt-oss-20b.py | 40 ++ scripts/models/gpt-oss-20b.sh | 48 -- scripts/models/inkling-small.py | 44 ++ scripts/models/inkling-small.sh | 43 -- scripts/models/inkling.py | 43 ++ scripts/models/inkling.sh | 42 -- scripts/models/joyai-llm-flash.py | 55 ++ scripts/models/joyai-llm-flash.sh | 60 --- scripts/models/kimi-k2-thinking.py | 50 ++ scripts/models/kimi-k2-thinking.sh | 63 --- scripts/models/kimi-k2.py | 54 ++ scripts/models/kimi-k2.sh | 63 --- scripts/models/kimi-k25_2layer.py | 9 + scripts/models/kimi-k25_2layer.sh | 26 - scripts/models/llama3.1-8B-Instruct.py | 21 + scripts/models/llama3.1-8B-Instruct.sh | 20 - scripts/models/llama3.2-3B-Instruct-amd.py | 20 + scripts/models/llama3.2-3B-Instruct-amd.sh | 19 - scripts/models/llama3.2-3B-Instruct.py | 20 + scripts/models/llama3.2-3B-Instruct.sh | 19 - scripts/models/mimo-7B-rl.py | 20 + scripts/models/mimo-7B-rl.sh | 19 - scripts/models/moonlight.py | 60 +++ scripts/models/moonlight.sh | 69 --- scripts/models/nemotron-3-nano-30b-a3b.py | 36 ++ scripts/models/nemotron-3-nano-30b-a3b.sh | 47 -- scripts/models/nemotron-3-nano-4b.py | 16 + scripts/models/nemotron-3-nano-4b.sh | 24 - scripts/models/nemotron-3-super-120b-a12b.py | 42 ++ scripts/models/nemotron-3-super-120b-a12b.sh | 54 -- .../nemotron-3-ultra-550b-a55b-4layer.py | 48 ++ .../nemotron-3-ultra-550b-a55b-4layer.sh | 47 -- scripts/models/nemotron-3-ultra-550b-a55b.py | 52 ++ scripts/models/nemotron-3-ultra-550b-a55b.sh | 51 -- scripts/models/qwen2.5-0.5B.py | 17 + scripts/models/qwen2.5-0.5B.sh | 16 - scripts/models/qwen2.5-1.5B.py | 17 + scripts/models/qwen2.5-1.5B.sh | 16 - scripts/models/qwen2.5-32B.py | 18 + scripts/models/qwen2.5-32B.sh | 17 - scripts/models/qwen2.5-3B.py | 17 + scripts/models/qwen2.5-3B.sh | 16 - scripts/models/qwen2.5-7B.py | 18 + scripts/models/qwen2.5-7B.sh | 17 - scripts/models/qwen3-0.6B.py | 18 + scripts/models/qwen3-0.6B.sh | 17 - scripts/models/qwen3-1.7B.py | 22 + scripts/models/qwen3-1.7B.sh | 17 - scripts/models/qwen3-14B.py | 19 + scripts/models/qwen3-14B.sh | 18 - scripts/models/qwen3-235B-A22B.py | 42 ++ scripts/models/qwen3-235B-A22B.sh | 49 -- scripts/models/qwen3-30B-A3B-5layer.py | 5 + scripts/models/qwen3-30B-A3B-5layer.sh | 1 - scripts/models/qwen3-30B-A3B.py | 42 ++ scripts/models/qwen3-30B-A3B.sh | 49 -- scripts/models/qwen3-32B.py | 19 + scripts/models/qwen3-32B.sh | 18 - scripts/models/qwen3-4B-Instruct-2507.py | 5 + scripts/models/qwen3-4B-Instruct-2507.sh | 1 - scripts/models/qwen3-4B.py | 22 + scripts/models/qwen3-4B.sh | 17 - scripts/models/qwen3-8B.py | 23 + scripts/models/qwen3-8B.sh | 18 - scripts/models/qwen3-next-80B-A3B.py | 46 ++ scripts/models/qwen3-next-80B-A3B.sh | 58 --- scripts/models/qwen3.5-27B.py | 24 + scripts/models/qwen3.5-27B.sh | 27 - scripts/models/qwen3.5-35B-A3B.py | 46 ++ scripts/models/qwen3.5-35B-A3B.sh | 58 --- scripts/models/qwen3.5-35B-A3B_lora.py | 46 ++ scripts/models/qwen3.5-35B-A3B_lora.sh | 62 --- scripts/models/qwen3.5-4B.py | 23 + scripts/models/qwen3.5-4B.sh | 26 - scripts/models/qwen3.5-9B.py | 24 + scripts/models/qwen3.5-9B.sh | 27 - scripts/models/qwen3.6-27B.py | 24 + scripts/models/qwen3.6-27B.sh | 27 - scripts/models/qwen3.6-35B-A3B.py | 46 ++ scripts/models/qwen3.6-35B-A3B.sh | 58 --- scripts/models/qwen3.6-35B-A3B_lora.py | 46 ++ scripts/models/qwen3.6-35B-A3B_lora.sh | 62 --- scripts/run-deepseek-r1.sh | 4 +- scripts/run-glm4-9B-4xgpu-radixtree.sh | 4 +- scripts/run-glm4-9B.sh | 4 +- scripts/run-glm4.5-355B-A32B.sh | 4 +- scripts/run-glm4.7-flash.sh | 4 +- scripts/run-gpt-oss-20b-bf16.sh | 4 +- scripts/run-kimi-k2-Instruct.sh | 4 +- scripts/run-kimi-k2-Thinking.sh | 4 +- scripts/run-kimi-k25.sh | 4 +- scripts/run-mimo-7B-rl-eagle.sh | 4 +- scripts/run-moonlight-16B-A3B.sh | 4 +- scripts/run-nemotron-3-nano-30b-a3b.sh | 4 +- scripts/run-nemotron-3-nano-4b.sh | 4 +- scripts/run-nemotron-3-super-120b-a12b.sh | 4 +- scripts/run-qwen3-235B-A22B-sft.sh | 4 +- scripts/run-qwen3-235B-A22B.sh | 4 +- scripts/run-qwen3-32B.sh | 4 +- scripts/run-qwen3-4B-base-sft.sh | 4 +- scripts/run-qwen3-4B.sh | 4 +- scripts/run-qwen3-4B_4xgpu.sh | 4 +- scripts/run-qwen3-next-80B-A3B-8gpus.sh | 4 +- scripts/run-qwen3-next-80B-A3B.sh | 4 +- scripts/run-qwen3.5-27B.sh | 4 +- scripts/run-qwen3.5-35B-A3B-mtp.sh | 4 +- scripts/run-qwen3.5-4B.sh | 4 +- scripts/run-qwen3.5-9B.sh | 4 +- scripts/run-qwen3.6-27B.sh | 4 +- scripts/run_gemma_4_26b_a4b.py | 2 +- scripts/run_gemma_4_31b.py | 2 +- scripts/run_inkling.py | 2 +- scripts/run_kimi_k25.py | 2 +- .../e2e/sglang/test_r3_router_equivalence.py | 2 +- .../fast/launch_scripts/model_args_harness.py | 27 +- tests/fast/launch_scripts/py_harness.py | 13 +- tests/fast/launch_scripts/sh_harness.py | 1 + tests/fast/launch_scripts/test_sh_harness.py | 2 +- .../test_shell_script_hygiene.py | 24 + .../run_megatron/cli/commands/test_run.py | 6 +- .../run_megatron/cli/test_path_utils.py | 2 +- .../run_megatron/cli/test_worker_executor.py | 26 +- .../external_utils/test_model_args_utils.py | 233 +++++++++ .../single_round/run_minimal.py/import.txt | 20 +- .../run.py/run/GLM-4.5-Air/broadcast.txt | 2 +- .../run.py/run/GLM-4.5-Air/p2p.txt | 2 +- .../run.py/run/GLM-4.7-Flash/broadcast.txt | 2 +- .../run.py/run/GLM-4.7-Flash/p2p.txt | 2 +- .../run.py/run/GLM-5/broadcast.txt | 2 +- .../run.py/run/GLM-5/p2p.txt | 2 +- .../run.py/run/GLM-5_20layer/broadcast.txt | 2 +- .../run.py/run/GLM-5_20layer/p2p.txt | 2 +- .../run.py/run/GLM-5_4layer/broadcast.txt | 2 +- .../run.py/run/GLM-5_4layer/p2p.txt | 2 +- .../run.py/run/GLM-Z1-9B-0414/broadcast.txt | 2 +- .../run.py/run/GLM-Z1-9B-0414/p2p.txt | 2 +- .../run.py/run/Kimi-K2-Instruct/broadcast.txt | 2 +- .../run.py/run/Kimi-K2-Instruct/p2p.txt | 2 +- .../Moonlight-16B-A3B-Instruct/broadcast.txt | 2 +- .../run/Moonlight-16B-A3B-Instruct/p2p.txt | 2 +- .../broadcast.txt | 2 +- .../run/Qwen3-235B-A22B-Instruct-2507/p2p.txt | 2 +- .../run.py/run/Qwen3-30B-A3B/broadcast.txt | 2 +- .../run.py/run/Qwen3-30B-A3B/p2p.txt | 2 +- .../run.py/run/Qwen3-4B/broadcast.txt | 2 +- .../run.py/run/Qwen3-4B/p2p.txt | 2 +- .../eval/scripts/run-qwen3-32B.sh.txt | 7 +- .../eval/scripts/run-qwen3-4B.sh.txt | 7 +- .../eval_multi_task/multi_task.sh.txt | 7 +- .../run-qwen3-30B-A3B-multi-agent.sh.txt | 7 +- .../run-qwen2.5-0.5B-gsm8k.sh.txt | 7 +- .../search-r1/run_qwen2.5_3B.sh.txt | 7 +- .../strands_sglang/strands_qwen3_8b.sh.txt | 9 +- .../tau-bench/run_qwen3_4B.sh.txt | 7 +- .../run-qwen3-4b-fully_async.sh.txt | 7 +- .../examples/geo3k_vlm/run_geo3k_vlm.sh.txt | 7 +- .../geo3k_vlm/run_geo3k_vlm_sft.sh.txt | 7 +- .../run-kimi-k2-Thinking-int4.sh.txt | 5 + .../run-moonlight-16B-A3B-int4.sh.txt | 7 +- .../run-qwen3-235B-A22B-int4.sh.txt | 5 + .../run-qwen3-30B-A3B-int4.sh.txt | 7 +- .../run-qwen3-30b-a3b-fp8-two-nodes.sh.txt | 9 +- .../low_precision/run-qwen3-4b-fp8.sh.txt | 7 +- .../run-glm4.5-air-8node-profile.sh.txt | 15 +- .../run-glm4.7-flash-2node-profile.sh.txt | 9 +- .../run-glm5-disagg-profile.sh.txt | 13 +- .../run-kimi-k2-64node-profile.sh.txt | 9 +- .../run-qwen3-235B-A22B-16node-profile.sh.txt | 11 +- .../run-qwen3-30B-A3B-4node-profile.sh.txt | 9 +- .../run-qwen3-4b-mis.sh.txt | 7 +- .../sh/examples/lora/dev.sh.txt | 7 +- .../run-gpt-oss-20B-megatron-moe-lora.sh.txt | 7 +- .../lora/run-kimi-k25-megatron-lora.sh.txt | 5 + .../run-qwen2.5-0.5B-megatron-lora.sh.txt | 7 +- ...atron-lora-disaggregated-multi-node.sh.txt | 9 +- ...n2.5-3B-megatron-lora-disaggregated.sh.txt | 7 +- .../lora/run-qwen3-4B-megatron-lora.sh.txt | 7 +- .../run-qwen3-4b-megatron-lora-result.sh.txt | 7 +- .../run-qwen3-8B-opd-megatron.sh.txt | 23 +- .../run-qwen3-8B-opd-multi-teacher.sh.txt | 23 +- .../run-qwen3-8B-opd.sh.txt | 23 +- .../sh/scripts/amd/run-qwen3-4B-amd.sh.txt | 7 +- .../sh/scripts/run-deepseek-r1.sh.txt | 7 +- .../run-glm4-9B-4xgpu-radixtree.sh.txt | 7 +- .../sh/scripts/run-glm4-9B.sh.txt | 7 +- .../sh/scripts/run-glm4.5-355B-A32B.sh.txt | 9 +- .../sh/scripts/run-glm4.7-flash.sh.txt | 7 +- .../sh/scripts/run-gpt-oss-20b-bf16.sh.txt | 7 +- .../sh/scripts/run-kimi-k2-Instruct.sh.txt | 5 + .../sh/scripts/run-kimi-k2-Thinking.sh.txt | 5 + .../sh/scripts/run-kimi-k25.sh.txt | 5 + .../sh/scripts/run-mimo-7B-rl-eagle.sh.txt | 7 +- .../sh/scripts/run-moonlight-16B-A3B.sh.txt | 7 +- .../run-nemotron-3-nano-30b-a3b.sh.txt | 7 +- .../sh/scripts/run-nemotron-3-nano-4b.sh.txt | 7 +- .../run-nemotron-3-super-120b-a12b.sh.txt | 489 +++++++++--------- .../sh/scripts/run-qwen3-235B-A22B-sft.sh.txt | 9 +- .../sh/scripts/run-qwen3-235B-A22B.sh.txt | 9 +- .../sh/scripts/run-qwen3-32B.sh.txt | 7 +- .../sh/scripts/run-qwen3-4B-base-sft.sh.txt | 7 +- .../sh/scripts/run-qwen3-4B.sh.txt | 7 +- .../sh/scripts/run-qwen3-4B_4xgpu.sh.txt | 7 +- .../run-qwen3-next-80B-A3B-8gpus.sh.txt | 9 +- .../sh/scripts/run-qwen3-next-80B-A3B.sh.txt | 9 +- .../sh/scripts/run-qwen3.5-27B.sh.txt | 7 +- .../sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt | 7 +- .../sh/scripts/run-qwen3.5-4B.sh.txt | 7 +- .../sh/scripts/run-qwen3.5-9B.sh.txt | 7 +- .../sh/scripts/run-qwen3.6-27B.sh.txt | 7 +- 338 files changed, 3302 insertions(+), 2881 deletions(-) create mode 100644 miles/utils/external_utils/model_args_utils.py create mode 100644 scripts/models/deepseek-v3-20layer.py delete mode 100644 scripts/models/deepseek-v3-20layer.sh create mode 100644 scripts/models/deepseek-v3-5layer.py delete mode 100644 scripts/models/deepseek-v3-5layer.sh create mode 100644 scripts/models/deepseek-v3.py delete mode 100644 scripts/models/deepseek-v3.sh create mode 100644 scripts/models/deepseek-v32-5layer.py delete mode 100644 scripts/models/deepseek-v32-5layer.sh create mode 100644 scripts/models/deepseek-v32.py delete mode 100644 scripts/models/deepseek-v32.sh create mode 100644 scripts/models/deepseek-v4-flash-4layer.py delete mode 100644 scripts/models/deepseek-v4-flash-4layer.sh create mode 100644 scripts/models/deepseek-v4-flash.py delete mode 100644 scripts/models/deepseek-v4-flash.sh create mode 100644 scripts/models/deepseek-v4-pro.py delete mode 100644 scripts/models/deepseek-v4-pro.sh create mode 100644 scripts/models/gemma-4-26b-a4b-it.py delete mode 100644 scripts/models/gemma-4-26b-a4b-it.sh create mode 100644 scripts/models/gemma-4-31b-it.py delete mode 100644 scripts/models/gemma-4-31b-it.sh create mode 100644 scripts/models/glm4-32B.py delete mode 100644 scripts/models/glm4-32B.sh create mode 100644 scripts/models/glm4-9B.py delete mode 100644 scripts/models/glm4-9B.sh create mode 100644 scripts/models/glm4.5-106B-A12B.py delete mode 100644 scripts/models/glm4.5-106B-A12B.sh create mode 100644 scripts/models/glm4.5-355B-A32B.py delete mode 100644 scripts/models/glm4.5-355B-A32B.sh create mode 100644 scripts/models/glm4.7-flash.py delete mode 100644 scripts/models/glm4.7-flash.sh create mode 100644 scripts/models/glm5-744B-A40B.py delete mode 100644 scripts/models/glm5-744B-A40B.sh create mode 100644 scripts/models/glm5-744B-A40B_20layer.py delete mode 100644 scripts/models/glm5-744B-A40B_20layer.sh create mode 100644 scripts/models/glm5-744B-A40B_4layer.py delete mode 100644 scripts/models/glm5-744B-A40B_4layer.sh create mode 100644 scripts/models/glm5.1-744B-A40B_6layer.py delete mode 100644 scripts/models/glm5.1-744B-A40B_6layer.sh create mode 100644 scripts/models/glm5.1-744B-A40B_6layer_lora.py delete mode 100644 scripts/models/glm5.1-744B-A40B_6layer_lora.sh create mode 100644 scripts/models/glm5.1-744B-A40B_lora.py delete mode 100644 scripts/models/glm5.1-744B-A40B_lora.sh create mode 100644 scripts/models/glm5.2-744B-A40B.py delete mode 100644 scripts/models/glm5.2-744B-A40B.sh create mode 100644 scripts/models/glm5.2-744B-A40B_5layer.py delete mode 100644 scripts/models/glm5.2-744B-A40B_5layer.sh create mode 100644 scripts/models/glm5.2-744B-A40B_5layer_lora.py delete mode 100644 scripts/models/glm5.2-744B-A40B_5layer_lora.sh create mode 100644 scripts/models/glm5.2-744B-A40B_lora.py delete mode 100644 scripts/models/glm5.2-744B-A40B_lora.sh create mode 100644 scripts/models/gpt-oss-20b.py delete mode 100644 scripts/models/gpt-oss-20b.sh create mode 100644 scripts/models/inkling-small.py delete mode 100644 scripts/models/inkling-small.sh create mode 100644 scripts/models/inkling.py delete mode 100644 scripts/models/inkling.sh create mode 100644 scripts/models/joyai-llm-flash.py delete mode 100644 scripts/models/joyai-llm-flash.sh create mode 100644 scripts/models/kimi-k2-thinking.py delete mode 100644 scripts/models/kimi-k2-thinking.sh create mode 100644 scripts/models/kimi-k2.py delete mode 100644 scripts/models/kimi-k2.sh create mode 100644 scripts/models/kimi-k25_2layer.py delete mode 100644 scripts/models/kimi-k25_2layer.sh create mode 100644 scripts/models/llama3.1-8B-Instruct.py delete mode 100644 scripts/models/llama3.1-8B-Instruct.sh create mode 100644 scripts/models/llama3.2-3B-Instruct-amd.py delete mode 100644 scripts/models/llama3.2-3B-Instruct-amd.sh create mode 100644 scripts/models/llama3.2-3B-Instruct.py delete mode 100644 scripts/models/llama3.2-3B-Instruct.sh create mode 100644 scripts/models/mimo-7B-rl.py delete mode 100644 scripts/models/mimo-7B-rl.sh create mode 100644 scripts/models/moonlight.py delete mode 100644 scripts/models/moonlight.sh create mode 100644 scripts/models/nemotron-3-nano-30b-a3b.py delete mode 100644 scripts/models/nemotron-3-nano-30b-a3b.sh create mode 100644 scripts/models/nemotron-3-nano-4b.py delete mode 100644 scripts/models/nemotron-3-nano-4b.sh create mode 100644 scripts/models/nemotron-3-super-120b-a12b.py delete mode 100644 scripts/models/nemotron-3-super-120b-a12b.sh create mode 100644 scripts/models/nemotron-3-ultra-550b-a55b-4layer.py delete mode 100644 scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh create mode 100644 scripts/models/nemotron-3-ultra-550b-a55b.py delete mode 100644 scripts/models/nemotron-3-ultra-550b-a55b.sh create mode 100644 scripts/models/qwen2.5-0.5B.py delete mode 100644 scripts/models/qwen2.5-0.5B.sh create mode 100644 scripts/models/qwen2.5-1.5B.py delete mode 100644 scripts/models/qwen2.5-1.5B.sh create mode 100644 scripts/models/qwen2.5-32B.py delete mode 100644 scripts/models/qwen2.5-32B.sh create mode 100644 scripts/models/qwen2.5-3B.py delete mode 100644 scripts/models/qwen2.5-3B.sh create mode 100644 scripts/models/qwen2.5-7B.py delete mode 100644 scripts/models/qwen2.5-7B.sh create mode 100644 scripts/models/qwen3-0.6B.py delete mode 100644 scripts/models/qwen3-0.6B.sh create mode 100644 scripts/models/qwen3-1.7B.py delete mode 100644 scripts/models/qwen3-1.7B.sh create mode 100644 scripts/models/qwen3-14B.py delete mode 100644 scripts/models/qwen3-14B.sh create mode 100644 scripts/models/qwen3-235B-A22B.py delete mode 100644 scripts/models/qwen3-235B-A22B.sh create mode 100644 scripts/models/qwen3-30B-A3B-5layer.py delete mode 100644 scripts/models/qwen3-30B-A3B-5layer.sh create mode 100644 scripts/models/qwen3-30B-A3B.py delete mode 100644 scripts/models/qwen3-30B-A3B.sh create mode 100644 scripts/models/qwen3-32B.py delete mode 100644 scripts/models/qwen3-32B.sh create mode 100644 scripts/models/qwen3-4B-Instruct-2507.py delete mode 100644 scripts/models/qwen3-4B-Instruct-2507.sh create mode 100644 scripts/models/qwen3-4B.py delete mode 100644 scripts/models/qwen3-4B.sh create mode 100644 scripts/models/qwen3-8B.py delete mode 100644 scripts/models/qwen3-8B.sh create mode 100644 scripts/models/qwen3-next-80B-A3B.py delete mode 100644 scripts/models/qwen3-next-80B-A3B.sh create mode 100644 scripts/models/qwen3.5-27B.py delete mode 100644 scripts/models/qwen3.5-27B.sh create mode 100644 scripts/models/qwen3.5-35B-A3B.py delete mode 100644 scripts/models/qwen3.5-35B-A3B.sh create mode 100644 scripts/models/qwen3.5-35B-A3B_lora.py delete mode 100644 scripts/models/qwen3.5-35B-A3B_lora.sh create mode 100644 scripts/models/qwen3.5-4B.py delete mode 100644 scripts/models/qwen3.5-4B.sh create mode 100644 scripts/models/qwen3.5-9B.py delete mode 100644 scripts/models/qwen3.5-9B.sh create mode 100644 scripts/models/qwen3.6-27B.py delete mode 100644 scripts/models/qwen3.6-27B.sh create mode 100644 scripts/models/qwen3.6-35B-A3B.py delete mode 100644 scripts/models/qwen3.6-35B-A3B.sh create mode 100644 scripts/models/qwen3.6-35B-A3B_lora.py delete mode 100644 scripts/models/qwen3.6-35B-A3B_lora.sh create mode 100644 tests/fast/utils/external_utils/test_model_args_utils.py diff --git a/docker/npu_patch/miles.patch b/docker/npu_patch/miles.patch index 9b9a02d61d..0708d4d671 100644 --- a/docker/npu_patch/miles.patch +++ b/docker/npu_patch/miles.patch @@ -340,7 +340,7 @@ diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_ index d016e01ac..08b4d6eff 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py -@@ -193,6 +193,112 @@ def execute_train( +@@ -193,6 +193,107 @@ def execute_train( ) @@ -434,18 +434,13 @@ index d016e01ac..08b4d6eff 100644 + ) + + if get_bool_env_var("SLIME_SCRIPT_ENABLE_RAY_SUBMIT", "1"): -+ cmd_megatron_model_source = ( -+ f'source "{repo_base_dir}/scripts/models/{megatron_model_type}.sh" && ' -+ if megatron_model_type is not None -+ else "" -+ ) ++ model_args = load_model_args(megatron_model_type) if megatron_model_type is not None else "" + exec_command_cpu( + f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " -+ f"{cmd_megatron_model_source}" + f'ray job submit --address="http://127.0.0.1:8265" ' + f"--runtime-env-json='{runtime_env_json}' " + f"-- python3 {train_script} " -+ f"{'${MODEL_ARGS[@]}' if megatron_model_type is not None else ''} " ++ f"{model_args} " + f"{train_args}" + ) + diff --git a/docs/advanced/on-policy-distillation.md b/docs/advanced/on-policy-distillation.md index 6723abb78a..9235c7316e 100644 --- a/docs/advanced/on-policy-distillation.md +++ b/docs/advanced/on-policy-distillation.md @@ -144,7 +144,8 @@ hf download --repo-type dataset zhuzilin/dapo-math-17k --local-dir /root/dapo-ma # 2. Convert student model cd /root/miles -source scripts/models/qwen3-8B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-8B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3-8B \ diff --git a/docs/examples/openhermes-sft.md b/docs/examples/openhermes-sft.md index c3893afaab..b5b7ca5bd5 100644 --- a/docs/examples/openhermes-sft.md +++ b/docs/examples/openhermes-sft.md @@ -27,7 +27,8 @@ If you don't already have it: hf download Qwen/Qwen3-4B-Base --local-dir /root/Qwen3-4B-Base cd /root/miles -source scripts/models/qwen3-4B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3-4B-Base \ diff --git a/docs/examples/reproducibility.md b/docs/examples/reproducibility.md index b87bd45baf..ad1ff17b35 100644 --- a/docs/examples/reproducibility.md +++ b/docs/examples/reproducibility.md @@ -70,7 +70,8 @@ hf download --repo-type dataset openai/gsm8k --local-dir /root/gsm8k hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir /root/Qwen2.5-0.5B-Instruct cd /root/miles -source scripts/models/qwen2.5-0.5B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen2.5-0.5B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen2.5-0.5B-Instruct \ diff --git a/docs/examples/search-r1.md b/docs/examples/search-r1.md index e77a9689e5..c66ea66472 100644 --- a/docs/examples/search-r1.md +++ b/docs/examples/search-r1.md @@ -56,7 +56,8 @@ python $WORK_DIR/scripts/data_process/qa_search_train_merge.py \ ```bash hf download Qwen/Qwen2.5-3B --local-dir /root/Qwen2.5-3B cd /root/miles -source scripts/models/qwen2.5-3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen2.5-3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen2.5-3B \ diff --git a/docs/getting-started/quick-start.md b/docs/getting-started/quick-start.md index 21228399a7..4207d4e98c 100644 --- a/docs/getting-started/quick-start.md +++ b/docs/getting-started/quick-start.md @@ -65,7 +65,8 @@ map the HuggingFace weights into a sharded `torch_dist` checkpoint. ```bash cd /root/miles -source scripts/models/qwen3-4B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/deepseek/deepseek-v4-flash.md b/docs/models/deepseek/deepseek-v4-flash.md index e927666dc2..c1160c94d9 100644 --- a/docs/models/deepseek/deepseek-v4-flash.md +++ b/docs/models/deepseek/deepseek-v4-flash.md @@ -88,7 +88,8 @@ python tools/fp8_cast_bf16.py \ --input-fp8-hf-path /root/models/DeepSeek-V4-Flash-FP8 \ --output-bf16-hf-path /root/models/DeepSeek-V4-Flash-FP8-bf16/ -source scripts/models/deepseek-v4-flash.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py deepseek-v4-flash)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun \ --nproc-per-node 4 --nnodes 8 \ --master-addr ${MASTER_ADDR} --master-port 12345 \ diff --git a/docs/models/deepseek/deepseek.md b/docs/models/deepseek/deepseek.md index ffc3d4cba9..da922a7b15 100644 --- a/docs/models/deepseek/deepseek.md +++ b/docs/models/deepseek/deepseek.md @@ -52,7 +52,8 @@ Then convert BF16 HF → Megatron `torch_dist`. Run on **4 separate nodes** (`NO ```bash cd miles/ -source scripts/models/deepseek-v3.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py deepseek-v3)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM/ torchrun \ --nproc-per-node 8 \ --master-addr ${MASTER_ADDR} --master-port 12345 \ diff --git a/docs/models/glm/glm4-5.md b/docs/models/glm/glm4-5.md index 7aeb249251..35a4e8d045 100644 --- a/docs/models/glm/glm4-5.md +++ b/docs/models/glm/glm4-5.md @@ -49,7 +49,8 @@ The bash launcher does **not** convert for you — produce `$BASE_DIR/GLM-4.5-35 ```bash cd /root/miles -source scripts/models/glm4.5-355B-A32B.sh +MODEL_ARGS_LINE="$(python3 scripts/model_args.py glm4.5-355B-A32B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/glm/glm4-7-flash.md b/docs/models/glm/glm4-7-flash.md index 07162c31fa..31b368b3f1 100644 --- a/docs/models/glm/glm4-7-flash.md +++ b/docs/models/glm/glm4-7-flash.md @@ -35,7 +35,8 @@ The bash launcher hardcodes `BASE_DIR=/root/shared`. The Python launcher downloa ```bash cd /root/miles -source scripts/models/glm4.7-flash.sh +MODEL_ARGS_LINE="$(python3 scripts/model_args.py glm4.7-flash)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/glm/glm4.md b/docs/models/glm/glm4.md index 688ba67ce8..04dcd74629 100644 --- a/docs/models/glm/glm4.md +++ b/docs/models/glm/glm4.md @@ -32,7 +32,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/glm4-9B.sh +MODEL_ARGS_LINE="$(python3 scripts/model_args.py glm4-9B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/GLM-Z1-9B-0414 \ diff --git a/docs/models/kimi/kimi-k2.5.md b/docs/models/kimi/kimi-k2.5.md index 5b766462c2..f4d924ff42 100644 --- a/docs/models/kimi/kimi-k2.5.md +++ b/docs/models/kimi/kimi-k2.5.md @@ -2,7 +2,7 @@ title: Kimi K2.5 / K2.6 description: Launch recipe for Kimi-K2.5, running full-parameter GRPO on 32 × 8 H200 with an INT4 actor and a BF16 reference. --- -The reference launcher is [`scripts/run-kimi-k25.sh`](https://github.com/radixark/miles/blob/main/scripts/run-kimi-k25.sh), which sources the shared model definition in `scripts/models/kimi-k2-thinking.sh`. +The reference launcher is [`scripts/run-kimi-k25.sh`](https://github.com/radixark/miles/blob/main/scripts/run-kimi-k25.sh), which loads the shared model definition from `scripts/models/kimi-k2-thinking.py`. ## 1. Model Introduction @@ -79,7 +79,7 @@ ray start --address=${MASTER_ADDR}:6379 --num-gpus 8 --node-ip-address ${WORKER_ ## 4. Script breakdown -The launcher groups its flags into the arrays that are passed to `train.py`. The model shape comes from `MODEL_ARGS`, which is sourced from `scripts/models/kimi-k2-thinking.sh`. That definition sets the MLA latent ranks (`q_lora_rank=1536`, `kv_lora_rank=512`, `qk_head_dim=128`, `qk_pos_emb_head_dim=64`, `v_head_dim=128`), the MoE routing (384 experts, top-8, sigmoid pre-softmax scoring, FP32 router, `--moe-router-topk-scaling-factor 2.827`), and RoPE (`--rotary-base 50000`, `--rotary-scaling-factor 64.0`). The K2.5 recipe then layers the following on top: +The launcher groups its flags into the arrays that are passed to `train.py`. The model shape comes from `MODEL_ARGS`, which is loaded from `scripts/models/kimi-k2-thinking.py`. That definition sets the MLA latent ranks (`q_lora_rank=1536`, `kv_lora_rank=512`, `qk_head_dim=128`, `qk_pos_emb_head_dim=64`, `v_head_dim=128`), the MoE routing (384 experts, top-8, sigmoid pre-softmax scoring, FP32 router, `--moe-router-topk-scaling-factor 2.827`), and RoPE (`--rotary-base 50000`, `--rotary-scaling-factor 64.0`). The K2.5 recipe then layers the following on top: - **`CKPT_ARGS`** wires up the dual checkpoint (INT4 actor via `--hf-checkpoint`, BF16 reference via `--ref-load`) together with `--megatron-to-hf-mode bridge` and `--model-name kimi_k25`. - **`ROLLOUT_ARGS`** and **`EVAL_ARGS`** configure GRPO sampling and periodic AIME evaluation (covered in §5.2). diff --git a/docs/models/kimi/kimi-k2.md b/docs/models/kimi/kimi-k2.md index 7bb410b834..3315577492 100644 --- a/docs/models/kimi/kimi-k2.md +++ b/docs/models/kimi/kimi-k2.md @@ -47,7 +47,8 @@ Convert across 4 nodes (mirror the DeepSeek-V3 procedure): ```bash cd /root/miles -source scripts/models/kimi-k2.sh # or kimi-k2-thinking.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py kimi-k2)" || exit 1 # or kimi-k2-thinking +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM/ torchrun \ --nproc-per-node 8 \ --master-addr ${MASTER_ADDR} --master-port 12345 \ diff --git a/docs/models/kimi/moonlight.md b/docs/models/kimi/moonlight.md index 5f1e781ba5..b4244127b0 100644 --- a/docs/models/kimi/moonlight.md +++ b/docs/models/kimi/moonlight.md @@ -33,7 +33,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/moonlight.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py moonlight)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/mimo/mimo.md b/docs/models/mimo/mimo.md index bec3687702..0e35bb6f45 100644 --- a/docs/models/mimo/mimo.md +++ b/docs/models/mimo/mimo.md @@ -33,7 +33,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/mimo-7B-rl.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py mimo-7B-rl)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/MiMo-7B-RL \ diff --git a/docs/models/nemotron/nemotron-3-nano-moe.md b/docs/models/nemotron/nemotron-3-nano-moe.md index ff4efdbf4a..77baa943c5 100644 --- a/docs/models/nemotron/nemotron-3-nano-moe.md +++ b/docs/models/nemotron/nemotron-3-nano-moe.md @@ -125,7 +125,7 @@ memory pressure rises. ### 5.5 Notable quirks -From `scripts/models/nemotron-3-nano-30b-a3b.sh` and `scripts/run-nemotron-3-nano-30b-a3b.sh`: +From `scripts/models/nemotron-3-nano-30b-a3b.py` and `scripts/run-nemotron-3-nano-30b-a3b.sh`: - **No `--spec`**: AutoBridge + the NemotronH shim synthesize the Megatron MoE spec from HF config. - 128 experts, `--moe-router-topk 6`, shared expert (3712-dim). diff --git a/docs/models/nemotron/nemotron-3-nano.md b/docs/models/nemotron/nemotron-3-nano.md index f45af01253..75dbe1f314 100644 --- a/docs/models/nemotron/nemotron-3-nano.md +++ b/docs/models/nemotron/nemotron-3-nano.md @@ -112,7 +112,7 @@ memory pressure rises. ### 5.5 Notable quirks -From `scripts/models/nemotron-3-nano-4b.sh` and `scripts/run-nemotron-3-nano-4b.sh`: +From `scripts/models/nemotron-3-nano-4b.py` and `scripts/run-nemotron-3-nano-4b.sh`: - **No `--spec`**: the AutoBridge synthesizes the Megatron spec from HF config. - `--position-embedding-type none` (no RoPE). diff --git a/docs/models/qwen/qwen3-5-moe.md b/docs/models/qwen/qwen3-5-moe.md index 0c0fd7092b..f5f24d66c7 100644 --- a/docs/models/qwen/qwen3-5-moe.md +++ b/docs/models/qwen/qwen3-5-moe.md @@ -32,7 +32,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/qwen3.5-35B-A3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3.5-35B-A3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ @@ -98,7 +99,7 @@ CPU Adam is enabled (`--optimizer-cpu-offload --overlap-cpu-optimizer-d2h-h2d -- ### 5.5 Notable quirks - The Megatron side uses `--moe-token-dispatcher-type flex`; DeepEP isn't enabled here, unlike Qwen3-Next. -- The model config (`scripts/models/qwen3.5-35B-A3B.sh`) reuses the Qwen3.5 spec: `--attention-output-gate`, `--rotary-base 10000000`, `--rotary-percent 0.25`, `A_log` kept in FP32 via the bridge. See [Backends Beyond Megatron](/advanced/architecture-support). +- The model config (`scripts/models/qwen3.5-35B-A3B.py`) reuses the Qwen3.5 spec: `--attention-output-gate`, `--rotary-base 10000000`, `--rotary-percent 0.25`, `A_log` kept in FP32 via the bridge. See [Backends Beyond Megatron](/advanced/architecture-support). ## 6. Pairs Well With diff --git a/docs/models/qwen/qwen3-5.md b/docs/models/qwen/qwen3-5.md index 8169df811d..9cfb1419c6 100644 --- a/docs/models/qwen/qwen3-5.md +++ b/docs/models/qwen/qwen3-5.md @@ -34,7 +34,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/qwen3.5-4B.sh # or qwen3.5-9B.sh / qwen3.5-27B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3.5-4B)" || exit 1 # or qwen3.5-9B / qwen3.5-27B +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3.5-4B \ @@ -92,7 +93,7 @@ Only the 27 B script enables CPU Adam (`--optimizer-cpu-offload --overlap-cpu-op ### 5.5 Notable quirks -From `scripts/models/qwen3.5-4B.sh` (and analogous configs for 9 B / 27 B): +From `scripts/models/qwen3.5-4B.py` (and analogous configs for 9 B / 27 B): - `--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec` — attention-output gate, `A_log` parameter handling. - `--rotary-base 10000000`, `--rotary-percent 0.25`. diff --git a/docs/models/qwen/qwen3-6-moe.md b/docs/models/qwen/qwen3-6-moe.md index 1e0b21c87d..d8b988d49c 100644 --- a/docs/models/qwen/qwen3-6-moe.md +++ b/docs/models/qwen/qwen3-6-moe.md @@ -47,7 +47,8 @@ hf download Qwen/Qwen3.6-35B-A3B --local-dir /root/models/Qwen3.6-35B-A3B ```bash cd /root/miles -source scripts/models/qwen3.6-35B-A3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3.6-35B-A3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ @@ -136,7 +137,7 @@ CPU Adam is enabled (`--optimizer-cpu-offload --overlap-cpu-optimizer-d2h-h2d -- ### 5.5 Notable quirks -From `scripts/models/qwen3.6-35B-A3B.sh` and `scripts/run_qwen3_6_35b_a3b_mtp.py`: +From `scripts/models/qwen3.6-35B-A3B.py` and `scripts/run_qwen3_6_35b_a3b_mtp.py`: - `--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec` — Qwen3.6 reuses the Qwen3.5 spec. - 256 experts, `--moe-router-topk 8`, `--moe-router-score-function softmax`. diff --git a/docs/models/qwen/qwen3-6.md b/docs/models/qwen/qwen3-6.md index adac7cbba7..9829ed746a 100644 --- a/docs/models/qwen/qwen3-6.md +++ b/docs/models/qwen/qwen3-6.md @@ -45,7 +45,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/qwen3.6-27B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3.6-27B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3.6-27B \ @@ -109,7 +110,7 @@ CPU Adam is enabled (`--optimizer-cpu-offload --overlap-cpu-optimizer-d2h-h2d -- ### 5.5 Notable quirks -From `scripts/models/qwen3.6-27B.sh`: +From `scripts/models/qwen3.6-27B.py`: - `--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec` — Qwen3.6 reuses the Qwen3.5 spec (gated attention, FP32 `A_log`). - `--rotary-base 10000000`, `--rotary-percent 0.25`. diff --git a/docs/models/qwen/qwen3-moe.md b/docs/models/qwen/qwen3-moe.md index 4c8f92c2b4..f043fc6ecc 100644 --- a/docs/models/qwen/qwen3-moe.md +++ b/docs/models/qwen/qwen3-moe.md @@ -47,7 +47,8 @@ hf download Qwen/Qwen3-235B-A22B-FP8 --local-dir $BASE_FOLDER/Qwen3-235B-A22B-FP ### 3.3 HF → Megatron `torch_dist` conversion ```bash -source scripts/models/qwen3-30B-A3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-30B-A3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/qwen/qwen3-next.md b/docs/models/qwen/qwen3-next.md index 3aff187dbe..bc050a9073 100644 --- a/docs/models/qwen/qwen3-next.md +++ b/docs/models/qwen/qwen3-next.md @@ -42,7 +42,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir $BASE_FOLDER/ ```bash cd /root/miles -source scripts/models/qwen3-next-80B-A3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-next-80B-A3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM torchrun --nproc-per-node 8 \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/docs/models/qwen/qwen3.md b/docs/models/qwen/qwen3.md index b2f07f0e83..03f410a348 100644 --- a/docs/models/qwen/qwen3.md +++ b/docs/models/qwen/qwen3.md @@ -39,7 +39,8 @@ hf download --repo-type dataset zhuzilin/aime-2024 --local-dir /root/aime-20 ```bash cd /root/miles -source scripts/models/qwen3-4B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3-4B \ @@ -57,9 +58,9 @@ cd /root/miles bash scripts/run-qwen3-4B.sh ``` -Other variants follow the same pattern — replace the script name (`run-qwen3-32B.sh`, etc.) and the `qwen3-XB.sh` model config. +Other variants follow the same pattern — replace the script name (`run-qwen3-32B.sh`, etc.) and the `qwen3-XB.py` model config. -The Qwen3-4B-Instruct-2507 config (`scripts/models/qwen3-4B-Instruct-2507.sh`) just sets `MODEL_ARGS_ROTARY_BASE=5000000` and re-sources `qwen3-4B.sh` — source it when converting / launching the Instruct-2507 checkpoint. +The Qwen3-4B-Instruct-2507 config (`scripts/models/qwen3-4B-Instruct-2507.py`) just calls `qwen3-4B` with `rotary_base=5000000` (`MODEL_ARGS_ROTARY_BASE` still works as an environment override) — load it when converting / launching the Instruct-2507 checkpoint. ## 5. Recipe Configuration diff --git a/docs/models/thinkingmachines/inkling-small.md b/docs/models/thinkingmachines/inkling-small.md index 5c0f5bc1ae..398ac67fa0 100644 --- a/docs/models/thinkingmachines/inkling-small.md +++ b/docs/models/thinkingmachines/inkling-small.md @@ -39,7 +39,7 @@ python scripts/run_inkling.py train \ --sglang-context-length 4096 --rollout-max-response-len 2048 ``` -The model definition lives in `scripts/models/inkling-small.sh` (`MODEL_ARGS_NUM_LAYERS` overrides the layer count for sliced smoke/parity checkpoints). HF → `torch_dist` conversion uses the same tool as Inkling with this recipe file — a single 8-GPU node (TP8 EP8) converts it in one pass. +The model definition lives in `scripts/models/inkling-small.py` (`MODEL_ARGS_NUM_LAYERS` overrides the layer count for sliced smoke/parity checkpoints). HF → `torch_dist` conversion uses the same tool as Inkling with this recipe file — a single 8-GPU node (TP8 EP8) converts it in one pass. ## 4. Validated parallelism diff --git a/docs/models/thinkingmachines/inkling.md b/docs/models/thinkingmachines/inkling.md index 31416e0132..801f9653f0 100644 --- a/docs/models/thinkingmachines/inkling.md +++ b/docs/models/thinkingmachines/inkling.md @@ -72,11 +72,12 @@ Pass `--hf-checkpoint ` to the launcher when the weights are already on a ### 4.2 HF → Megatron `torch_dist` conversion -Inkling ships in BF16, so conversion is a single distributed `torch_dist` shard (no precision cast). The model definition comes from `scripts/models/inkling.sh`: +Inkling ships in BF16, so conversion is a single distributed `torch_dist` shard (no precision cast). The model definition comes from `scripts/models/inkling.py`: ```bash cd /root/miles -source scripts/models/inkling.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py inkling)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CONVERT_KEEP_PP1=1 PYTHONPATH=/root/Megatron-LM torchrun \ --nproc-per-node 4 --nnodes 4 \ --master-addr ${MASTER_ADDR} --master-port 12345 \ diff --git a/docs/platforms/amd.md b/docs/platforms/amd.md index f1cd7bd380..07f9baa2c8 100644 --- a/docs/platforms/amd.md +++ b/docs/platforms/amd.md @@ -68,7 +68,8 @@ ROCm converter is in development. ```bash cd /root/miles -source scripts/models/qwen3-4B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" MEGATRON_LM_PATH=$(pip list | grep megatron-core | awk '{print $NF}') PYTHONPATH=${MEGATRON_LM_PATH} python tools/convert_hf_to_torch_dist.py \ diff --git a/docs/user-guide/argument-groups.md b/docs/user-guide/argument-groups.md index 11e52e7e6b..bb20a53b76 100644 --- a/docs/user-guide/argument-groups.md +++ b/docs/user-guide/argument-groups.md @@ -11,7 +11,7 @@ when you need the full default and type for an individual flag. | Group | Owns | Typical source | |---|---|---| -| [`MODEL_ARGS`](#model-args) | Architecture constants and plugin specs | `scripts/models/.sh` | +| [`MODEL_ARGS`](#model-args) | Architecture constants and plugin specs | `scripts/models/.py` | | [`CKPT_ARGS`](#ckpt-args) | Actor, reference, HF tokenizer/config, save paths | Launch script | | [`ROLLOUT_ARGS`](#rollout-args) | Prompt data, sampling, reward, train/eval batch flow | Launch script | | [`EVAL_ARGS`](#eval-args) | Evaluation datasets and eval-only sampling overrides | Launch script | @@ -24,7 +24,7 @@ when you need the full default and type for an individual flag. ## MODEL_ARGS - architecture constants `MODEL_ARGS` tells Megatron what model it is instantiating. Megatron cannot infer all -architecture details from a HuggingFace checkpoint, so each recipe sources a matching +architecture details from a HuggingFace checkpoint, so each recipe loads a matching file from `scripts/models/`. Common entries: diff --git a/docs/user-guide/training-script-walkthrough.md b/docs/user-guide/training-script-walkthrough.md index 341aef2dcc..6499e630ae 100644 --- a/docs/user-guide/training-script-walkthrough.md +++ b/docs/user-guide/training-script-walkthrough.md @@ -29,15 +29,16 @@ off to `train.py`: ## MODEL_ARGS — architecture constants Megatron needs the model architecture hardcoded at launch because it cannot introspect -a HuggingFace checkpoint. Miles therefore sources a matching bash file from -`scripts/models/.sh`: +a HuggingFace checkpoint. Miles therefore loads a matching python file from +`scripts/models/.py`: ```bash SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/glm4-9B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" glm4-9B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" ``` -The sourced file sets `MODEL_ARGS=(--num-layers ... --hidden-size ... --rotary-base ...)`. +The loaded file prints `--num-layers ... --hidden-size ... --rotary-base ...` on one line. @@ -46,7 +47,8 @@ padding, or normalization epsilon. Diff the `config.json` against the file in `scripts/models/` before you run, and override anything that drifts: ```bash -source "${SCRIPT_DIR}/models/glm4-9B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" glm4-9B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" MODEL_ARGS+=(--rotary-base 10000) ``` diff --git a/docs/user-guide/usage.md b/docs/user-guide/usage.md index 7dccf4d29f..359dee8655 100644 --- a/docs/user-guide/usage.md +++ b/docs/user-guide/usage.md @@ -106,7 +106,8 @@ the next run. Requires `--save` to be set. ### HuggingFace → torch_dist ```bash -source scripts/models/.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py )" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/ \ diff --git a/examples/experimental/eval/nemo_skills/README.md b/examples/experimental/eval/nemo_skills/README.md index e2a3aaad70..c9d5bf79f4 100644 --- a/examples/experimental/eval/nemo_skills/README.md +++ b/examples/experimental/eval/nemo_skills/README.md @@ -138,7 +138,8 @@ You need to convert the HF model to the format required by Megatron-LM. Ensure y ```bash # Source model arguments -source scripts/models/qwen3-4B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Convert model PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ diff --git a/examples/experimental/eval/scripts/run-qwen3-32B.sh b/examples/experimental/eval/scripts/run-qwen3-32B.sh index 525bfe357d..cd09054754 100644 --- a/examples/experimental/eval/scripts/run-qwen3-32B.sh +++ b/examples/experimental/eval/scripts/run-qwen3-32B.sh @@ -30,7 +30,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../../.." &>/dev/null && pwd)" -source "${REPO_ROOT}/scripts/models/qwen3-32B.sh" +MODEL_ARGS_LINE="$(python3 "${REPO_ROOT}/miles/utils/external_utils/model_args_utils.py" "qwen3-32B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Store eval/delegate settings in a YAML config similar to examples/experimental/eval_multi_task. EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/examples/experimental/eval/scripts/multi_tasks.yaml"} diff --git a/examples/experimental/eval/scripts/run-qwen3-4B.sh b/examples/experimental/eval/scripts/run-qwen3-4B.sh index e2647973c8..250e6c996a 100644 --- a/examples/experimental/eval/scripts/run-qwen3-4B.sh +++ b/examples/experimental/eval/scripts/run-qwen3-4B.sh @@ -31,7 +31,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../../.." &>/dev/null && pwd)" -source "${REPO_ROOT}/scripts/models/qwen3-4B.sh" +MODEL_ARGS_LINE="$(python3 "${REPO_ROOT}/miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Store eval/delegate settings in a YAML config similar to examples/experimental/eval_multi_task. EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/examples/experimental/eval/scripts/multi_tasks.yaml"} diff --git a/examples/experimental/eval_multi_task/multi_task.sh b/examples/experimental/eval_multi_task/multi_task.sh index 090c461a00..6a5aeca0bb 100644 --- a/examples/experimental/eval_multi_task/multi_task.sh +++ b/examples/experimental/eval_multi_task/multi_task.sh @@ -25,7 +25,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../.." &>/dev/null && pwd)" -source "${REPO_ROOT}/scripts/models/qwen3-4B.sh" +MODEL_ARGS_LINE="$(python3 "${REPO_ROOT}/miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" EVAL_CONFIG_PATH="${REPO_ROOT}/examples/experimental/eval_multi_task/multi_task.yaml" CKPT_ARGS=( diff --git a/examples/experimental/formal_math/single_round/run_minimal.py b/examples/experimental/formal_math/single_round/run_minimal.py index fa19ccf452..7e7d774538 100644 --- a/examples/experimental/formal_math/single_round/run_minimal.py +++ b/examples/experimental/formal_math/single_round/run_minimal.py @@ -8,6 +8,8 @@ import subprocess from pathlib import Path +from miles.utils.external_utils.model_args_utils import load_model_args + repo_base_dir = Path(os.path.abspath(__file__)).resolve().parents[4] MODEL_NAME, MODEL_TYPE = "Qwen3-8B", "qwen3-8B" @@ -131,11 +133,10 @@ cmd = ( f"export PYTHONUNBUFFERED=1 && " - f'source "{repo_base_dir}/scripts/models/{MODEL_TYPE}.sh" && ' f'ray job submit --address="http://127.0.0.1:8265" ' f"--runtime-env-json='{runtime_env_json}' " f"-- python3 train.py " - "${MODEL_ARGS[@]} " + f"{load_model_args(MODEL_TYPE)} " f"{train_args}" ) diff --git a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh index fa484f0468..3ca29aaefc 100644 --- a/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh +++ b/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-30B-A3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-30B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-30B-A3B #--hf-checkpoint /root/Qwen3-30B-A3B-FP8 diff --git a/examples/experimental/reproducibility/README.md b/examples/experimental/reproducibility/README.md index 08759d7aa1..cedfc7d366 100644 --- a/examples/experimental/reproducibility/README.md +++ b/examples/experimental/reproducibility/README.md @@ -34,7 +34,8 @@ hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir /root/Qwen2.5-0.5B-Instruct # convert ckpt cd miles/ -source scripts/models/qwen2.5-0.5B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen2.5-0.5B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM/ python \ tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ diff --git a/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh b/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh index f8d498ee2e..b84b66c243 100644 --- a/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh +++ b/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh @@ -16,7 +16,8 @@ set -ex export PYTHONUNBUFFERED=1 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen2.5-0.5B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-0.5B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-0.5B-Instruct/ diff --git a/examples/experimental/search-r1/README.md b/examples/experimental/search-r1/README.md index 4cab49e363..0089e021e5 100644 --- a/examples/experimental/search-r1/README.md +++ b/examples/experimental/search-r1/README.md @@ -51,7 +51,8 @@ hf download Qwen/Qwen2.5-3B --local-dir /root/Qwen2.5-3B # mcore checkpoint cd /root/miles -source scripts/models/qwen2.5-3B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen2.5-3B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen2.5-3B \ @@ -70,17 +71,14 @@ SEARCH_R1_CONFIGS = { "max_turns": 2, "topk": 3, "search_concurrency": 256, - # ============== Search Backend Selection ============== "search_backend": "local", # Options: "local" or "google" - # ============== Local Search Configuration ============== # (Only used when search_backend="local") "local": { "search_url": "http://127.0.0.1:8000/retrieve", # URL of your local retrieval server "proxy": None, }, - # ============== Google Search Configuration ============== # (Only used when search_backend="google") "google": { @@ -88,10 +86,8 @@ SEARCH_R1_CONFIGS = { "snippet_only": True, "proxy": None, }, - # ============== Log Probability Collection ============== "return_logprob": True, # Set to True to collect log probabilities (required for TIS) - # ============== Reward Model Configuration ============== "format_score": 0.2, } diff --git a/examples/experimental/search-r1/run_qwen2.5_3B.sh b/examples/experimental/search-r1/run_qwen2.5_3B.sh index 798a29d75b..ab0dd75cb3 100644 --- a/examples/experimental/search-r1/run_qwen2.5_3B.sh +++ b/examples/experimental/search-r1/run_qwen2.5_3B.sh @@ -16,7 +16,8 @@ set -ex export PYTHONUNBUFFERED=1 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen2.5-3B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-3B/ diff --git a/examples/experimental/strands_sglang/README.md b/examples/experimental/strands_sglang/README.md index 6fe4cce4d4..158b113d01 100644 --- a/examples/experimental/strands_sglang/README.md +++ b/examples/experimental/strands_sglang/README.md @@ -36,7 +36,8 @@ hf download Qwen/Qwen3-8B --local-dir /root/models/Qwen/Qwen3-8B # mcore checkpoint cd /root/miles -source scripts/models/qwen3-8B.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-8B)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/models/Qwen/Qwen3-8B \ @@ -49,6 +50,7 @@ Following [Retool](https://arxiv.org/abs/2504.11536), we use `dapo-math-17k` as ```python from datasets import load_dataset + ds = load_dataset("zhuzilin/dapo-math-17k", split="train") ds.to_json("/root/data/dapo-math-17k.jsonl", orient="records", lines=True) ``` @@ -57,6 +59,7 @@ and `aime-2024` as eval data: ```python from datasets import load_dataset + ds = load_dataset("zhuzilin/aime-2024", split="train") ds.to_json("/root/data/aime-2024.jsonl", orient="records", lines=True) ``` diff --git a/examples/experimental/strands_sglang/strands_qwen3_8b.sh b/examples/experimental/strands_sglang/strands_qwen3_8b.sh index 9e4aa1f45e..79a49a6467 100644 --- a/examples/experimental/strands_sglang/strands_qwen3_8b.sh +++ b/examples/experimental/strands_sglang/strands_qwen3_8b.sh @@ -28,8 +28,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-8B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-8B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Generate timestamp suffix for save path TIMESTAMP_SUFFIX=$(date +%Y%m%d_%H%M%S) diff --git a/examples/experimental/tau-bench/README.md b/examples/experimental/tau-bench/README.md index 2959ef1dd7..b0179ad701 100644 --- a/examples/experimental/tau-bench/README.md +++ b/examples/experimental/tau-bench/README.md @@ -33,7 +33,8 @@ hf download Qwen/Qwen3-4B-Instruct-2507 --local-dir /root/Qwen3-4B-Instruct-2507 # mcore checkpoint cd /root/miles -source scripts/models/qwen3-4B-Instruct-2507.sh +MODEL_ARGS_LINE="$(python3 miles/utils/external_utils/model_args_utils.py qwen3-4B-Instruct-2507)" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \ ${MODEL_ARGS[@]} \ --hf-checkpoint /root/Qwen3-4B-Instruct-2507 \ diff --git a/examples/experimental/tau-bench/run_qwen3_4B.sh b/examples/experimental/tau-bench/run_qwen3_4B.sh index 172834e79f..184c0fa5e9 100644 --- a/examples/experimental/tau-bench/run_qwen3_4B.sh +++ b/examples/experimental/tau-bench/run_qwen3_4B.sh @@ -24,7 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-4B-Instruct-2507.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-4B-Instruct-2507")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B-Instruct-2507/ diff --git a/examples/fully_async/run-qwen3-4b-fully_async.sh b/examples/fully_async/run-qwen3-4b-fully_async.sh index 44445b8647..07dd2b6ee5 100644 --- a/examples/fully_async/run-qwen3-4b-fully_async.sh +++ b/examples/fully_async/run-qwen3-4b-fully_async.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B #--hf-checkpoint /root/Qwen3-4B-FP8 diff --git a/examples/geo3k_vlm/run_geo3k_vlm.sh b/examples/geo3k_vlm/run_geo3k_vlm.sh index e95c55ebb4..3da32be58c 100644 --- a/examples/geo3k_vlm/run_geo3k_vlm.sh +++ b/examples/geo3k_vlm/run_geo3k_vlm.sh @@ -188,7 +188,8 @@ else MILES_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." &>/dev/null && pwd)" MODEL_ARGS_FILE=$(echo "$MODEL_NAME" | sed 's/-Instruct//g; s/-Thinking//g; s/Qwen3-VL-/qwen3-/g; s/-2B/-1.7B/g') # VL models require rotary-base 5000000 - MODEL_ARGS_ROTARY_BASE=5000000 source "${MILES_DIR}/scripts/models/${MODEL_ARGS_FILE}.sh" + MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=5000000 python3 "${MILES_DIR}/miles/utils/external_utils/model_args_utils.py" "${MODEL_ARGS_FILE}")" || exit 1 + read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" fi diff --git a/examples/geo3k_vlm/run_geo3k_vlm_sft.sh b/examples/geo3k_vlm/run_geo3k_vlm_sft.sh index 7975c4c07f..023f816a69 100644 --- a/examples/geo3k_vlm/run_geo3k_vlm_sft.sh +++ b/examples/geo3k_vlm/run_geo3k_vlm_sft.sh @@ -152,7 +152,8 @@ else MILES_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." &>/dev/null && pwd)" MODEL_ARGS_FILE=$(echo "$MODEL_NAME" | sed 's/-Instruct//g; s/-Thinking//g; s/Qwen3-VL-/qwen3-/g; s/-2B/-1.7B/g') # VL models require rotary-base 5000000 - MODEL_ARGS_ROTARY_BASE=5000000 source "${MILES_DIR}/scripts/models/${MODEL_ARGS_FILE}.sh" + MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=5000000 python3 "${MILES_DIR}/miles/utils/external_utils/model_args_utils.py" "${MODEL_ARGS_FILE}")" || exit 1 + read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" fi # Start Ray if not using external Ray diff --git a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh index f7fa4840e2..0572681da7 100644 --- a/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh +++ b/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/kimi-k2-thinking.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "kimi-k2-thinking")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Kimi-K2-Thinking/ --ref-load /root/Kimi-K2_thinking_torch_dist/ diff --git a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh index 17b81f2ee8..f15a424571 100644 --- a/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh @@ -25,8 +25,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/moonlight.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "moonlight")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Moonlight-16B-A3B-Instruct-INT4 --ref-load /root/Moonlight-16B-A3B-Instruct-INT4_torch_dist diff --git a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh index 490f8e4141..54a47fba57 100644 --- a/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-235B-A22B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-235B-A22B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-235B-A22B-INT4/ --ref-load /root/Qwen3-235B-A22B_torch_dist/ diff --git a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh index 0ff20072ec..9b633d938f 100644 --- a/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh +++ b/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-30B-A3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-30B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-30B-A3B-INT4/ --ref-load /root/Qwen3-30B-A3B_torch_dist/ diff --git a/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh b/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh index 0f6fbf6b5b..19cca96e04 100644 --- a/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh +++ b/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh @@ -25,7 +25,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-30B-A3B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-30B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Base directory for checkpoints and related files (adjust if necessary) BASE_DIR="/root" diff --git a/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh b/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh index bf8f6407ae..205cda89a7 100644 --- a/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh +++ b/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh @@ -24,7 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-4B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B-FP8 diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh index b6981ced2f..652b310a39 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh @@ -72,8 +72,8 @@ MODEL_NAME="GLM-4.5-Air" MODEL_TYPE="glm4.5-106B-A12B" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Rotary base override export MODEL_ARGS_ROTARY_BASE=1000000 diff --git a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh index b2604b5c24..9062fa0cfd 100644 --- a/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh @@ -80,8 +80,8 @@ MODEL_TYPE="glm4.7-flash" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # --------------------------------------------------------------------------- # Determine modes to run # --------------------------------------------------------------------------- diff --git a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh index 0a279c28dc..7ce1df610f 100755 --- a/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh @@ -116,8 +116,8 @@ esac NUM_TRAIN_NODES=$((NUM_TRAIN_GPUS / GPUS_PER_NODE)) MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" echo "" echo "============================================================" echo " Model : ${MODEL_NAME} (${MODEL_TYPE})" diff --git a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh index 8dc4e00853..ddcdd9c447 100644 --- a/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh @@ -85,9 +85,8 @@ MODEL_TYPE="kimi-k2" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # --------------------------------------------------------------------------- # Determine modes to run # --------------------------------------------------------------------------- diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh index 129d0abb99..57a28d1ca7 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh @@ -82,9 +82,8 @@ MODEL_TYPE="qwen3-235B-A22B" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" export MODEL_ARGS_ROTARY_BASE=5000000 -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # --------------------------------------------------------------------------- # Determine modes to run # --------------------------------------------------------------------------- diff --git a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh index e17a48445f..43b610f3f6 100644 --- a/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh +++ b/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh @@ -84,8 +84,8 @@ MODEL_TYPE="qwen3-30B-A3B" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" MILES_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" -source "${MILES_ROOT}/scripts/models/${MODEL_TYPE}.sh" - +MODEL_ARGS_LINE="$(python3 "${MILES_ROOT}/miles/utils/external_utils/model_args_utils.py" "${MODEL_TYPE}")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Rotary base override export MODEL_ARGS_ROTARY_BASE=1000000 diff --git a/examples/infra_features/p2p_weight_transfer/run.py b/examples/infra_features/p2p_weight_transfer/run.py index dd14e9b145..1014b13a97 100644 --- a/examples/infra_features/p2p_weight_transfer/run.py +++ b/examples/infra_features/p2p_weight_transfer/run.py @@ -35,7 +35,7 @@ class PrepareConfig: """Configuration for the `prepare` subcommand.""" hf_repo: str - model_type: str # megatron model type (maps to scripts/models/.sh) + model_type: str # megatron model type (maps to scripts/models/.py) datasets: list[str] = field(default_factory=lambda: ["zhuzilin/dapo-math-17k"]) convert_gpus_per_node: int = 8 convert_multinode: bool = False @@ -1101,7 +1101,11 @@ def cmd_run( def build_model_args_command(cfg: RunConfig) -> str: """A shell snippet leaving MODEL_ARGS set; the knobs must reach it, not only ray's runtime env.""" prefix = "".join(f"{name}={shlex.quote(value)} " for name, value in build_model_args_env(cfg).items()) - return f'{prefix}source "{MILES_ROOT}/scripts/models/{cfg.model_type}.sh"' + return ( + f'MODEL_ARGS_LINE="$({prefix}python3 "{MILES_ROOT}/miles/utils/external_utils/model_args_utils.py"' + f' {cfg.model_type})" || exit 1; ' + 'read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}"' + ) def build_model_args_env(cfg: RunConfig) -> dict[str, str]: diff --git a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh index 4a3f0aeda7..1390d3ac83 100644 --- a/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh +++ b/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh @@ -24,7 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../../scripts/models/qwen3-4B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B diff --git a/examples/lora/dev.sh b/examples/lora/dev.sh index 80648cfb81..0b2145efb9 100644 --- a/examples/lora/dev.sh +++ b/examples/lora/dev.sh @@ -19,8 +19,8 @@ set -ex SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen2.5-3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-3B-Instruct/ --megatron-to-hf-mode bridge diff --git a/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh b/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh index e26d663fa2..098a0e7686 100644 --- a/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh +++ b/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh @@ -16,8 +16,8 @@ GPUS_PER_NODE=$(echo "$CUDA_VISIBLE_DEVICES" | tr ',' '\n' | wc -l) # Load model architecture config SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/gpt-oss-20b.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "gpt-oss-20b")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/models/gpt-oss-20b --megatron-to-hf-mode bridge diff --git a/examples/lora/run-kimi-k25-megatron-lora.sh b/examples/lora/run-kimi-k25-megatron-lora.sh index f43f141dab..ec25afdf91 100755 --- a/examples/lora/run-kimi-k25-megatron-lora.sh +++ b/examples/lora/run-kimi-k25-megatron-lora.sh @@ -28,8 +28,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/kimi-k2-thinking.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "kimi-k2-thinking")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/Kimi-K2.5-int4 --ref-load $BASE_DIR/Kimi-K2.5-bf16 diff --git a/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh b/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh index bc287acd69..be29ca0379 100644 --- a/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh +++ b/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh @@ -18,8 +18,8 @@ set -ex SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen2.5-0.5B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-0.5B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-0.5B-Instruct/ --megatron-to-hf-mode bridge diff --git a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh index 592c77148a..ab8556f719 100644 --- a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh +++ b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh @@ -134,8 +134,8 @@ pkill -9 python || true set -ex SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen2.5-3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-3B-Instruct/ --megatron-to-hf-mode bridge diff --git a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh index f04fabf65b..7687a83d3c 100644 --- a/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh +++ b/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh @@ -18,8 +18,8 @@ set -ex SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen2.5-3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen2.5-3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen2.5-3B-Instruct/ --megatron-to-hf-mode bridge diff --git a/examples/lora/run-qwen3-4B-megatron-lora.sh b/examples/lora/run-qwen3-4B-megatron-lora.sh index 48ed58344e..e47a50fc1f 100644 --- a/examples/lora/run-qwen3-4B-megatron-lora.sh +++ b/examples/lora/run-qwen3-4B-megatron-lora.sh @@ -30,7 +30,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." &>/dev/null && pwd)" -source "${REPO_ROOT}/scripts/models/qwen3-4B.sh" +MODEL_ARGS_LINE="$(python3 "${REPO_ROOT}/miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" # Store eval/delegate settings in a YAML config similar to examples/experimental/eval_multi_task. # EVAL_CONFIG_PATH=${SKILLS_EVAL_CONFIG_PATH:-"${REPO_ROOT}/examples/experimental/eval/scripts/multi_tasks.yaml"} diff --git a/examples/lora/run-qwen3-4b-megatron-lora-result.sh b/examples/lora/run-qwen3-4b-megatron-lora-result.sh index 0d76d807cb..624a76892d 100644 --- a/examples/lora/run-qwen3-4b-megatron-lora-result.sh +++ b/examples/lora/run-qwen3-4b-megatron-lora-result.sh @@ -33,8 +33,8 @@ echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" LR=2e-5 SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B --save /root/Qwen3-4B-lora-ckpt diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh index 0e971aae26..df65334a7d 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh @@ -22,9 +22,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" - - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen3-8B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-8B --ref-load /root/Qwen3-8B_torch_dist diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh index fad2c0aade..1dae8db8a0 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh @@ -97,7 +97,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen3-8B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( diff --git a/examples/on_policy_distillation/run-qwen3-8B-opd.sh b/examples/on_policy_distillation/run-qwen3-8B-opd.sh index 1389138133..953c380c00 100644 --- a/examples/on_policy_distillation/run-qwen3-8B-opd.sh +++ b/examples/on_policy_distillation/run-qwen3-8B-opd.sh @@ -45,9 +45,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../../scripts/models/qwen3-8B.sh" - - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../../miles/utils/external_utils/model_args_utils.py" "qwen3-8B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-8B --ref-load /root/Qwen3-8B_torch_dist diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/args.py b/miles/utils/debug_utils/run_megatron/cli/commands/args.py index a851b0e400..818a709eaa 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/args.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/args.py @@ -15,7 +15,7 @@ def _field( @dataclasses.dataclass class CommonRunArgs: - model_type: str = _field(help="Model type matching scripts/models/{model_type}.sh") + model_type: str = _field(help="Model type matching scripts/models/{model_type}.py") hf_checkpoint: Path = _field(help="HuggingFace checkpoint path") ref_load: Path | None = _field(default=None, help="Megatron checkpoint path") sp: bool = _field(default=False, help="Enable sequence parallelism") diff --git a/miles/utils/debug_utils/run_megatron/cli/commands/run.py b/miles/utils/debug_utils/run_megatron/cli/commands/run.py index 4f1a53659f..e83e98e149 100644 --- a/miles/utils/debug_utils/run_megatron/cli/commands/run.py +++ b/miles/utils/debug_utils/run_megatron/cli/commands/run.py @@ -7,7 +7,7 @@ from miles.utils.debug_utils.run_megatron.cli.commands.args import RunArgs from miles.utils.debug_utils.run_megatron.cli.parallel_utils import ParallelConfig -from miles.utils.debug_utils.run_megatron.cli.path_utils import resolve_megatron_path, resolve_model_script +from miles.utils.debug_utils.run_megatron.cli.path_utils import resolve_megatron_path from miles.utils.debug_utils.run_megatron.cli.prompt_utils import ( PromptConfig, generate_token_ids, @@ -19,7 +19,8 @@ build_worker_args, ) from miles.utils.debug_utils.run_megatron.worker.script_args import WorkerScriptArgs -from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu +from miles.utils.external_utils.exec_command import exec_command_gpu +from miles.utils.external_utils.model_args_utils import load_model_args from miles.utils.typer_utils import dataclass_cli @@ -94,12 +95,7 @@ def run(args: RunArgs) -> None: def show_model_args( - model_type: Annotated[str, typer.Option(help="Model type matching scripts/models/{model_type}.sh")], + model_type: Annotated[str, typer.Option(help="Model type matching scripts/models/{model_type}.py")], ) -> None: """Show the MODEL_ARGS for a given model type (debug helper).""" - output: str | None = exec_command_cpu( - f'source "{resolve_model_script(model_type)}" && echo "${{MODEL_ARGS[@]}}"', - capture_output=True, - ) - if output: - print(output.strip()) + print(load_model_args(model_type)) diff --git a/miles/utils/debug_utils/run_megatron/cli/path_utils.py b/miles/utils/debug_utils/run_megatron/cli/path_utils.py index b34f91d145..810f053963 100644 --- a/miles/utils/debug_utils/run_megatron/cli/path_utils.py +++ b/miles/utils/debug_utils/run_megatron/cli/path_utils.py @@ -19,7 +19,7 @@ def resolve_megatron_path(megatron_path: Path | None) -> Path: def resolve_model_script(model_type: str) -> Path: repo_base: Path = _resolve_repo_base() - script: Path = repo_base / "scripts" / "models" / f"{model_type}.sh" + script: Path = repo_base / "scripts" / "models" / f"{model_type}.py" if not script.exists(): raise typer.BadParameter(f"Model script not found: {script}") return script diff --git a/miles/utils/debug_utils/run_megatron/cli/worker_executor.py b/miles/utils/debug_utils/run_megatron/cli/worker_executor.py index 211ae08906..5bb6644bbf 100644 --- a/miles/utils/debug_utils/run_megatron/cli/worker_executor.py +++ b/miles/utils/debug_utils/run_megatron/cli/worker_executor.py @@ -3,8 +3,8 @@ from pathlib import Path from miles.utils.debug_utils.run_megatron.cli.parallel_utils import ParallelConfig -from miles.utils.debug_utils.run_megatron.cli.path_utils import resolve_model_script from miles.utils.debug_utils.run_megatron.worker.script_args import WORKER_SCRIPT_ARGS_BRIDGE, WorkerScriptArgs +from miles.utils.external_utils.model_args_utils import load_model_args def build_torchrun_cmd( @@ -15,16 +15,14 @@ def build_torchrun_cmd( worker_args: str, ) -> str: """Build the full shell command to launch the worker via torchrun.""" - model_script: Path = resolve_model_script(model_type) worker_module: str = "miles.utils.debug_utils.run_megatron.worker.main" cmd: str = ( - f'source "{model_script}" && ' f"PYTHONPATH={megatron_path}:$PYTHONPATH " f"CUDA_DEVICE_MAX_CONNECTIONS=1 " f"torchrun --nproc-per-node {nproc} " f"-m {worker_module} " - f"${{MODEL_ARGS[@]}} " + f"{load_model_args(model_type)} " f"--hidden-dropout 0 --attention-dropout 0 " f"{worker_args}" ) diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index d296734ba6..ae0e96ee2a 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -9,12 +9,12 @@ import random import shlex import socket -import subprocess from dataclasses import dataclass, field from functools import partial from pathlib import Path from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu, exec_command_multi_node +from miles.utils.external_utils.model_args_utils import load_model_args from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX from miles.utils.http_utils import wait_for_server_ready from miles.utils.typer_utils import dataclass_cli @@ -32,18 +32,6 @@ def _pythonpath_with_sources(megatron_path: str, *additional_pythonpaths: str | return os.pathsep.join(dict.fromkeys(entries)) -def load_model_args(megatron_model_type: str) -> list[str]: - """Expand the MODEL_ARGS array that scripts/models/.sh declares.""" - script = f"{repo_base_dir}/scripts/models/{megatron_model_type}.sh" - assert os.path.exists(script), f"no model args script at {script}" - expansion = f'source {shlex.quote(script)} && printf "%s\\0" "${{MODEL_ARGS[@]}}"' - result = subprocess.run(["bash", "-c", expansion], capture_output=True, text=True, check=True) - tokens = result.stdout.split("\0")[:-1] - for token in tokens: - assert token.split() == [token], f"model args token must be one whitespace-free word: {token!r}" - return tokens - - def convert_checkpoint( model_name, megatron_model_type, @@ -81,7 +69,7 @@ def convert_checkpoint( f"--nproc-per-node {num_gpus_per_node} " f"{multinode_args}" f"{repo_base_dir}/tools/convert_hf_to_torch_dist.py " - f"{' '.join(load_model_args(megatron_model_type))} " + f"{load_model_args(megatron_model_type)} " f"--hf-checkpoint {hf_checkpoint} " f"--save {path_dst} " f"{extra_args}" @@ -207,7 +195,7 @@ def execute_train( runtime_env_json = json.dumps({"env_vars": runtime_env_vars}) if get_bool_env_var("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1"): - model_args = " ".join(load_model_args(megatron_model_type)) if megatron_model_type is not None else "" + model_args = load_model_args(megatron_model_type) if megatron_model_type is not None else "" exec_command_cpu( f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " f"""ray job submit {'' if 'RAY_ADDRESS' in os.environ else '--address="http://127.0.0.1:8265" '}""" diff --git a/miles/utils/external_utils/model_args_utils.py b/miles/utils/external_utils/model_args_utils.py new file mode 100644 index 0000000000..698f38aa2a --- /dev/null +++ b/miles/utils/external_utils/model_args_utils.py @@ -0,0 +1,59 @@ +import importlib.util +import sys +from pathlib import Path +from types import ModuleType + +REPO_ROOT = Path(__file__).resolve().parents[3] +MODEL_SCRIPT_DIR = REPO_ROOT / "scripts" / "models" + + +# ==================== loading a model script ==================== + + +def load_model_args(model_type: str, model_script_dir: Path | None = None, **kwargs: object) -> str: + """Collapse scripts/models/.py to one line; a newline would truncate the shell's read -ra.""" + path = (model_script_dir or MODEL_SCRIPT_DIR) / f"{model_type}.py" + assert path.exists(), f"no model args script at {path}" + sys.modules.setdefault("model_args_utils", sys.modules[__name__]) + module = import_module_from_path(path, f"miles_model_args_{path.stem.replace('.', '_').replace('-', '_')}") + args = " ".join(module.model_args(**kwargs).split()) + assert args, f"{path} declared no model args" + return args + + +def load_sibling_model_args(model_script: str, model_type: str, **kwargs: object) -> str: + """Load the model a variant is derived from, out of the same checkout as the variant itself.""" + return load_model_args(model_type, model_script_dir=Path(model_script).resolve().parent, **kwargs) + + +# ==================== what a model script may call ==================== + + +def moe_layer_freq(*, nlayers: int, first_k_dense_replace: int) -> str: + """Render megatron's --moe-layer-freq pattern: the first K layers dense, the rest MoE.""" + dense = min(first_k_dense_replace, nlayers) + return "[" + ",".join(["0"] * dense + ["1"] * (nlayers - dense)) + "]" + + +# ==================== importing a file by path ==================== + + +def import_module_from_path(path: Path, module_name: str) -> ModuleType: + """Import a python file that is not reachable as a dotted module path.""" + spec = importlib.util.spec_from_file_location(module_name, path) + assert spec is not None and spec.loader is not None, f"cannot load {path}" + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + try: + spec.loader.exec_module(module) + finally: + del sys.modules[module_name] + return module + + +# ==================== command line ==================== + + +if __name__ == "__main__": + (_MODEL_TYPE,) = sys.argv[1:] + print(load_model_args(_MODEL_TYPE)) diff --git a/scripts/amd/run-qwen3-4B-amd.sh b/scripts/amd/run-qwen3-4B-amd.sh index d3251fcf50..9bb3186537 100644 --- a/scripts/amd/run-qwen3-4B-amd.sh +++ b/scripts/amd/run-qwen3-4B-amd.sh @@ -30,8 +30,8 @@ if [[ -n "${CUDA_VISIBLE_DEVICES:-}" ]]; then fi SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B --ref-load /root/Qwen3-4B_torch_dist diff --git a/scripts/models/deepseek-v3-20layer.py b/scripts/models/deepseek-v3-20layer.py new file mode 100644 index 0000000000..19bc7a48c9 --- /dev/null +++ b/scripts/models/deepseek-v3-20layer.py @@ -0,0 +1,5 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + return load_sibling_model_args(__file__, "deepseek-v3", nlayers=20) diff --git a/scripts/models/deepseek-v3-20layer.sh b/scripts/models/deepseek-v3-20layer.sh deleted file mode 100644 index 6fdde1820c..0000000000 --- a/scripts/models/deepseek-v3-20layer.sh +++ /dev/null @@ -1 +0,0 @@ -MODEL_ARGS_NUM_LAYERS=20 source "$(dirname -- "${BASH_SOURCE[0]}")/deepseek-v3.sh" diff --git a/scripts/models/deepseek-v3-5layer.py b/scripts/models/deepseek-v3-5layer.py new file mode 100644 index 0000000000..910b1b951f --- /dev/null +++ b/scripts/models/deepseek-v3-5layer.py @@ -0,0 +1,5 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + return load_sibling_model_args(__file__, "deepseek-v3", nlayers=5) diff --git a/scripts/models/deepseek-v3-5layer.sh b/scripts/models/deepseek-v3-5layer.sh deleted file mode 100644 index a5e5d2522c..0000000000 --- a/scripts/models/deepseek-v3-5layer.sh +++ /dev/null @@ -1 +0,0 @@ -MODEL_ARGS_NUM_LAYERS=5 source "$(dirname -- "${BASH_SOURCE[0]}")/deepseek-v3.sh" diff --git a/scripts/models/deepseek-v3.py b/scripts/models/deepseek-v3.py new file mode 100644 index 0000000000..ce0bc96f2e --- /dev/null +++ b/scripts/models/deepseek-v3.py @@ -0,0 +1,56 @@ +import os + +from model_args_utils import moe_layer_freq + + +FIRST_K_DENSE_REPLACE = 3 + + +def model_args(nlayers: int | None = None) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 61) + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 7168 " + "--ffn-hidden-size 18432 " + "--num-attention-heads 128 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 129280 " + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + "--rotary-scaling-factor 40 " + "--rotary-base 10000 " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # moe + "--num-experts 256 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 8 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 4 " + "--moe-router-num-groups 8 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/deepseek-v3.sh b/scripts/models/deepseek-v3.sh deleted file mode 100644 index 8c50d2c940..0000000000 --- a/scripts/models/deepseek-v3.sh +++ /dev/null @@ -1,63 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-61}" -FIRST_K_DENSE_REPLACE=3 - -arr=() -for ((i=0; i str: + return load_sibling_model_args(__file__, "deepseek-v32", nlayers=5) diff --git a/scripts/models/deepseek-v32-5layer.sh b/scripts/models/deepseek-v32-5layer.sh deleted file mode 100644 index 2466640afd..0000000000 --- a/scripts/models/deepseek-v32-5layer.sh +++ /dev/null @@ -1 +0,0 @@ -MODEL_ARGS_NUM_LAYERS=5 source "$(dirname -- "${BASH_SOURCE[0]}")/deepseek-v32.sh" diff --git a/scripts/models/deepseek-v32.py b/scripts/models/deepseek-v32.py new file mode 100644 index 0000000000..d2e02f006d --- /dev/null +++ b/scripts/models/deepseek-v32.py @@ -0,0 +1,58 @@ +import os + +from model_args_utils import moe_layer_freq + + +def model_args(nlayers: int | None = None, first_k_dense_replace: int | None = None) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 61) + first_k_dense_replace = ( + first_k_dense_replace + if first_k_dense_replace is not None + else int(os.environ.get("MODEL_ARGS_FIRST_K_DENSE_REPLACE") or 3) + ) + return ( + "--spec miles_plugins.models.glm5.glm5 get_glm5_spec " + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 7168 " + "--ffn-hidden-size 18432 " + "--num-attention-heads 128 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 129280 " + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + "--rotary-scaling-factor 40 " + "--rotary-base 10000 " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + "--num-experts 256 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=first_k_dense_replace)} " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 8 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 4 " + "--moe-router-num-groups 8 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/deepseek-v32.sh b/scripts/models/deepseek-v32.sh deleted file mode 100644 index 649c3f6bac..0000000000 --- a/scripts/models/deepseek-v32.sh +++ /dev/null @@ -1,62 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-61}" -FIRST_K_DENSE_REPLACE="${MODEL_ARGS_FIRST_K_DENSE_REPLACE:-3}" - -arr=() -for ((i=0; i str: + return load_sibling_model_args(__file__, "deepseek-v4-flash", nlayers=4, compress_ratios="0 0 4 128") diff --git a/scripts/models/deepseek-v4-flash-4layer.sh b/scripts/models/deepseek-v4-flash-4layer.sh deleted file mode 100644 index 2a852460c1..0000000000 --- a/scripts/models/deepseek-v4-flash-4layer.sh +++ /dev/null @@ -1,3 +0,0 @@ -MODEL_ARGS_NUM_LAYERS=4 -COMPRESS_RATIOS=(0 0 4 128) -source "$(dirname -- "${BASH_SOURCE[0]}")/deepseek-v4-flash.sh" diff --git a/scripts/models/deepseek-v4-flash.py b/scripts/models/deepseek-v4-flash.py new file mode 100644 index 0000000000..f9b87961e3 --- /dev/null +++ b/scripts/models/deepseek-v4-flash.py @@ -0,0 +1,77 @@ +import os + +from model_args_utils import moe_layer_freq + + +COMPRESS_RATIOS = "0 0 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 128 4 0" +SWIGLU_LIMIT_ARGS = "--activation-func-clamp-value 10 --no-bias-swiglu-fusion --no-activation-func-clamp-shared-expert" + + +def model_args( + nlayers: int | None = None, rotary_scaling_factor: str | None = None, compress_ratios: str = COMPRESS_RATIOS +) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 43) + rotary_scaling_factor = ( + rotary_scaling_factor if rotary_scaling_factor is not None else os.environ.get("ROTARY_SCALING_FACTOR") or "16" + ) + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 4096 " + "--ffn-hidden-size 2048 " + "--num-attention-heads 64 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 129280 " + "--hidden-dropout 0.0 " + "--attention-dropout 0.0 " + # MLA params (reused by V4) + "--multi-latent-attention " + "--q-lora-rank 1024 " + "--kv-lora-rank 512 " + "--qk-head-dim 512 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 512 " + "--qk-layernorm " + f"--rotary-scaling-factor {rotary_scaling_factor} " + "--rotary-base 10000 " + "--original-max-position-embeddings 65536 " + "--beta-fast 32 " + "--beta-slow 1 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # MoE + "--num-experts 256 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=0)} " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 6 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sqrtsoftplus " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 1.5 " + # DSV4 specific + "--experimental-attention-variant dsv4 " + "--dsv4-hc-mult 4 " + "--dsv4-hc-sinkhorn-iters 20 " + f"--dsv4-compress-ratios {compress_ratios} " + "--dsv4-compress-rope-theta 160000 " + "--dsv4-o-groups 8 " + "--dsv4-o-lora-rank 1024 " + "--dsv4-n-hash-layers 3 " + "--dsv4-window-size 128 " + # DSA Indexer + "--dsa-indexer-n-heads 64 " + "--dsa-indexer-head-dim 128 " + "--dsa-indexer-topk 512 " + # V4 model spec (plugin) + "--spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec " + f"{SWIGLU_LIMIT_ARGS} " + ) diff --git a/scripts/models/deepseek-v4-flash.sh b/scripts/models/deepseek-v4-flash.sh deleted file mode 100644 index 3997290de4..0000000000 --- a/scripts/models/deepseek-v4-flash.sh +++ /dev/null @@ -1,85 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-43}" - -# V4: all layers are MoE -arr=() -for ((i=0; i str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 61) + rotary_scaling_factor = ( + rotary_scaling_factor if rotary_scaling_factor is not None else os.environ.get("ROTARY_SCALING_FACTOR") or "16" + ) + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 7168 " + "--ffn-hidden-size 3072 " + "--num-attention-heads 128 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 129280 " + "--hidden-dropout 0.0 " + "--attention-dropout 0.0 " + # MLA params (reused by V4) + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 512 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 512 " + "--qk-layernorm " + f"--rotary-scaling-factor {rotary_scaling_factor} " + "--rotary-base 10000 " + "--original-max-position-embeddings 65536 " + "--beta-fast 32 " + "--beta-slow 1 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # MoE + "--num-experts 384 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=0)} " + "--moe-ffn-hidden-size 3072 " + "--moe-router-topk 6 " + "--moe-shared-expert-intermediate-size 3072 " + "--moe-router-pre-softmax " + "--moe-router-score-function sqrtsoftplus " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.5 " + # DSV4 specific + "--experimental-attention-variant dsv4 " + "--dsv4-hc-mult 4 " + "--dsv4-hc-sinkhorn-iters 20 " + f"--dsv4-compress-ratios {compress_ratios} " + "--dsv4-compress-rope-theta 160000 " + "--dsv4-o-groups 16 " + "--dsv4-o-lora-rank 1024 " + "--dsv4-n-hash-layers 3 " + "--dsv4-window-size 128 " + # DSA Indexer + "--dsa-indexer-n-heads 64 " + "--dsa-indexer-head-dim 128 " + "--dsa-indexer-topk 1024 " + # V4 model spec (plugin) + "--spec miles_plugins.models.deepseek_v4.deepseek_v4 get_dsv4_spec " + f"{SWIGLU_LIMIT_ARGS} " + ) diff --git a/scripts/models/deepseek-v4-pro.sh b/scripts/models/deepseek-v4-pro.sh deleted file mode 100644 index 067d887d96..0000000000 --- a/scripts/models/deepseek-v4-pro.sh +++ /dev/null @@ -1,85 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-61}" - -# V4: all layers are MoE -arr=() -for ((i=0; i str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 8 " + "--kv-channels 256 " + "--num-layers 30 " + "--hidden-size 2816 " + "--ffn-hidden-size 2112 " + "--normalization RMSNorm " + "--norm-epsilon 1e-06 " + "--position-embedding-type rope " + "--rotary-base 1000000 " + "--vocab-size 262144 " + "--make-vocab-size-divisible-by 128 " + "--max-position-embeddings 262144 " + # tied embeddings: do not pass --untie-embeddings-and-output-weights + "--num-experts 128 " + "--moe-router-topk 8 " + "--moe-ffn-hidden-size 704 " + "--moe-router-score-function softmax " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + "--moe-router-num-groups 1 " + "--moe-router-group-topk 1 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-bias-update-rate 0 " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/gemma-4-26b-a4b-it.sh b/scripts/models/gemma-4-26b-a4b-it.sh deleted file mode 100644 index 63fcee4654..0000000000 --- a/scripts/models/gemma-4-26b-a4b-it.sh +++ /dev/null @@ -1,32 +0,0 @@ -# Google Gemma-4 26B-A4B-it (BF16, MoE: 128 experts, top-k 8). - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 16 - --num-query-groups 8 - --kv-channels 256 - --num-layers 30 - --hidden-size 2816 - --ffn-hidden-size 2112 - --normalization RMSNorm - --norm-epsilon 1e-06 - --position-embedding-type rope - --rotary-base 1000000 - --vocab-size 262144 - --make-vocab-size-divisible-by 128 - --max-position-embeddings 262144 - # tied embeddings: do not pass --untie-embeddings-and-output-weights - - --num-experts 128 - --moe-router-topk 8 - --moe-ffn-hidden-size 704 - --moe-router-score-function softmax - --moe-grouped-gemm - --moe-router-dtype fp32 - --moe-router-num-groups 1 - --moe-router-group-topk 1 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-bias-update-rate 0 - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/gemma-4-31b-it.py b/scripts/models/gemma-4-31b-it.py new file mode 100644 index 0000000000..bc1ce66293 --- /dev/null +++ b/scripts/models/gemma-4-31b-it.py @@ -0,0 +1,19 @@ +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 32 " + "--num-query-groups 16 " + "--kv-channels 256 " + "--num-layers 60 " + "--hidden-size 5376 " + "--ffn-hidden-size 21504 " + "--normalization RMSNorm " + "--norm-epsilon 1e-06 " + "--position-embedding-type rope " + "--rotary-base 1000000 " + "--vocab-size 262144 " + "--make-vocab-size-divisible-by 128 " + "--max-position-embeddings 262144 " + # tied embeddings: do not pass --untie-embeddings-and-output-weights + ) diff --git a/scripts/models/gemma-4-31b-it.sh b/scripts/models/gemma-4-31b-it.sh deleted file mode 100644 index 3a65ddb1f5..0000000000 --- a/scripts/models/gemma-4-31b-it.sh +++ /dev/null @@ -1,20 +0,0 @@ -# Google Gemma-4 31B-it (BF16, DENSE — no experts). - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 32 - --num-query-groups 16 - --kv-channels 256 - --num-layers 60 - --hidden-size 5376 - --ffn-hidden-size 21504 - --normalization RMSNorm - --norm-epsilon 1e-06 - --position-embedding-type rope - --rotary-base 1000000 - --vocab-size 262144 - --make-vocab-size-divisible-by 128 - --max-position-embeddings 262144 - # tied embeddings: do not pass --untie-embeddings-and-output-weights -) diff --git a/scripts/models/glm4-32B.py b/scripts/models/glm4-32B.py new file mode 100644 index 0000000000..53613b2065 --- /dev/null +++ b/scripts/models/glm4-32B.py @@ -0,0 +1,25 @@ +def model_args() -> str: + return ( + "--spec miles_plugins.models.glm4 get_glm_spec " + "--swiglu " + "--num-layers 64 " + "--hidden-size 6144 " + "--ffn-hidden-size 23040 " + "--num-attention-heads 48 " + "--max-position-embeddings 32768 " + "--seq-length 32768 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 10000 " + "--group-query-attention " + "--num-query-groups 8 " + "--vocab-size 151552 " + "--post-self-attn-layernorm " + "--post-mlp-layernorm " + "--rotary-interleaved " + "--rotary-percent 0.5 " + "--no-rope-fusion " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/glm4-32B.sh b/scripts/models/glm4-32B.sh deleted file mode 100644 index 15cf273fc9..0000000000 --- a/scripts/models/glm4-32B.sh +++ /dev/null @@ -1,24 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.glm4" "get_glm_spec" - --swiglu - --num-layers 64 - --hidden-size 6144 - --ffn-hidden-size 23040 - --num-attention-heads 48 - --max-position-embeddings 32768 - --seq-length 32768 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 10000 - --group-query-attention - --num-query-groups 8 - --vocab-size 151552 - --post-self-attn-layernorm - --post-mlp-layernorm - --rotary-interleaved - --rotary-percent 0.5 - --no-rope-fusion - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/glm4-9B.py b/scripts/models/glm4-9B.py new file mode 100644 index 0000000000..0c320b91f6 --- /dev/null +++ b/scripts/models/glm4-9B.py @@ -0,0 +1,24 @@ +def model_args() -> str: + return ( + "--spec miles_plugins.models.glm4 get_glm_spec " + "--swiglu " + "--num-layers 40 " + "--hidden-size 4096 " + "--ffn-hidden-size 13696 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 2 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 10000 " + "--vocab-size 151552 " + "--post-self-attn-layernorm " + "--post-mlp-layernorm " + "--rotary-interleaved " + "--rotary-percent 0.5 " + "--no-rope-fusion " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/glm4-9B.sh b/scripts/models/glm4-9B.sh deleted file mode 100644 index 652b579cf2..0000000000 --- a/scripts/models/glm4-9B.sh +++ /dev/null @@ -1,23 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.glm4" "get_glm_spec" - --swiglu - --num-layers 40 - --hidden-size 4096 - --ffn-hidden-size 13696 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 2 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 10000 - --vocab-size 151552 - --post-self-attn-layernorm - --post-mlp-layernorm - --rotary-interleaved - --rotary-percent 0.5 - --no-rope-fusion - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/glm4.5-106B-A12B.py b/scripts/models/glm4.5-106B-A12B.py new file mode 100644 index 0000000000..ba7617c98c --- /dev/null +++ b/scripts/models/glm4.5-106B-A12B.py @@ -0,0 +1,39 @@ +N_DENSE_LAYERS = 1 +N_MOE_LAYERS = 45 + + +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 96 " + "--num-query-groups 8 " + "--kv-channels 128 " + f"--num-layers {N_DENSE_LAYERS + N_MOE_LAYERS} " + "--hidden-size 4096 " + "--ffn-hidden-size 10944 " + "--add-qkv-bias " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--rotary-percent 0.5 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 151552 " + "--rotary-base 1000000 " + # moe + "--moe-ffn-hidden-size 1408 " + "--moe-shared-expert-intermediate-size 1408 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{N_MOE_LAYERS} " + "--num-experts 128 " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/glm4.5-106B-A12B.sh b/scripts/models/glm4.5-106B-A12B.sh deleted file mode 100644 index 8c24416433..0000000000 --- a/scripts/models/glm4.5-106B-A12B.sh +++ /dev/null @@ -1,40 +0,0 @@ -N_DENSE_LAYERS=1 -N_MOE_LAYERS=45 - -# glm4.5-106B-A12B -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 96 - --num-query-groups 8 - --kv-channels 128 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size 4096 - --ffn-hidden-size 10944 - - --add-qkv-bias - --normalization RMSNorm - --position-embedding-type rope - --rotary-percent 0.5 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 151552 - --rotary-base 1000000 - - # moe - --moe-ffn-hidden-size 1408 - --moe-shared-expert-intermediate-size 1408 - --moe-router-pre-softmax - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-token-dispatcher-type alltoall - --moe-router-topk 8 - --moe-layer-freq "[0]*$N_DENSE_LAYERS+[1]*$N_MOE_LAYERS" - --num-experts 128 - --moe-grouped-gemm - --moe-router-dtype fp32 - --moe-permute-fusion - --moe-aux-loss-coeff 0 -) \ No newline at end of file diff --git a/scripts/models/glm4.5-355B-A32B.py b/scripts/models/glm4.5-355B-A32B.py new file mode 100644 index 0000000000..7c25722c55 --- /dev/null +++ b/scripts/models/glm4.5-355B-A32B.py @@ -0,0 +1,41 @@ +N_DENSE_LAYERS = 3 +N_MOE_LAYERS = 89 + + +def model_args() -> str: + return ( + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 96 " + "--num-query-groups 8 " + "--kv-channels 128 " + f"--num-layers {N_DENSE_LAYERS + N_MOE_LAYERS} " + "--hidden-size 5120 " + "--ffn-hidden-size 12288 " + "--add-qkv-bias " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--rotary-percent 0.5 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 151552 " + "--rotary-base 1000000 " + # moe + "--moe-ffn-hidden-size 1536 " + "--moe-shared-expert-intermediate-size 1536 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + "--moe-router-topk-scaling-factor 2.5 " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{N_MOE_LAYERS} " + "--num-experts 160 " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/glm4.5-355B-A32B.sh b/scripts/models/glm4.5-355B-A32B.sh deleted file mode 100644 index 68b590ed4a..0000000000 --- a/scripts/models/glm4.5-355B-A32B.sh +++ /dev/null @@ -1,43 +0,0 @@ -N_DENSE_LAYERS=3 -N_MOE_LAYERS=89 - -# glm4.5-355B-A32B -MODEL_ARGS=( - --disable-bias-linear - --qk-layernorm - --group-query-attention - --num-attention-heads 96 - --num-query-groups 8 - --kv-channels 128 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size 5120 - --ffn-hidden-size 12288 - - --add-qkv-bias - --normalization RMSNorm - --position-embedding-type rope - --rotary-percent 0.5 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 151552 - - --rotary-base 1000000 - - # moe - --moe-ffn-hidden-size 1536 - --moe-shared-expert-intermediate-size 1536 - --moe-router-pre-softmax - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-token-dispatcher-type alltoall - --moe-router-topk 8 - --moe-router-topk-scaling-factor 2.5 - --moe-layer-freq "[0]*$N_DENSE_LAYERS+[1]*$N_MOE_LAYERS" - --num-experts 160 - --moe-grouped-gemm - --moe-router-dtype fp32 - --moe-permute-fusion - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/glm4.7-flash.py b/scripts/models/glm4.7-flash.py new file mode 100644 index 0000000000..24363d671b --- /dev/null +++ b/scripts/models/glm4.7-flash.py @@ -0,0 +1,55 @@ +MOE_ROUTED_EXPERTS = 64 +MOE_ACTIVE_ROUTED_EXPERTS = 4 +MOE_SHARED_EXPERTS = 1 +NHIDDEN = 2048 +MOE_FFN_HIDDEN = 1536 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +FFN_HIDDEN = 10240 +N_DENSE_LAYERS = 1 +N_MOE_LAYERS = 46 +NHEADS = 20 + + +def model_args() -> str: + return ( + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{N_MOE_LAYERS} " + f"--num-experts {MOE_ROUTED_EXPERTS} " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + f"--moe-router-topk {MOE_ACTIVE_ROUTED_EXPERTS} " + "--moe-grouped-gemm " + "--moe-permute-fusion " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-score-function sigmoid " + "--moe-router-pre-softmax " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-topk-scaling-factor 1.8 " + "--moe-aux-loss-coeff 0 " + "--moe-router-dtype fp32 " + "--make-vocab-size-divisible-by 64 " + f"--num-layers {N_DENSE_LAYERS + N_MOE_LAYERS} " + f"--hidden-size {NHIDDEN} " + f"--ffn-hidden-size {FFN_HIDDEN} " + f"--num-attention-heads {NHEADS} " + "--disable-bias-linear " + "--add-qkv-bias " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--position-embedding-type rope " + "--no-position-embedding " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--qk-layernorm " + "--multi-latent-attention " + "--q-lora-rank 768 " + "--kv-lora-rank 512 " + "--qk-head-dim 192 " + "--v-head-dim 256 " + "--kv-channels 192 " + "--qk-pos-emb-head-dim 64 " + "--vocab-size 154880 " + "--rotary-base 1000000 " + "--no-rope-fusion " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/glm4.7-flash.sh b/scripts/models/glm4.7-flash.sh deleted file mode 100644 index 763aadc387..0000000000 --- a/scripts/models/glm4.7-flash.sh +++ /dev/null @@ -1,54 +0,0 @@ -MOE_ROUTED_EXPERTS=64 -MOE_ACTIVE_ROUTED_EXPERTS=4 -MOE_SHARED_EXPERTS=1 - -NHIDDEN=2048 -MOE_FFN_HIDDEN=1536 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$((MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS)) -FFN_HIDDEN=10240 -N_DENSE_LAYERS=1 -N_MOE_LAYERS=46 -NHEADS=20 - -MODEL_ARGS=( - --moe-layer-freq "[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" - --num-experts $MOE_ROUTED_EXPERTS - --moe-shared-expert-intermediate-size $MOE_SHARED_EXPERT_INTERMEDIATE_SIZE - --moe-router-topk $MOE_ACTIVE_ROUTED_EXPERTS - --moe-grouped-gemm - --moe-permute-fusion - --moe-ffn-hidden-size $MOE_FFN_HIDDEN - --moe-router-score-function sigmoid - --moe-router-pre-softmax - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-topk-scaling-factor 1.8 - --moe-aux-loss-coeff 0 - --moe-router-dtype fp32 - --make-vocab-size-divisible-by 64 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size $NHIDDEN - --ffn-hidden-size $FFN_HIDDEN - --num-attention-heads $NHEADS - --disable-bias-linear - --add-qkv-bias - --swiglu - --untie-embeddings-and-output-weights - --position-embedding-type rope - --no-position-embedding - --normalization RMSNorm - --norm-epsilon 1e-5 - --qk-layernorm - --multi-latent-attention - --q-lora-rank 768 - --kv-lora-rank 512 - --qk-head-dim 192 - --v-head-dim 256 - --kv-channels 192 - --qk-pos-emb-head-dim 64 - --vocab-size 154880 - --rotary-base 1000000 - --no-rope-fusion - --mtp-num-layers 1 -) \ No newline at end of file diff --git a/scripts/models/glm5-744B-A40B.py b/scripts/models/glm5-744B-A40B.py new file mode 100644 index 0000000000..9869f411e8 --- /dev/null +++ b/scripts/models/glm5-744B-A40B.py @@ -0,0 +1,52 @@ +MOE_ROUTED_EXPERTS = 256 +MOE_ACTIVE_ROUTED_EXPERTS = 8 +MOE_SHARED_EXPERTS = 1 +NHIDDEN = 6144 +MOE_FFN_HIDDEN = 2048 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +FFN_HIDDEN = 12288 +N_DENSE_LAYERS = 3 +NHEADS = 64 + + +def model_args(n_moe_layers: int = 75) -> str: + return ( + "--spec miles_plugins.models.glm5.glm5 get_glm5_spec " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{n_moe_layers} " + f"--num-experts {MOE_ROUTED_EXPERTS} " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + f"--moe-router-topk {MOE_ACTIVE_ROUTED_EXPERTS} " + "--moe-grouped-gemm " + "--moe-permute-fusion " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-score-function sigmoid " + "--moe-router-pre-softmax " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-aux-loss-coeff 0 " + "--moe-router-dtype fp32 " + "--make-vocab-size-divisible-by 16 " + f"--num-layers {N_DENSE_LAYERS + n_moe_layers} " + f"--hidden-size {NHIDDEN} " + f"--ffn-hidden-size {FFN_HIDDEN} " + f"--num-attention-heads {NHEADS} " + "--disable-bias-linear " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--position-embedding-type rope " + "--no-position-embedding " + "--normalization RMSNorm " + "--qk-layernorm " + "--multi-latent-attention " + "--q-lora-rank 2048 " + "--kv-lora-rank 512 " + "--qk-head-dim 192 " + "--v-head-dim 256 " + "--kv-channels 192 " + "--qk-pos-emb-head-dim 64 " + "--vocab-size 154880 " + "--rotary-base 1000000 " + "--enable-experimental " + ) diff --git a/scripts/models/glm5-744B-A40B.sh b/scripts/models/glm5-744B-A40B.sh deleted file mode 100644 index b9241e1a09..0000000000 --- a/scripts/models/glm5-744B-A40B.sh +++ /dev/null @@ -1,52 +0,0 @@ -MOE_ROUTED_EXPERTS=256 -MOE_ACTIVE_ROUTED_EXPERTS=8 -MOE_SHARED_EXPERTS=1 - -NHIDDEN=6144 -MOE_FFN_HIDDEN=2048 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$(($MOE_FFN_HIDDEN * $MOE_SHARED_EXPERTS)) -FFN_HIDDEN=12288 -N_DENSE_LAYERS=3 -N_MOE_LAYERS=75 -NHEADS=64 - -MODEL_ARGS=( - --spec "miles_plugins.models.glm5.glm5" "get_glm5_spec" - --moe-layer-freq "[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" - --num-experts $MOE_ROUTED_EXPERTS - --moe-shared-expert-intermediate-size $MOE_SHARED_EXPERT_INTERMEDIATE_SIZE - --moe-router-topk $MOE_ACTIVE_ROUTED_EXPERTS - --moe-grouped-gemm - --moe-permute-fusion - --moe-ffn-hidden-size $MOE_FFN_HIDDEN - --moe-router-score-function sigmoid - --moe-router-pre-softmax - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-topk-scaling-factor 2.5 - --moe-aux-loss-coeff 0 - --moe-router-dtype fp32 - --make-vocab-size-divisible-by 16 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size $NHIDDEN - --ffn-hidden-size $FFN_HIDDEN - --num-attention-heads $NHEADS - --disable-bias-linear - --swiglu - --untie-embeddings-and-output-weights - --position-embedding-type rope - --no-position-embedding - --normalization RMSNorm - --qk-layernorm - --multi-latent-attention - --q-lora-rank 2048 - --kv-lora-rank 512 - --qk-head-dim 192 - --v-head-dim 256 - --kv-channels 192 - --qk-pos-emb-head-dim 64 - --vocab-size 154880 - --rotary-base 1000000 - --enable-experimental -) \ No newline at end of file diff --git a/scripts/models/glm5-744B-A40B_20layer.py b/scripts/models/glm5-744B-A40B_20layer.py new file mode 100644 index 0000000000..6ec017c981 --- /dev/null +++ b/scripts/models/glm5-744B-A40B_20layer.py @@ -0,0 +1,6 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for 20-layer pruned model (first 20 layers: 3 dense + 17 MoE) + return load_sibling_model_args(__file__, "glm5-744B-A40B", n_moe_layers=17) diff --git a/scripts/models/glm5-744B-A40B_20layer.sh b/scripts/models/glm5-744B-A40B_20layer.sh deleted file mode 100644 index 1eb85223d7..0000000000 --- a/scripts/models/glm5-744B-A40B_20layer.sh +++ /dev/null @@ -1,12 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5-744B-A40B.sh" - -# Override for 20-layer pruned model (first 20 layers: 3 dense + 17 MoE) -N_MOE_LAYERS=17 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done diff --git a/scripts/models/glm5-744B-A40B_4layer.py b/scripts/models/glm5-744B-A40B_4layer.py new file mode 100644 index 0000000000..0a5c3ce562 --- /dev/null +++ b/scripts/models/glm5-744B-A40B_4layer.py @@ -0,0 +1,6 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for 4-layer pruned model (first 4 layers: 3 dense + 1 MoE) + return load_sibling_model_args(__file__, "glm5-744B-A40B", n_moe_layers=1) diff --git a/scripts/models/glm5-744B-A40B_4layer.sh b/scripts/models/glm5-744B-A40B_4layer.sh deleted file mode 100644 index 50f1005632..0000000000 --- a/scripts/models/glm5-744B-A40B_4layer.sh +++ /dev/null @@ -1,12 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5-744B-A40B.sh" - -# Override for 4-layer pruned model (first 4 layers: 3 dense + 1 MoE) -N_MOE_LAYERS=1 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done diff --git a/scripts/models/glm5.1-744B-A40B_6layer.py b/scripts/models/glm5.1-744B-A40B_6layer.py new file mode 100644 index 0000000000..7144d28349 --- /dev/null +++ b/scripts/models/glm5.1-744B-A40B_6layer.py @@ -0,0 +1,7 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for the 6-layer pruned GLM-5.1 toy (jybsuper/GLM-5.1-6layer): + # first 6 layers = 3 dense + 3 MoE. + return load_sibling_model_args(__file__, "glm5-744B-A40B", n_moe_layers=3) diff --git a/scripts/models/glm5.1-744B-A40B_6layer.sh b/scripts/models/glm5.1-744B-A40B_6layer.sh deleted file mode 100644 index a7044d3a43..0000000000 --- a/scripts/models/glm5.1-744B-A40B_6layer.sh +++ /dev/null @@ -1,14 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5-744B-A40B.sh" - -# Override for the 6-layer pruned GLM-5.1 toy (jybsuper/GLM-5.1-6layer): -# first 6 layers = 3 dense + 3 MoE. -N_MOE_LAYERS=3 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done - diff --git a/scripts/models/glm5.1-744B-A40B_6layer_lora.py b/scripts/models/glm5.1-744B-A40B_6layer_lora.py new file mode 100644 index 0000000000..efc537a2ed --- /dev/null +++ b/scripts/models/glm5.1-744B-A40B_6layer_lora.py @@ -0,0 +1,7 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for the 6-layer pruned GLM-5.1 toy (jybsuper/GLM-5.1-6layer): + # first 6 layers = 3 dense + 3 MoE. + return load_sibling_model_args(__file__, "glm5.1-744B-A40B_lora", n_moe_layers=3) diff --git a/scripts/models/glm5.1-744B-A40B_6layer_lora.sh b/scripts/models/glm5.1-744B-A40B_6layer_lora.sh deleted file mode 100644 index 2cac8891ca..0000000000 --- a/scripts/models/glm5.1-744B-A40B_6layer_lora.sh +++ /dev/null @@ -1,13 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5.1-744B-A40B_lora.sh" - -# Override for the 6-layer pruned GLM-5.1 toy (jybsuper/GLM-5.1-6layer): -# first 6 layers = 3 dense + 3 MoE. -N_MOE_LAYERS=3 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done diff --git a/scripts/models/glm5.1-744B-A40B_lora.py b/scripts/models/glm5.1-744B-A40B_lora.py new file mode 100644 index 0000000000..9869f411e8 --- /dev/null +++ b/scripts/models/glm5.1-744B-A40B_lora.py @@ -0,0 +1,52 @@ +MOE_ROUTED_EXPERTS = 256 +MOE_ACTIVE_ROUTED_EXPERTS = 8 +MOE_SHARED_EXPERTS = 1 +NHIDDEN = 6144 +MOE_FFN_HIDDEN = 2048 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +FFN_HIDDEN = 12288 +N_DENSE_LAYERS = 3 +NHEADS = 64 + + +def model_args(n_moe_layers: int = 75) -> str: + return ( + "--spec miles_plugins.models.glm5.glm5 get_glm5_spec " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{n_moe_layers} " + f"--num-experts {MOE_ROUTED_EXPERTS} " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + f"--moe-router-topk {MOE_ACTIVE_ROUTED_EXPERTS} " + "--moe-grouped-gemm " + "--moe-permute-fusion " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-score-function sigmoid " + "--moe-router-pre-softmax " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-aux-loss-coeff 0 " + "--moe-router-dtype fp32 " + "--make-vocab-size-divisible-by 16 " + f"--num-layers {N_DENSE_LAYERS + n_moe_layers} " + f"--hidden-size {NHIDDEN} " + f"--ffn-hidden-size {FFN_HIDDEN} " + f"--num-attention-heads {NHEADS} " + "--disable-bias-linear " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--position-embedding-type rope " + "--no-position-embedding " + "--normalization RMSNorm " + "--qk-layernorm " + "--multi-latent-attention " + "--q-lora-rank 2048 " + "--kv-lora-rank 512 " + "--qk-head-dim 192 " + "--v-head-dim 256 " + "--kv-channels 192 " + "--qk-pos-emb-head-dim 64 " + "--vocab-size 154880 " + "--rotary-base 1000000 " + "--enable-experimental " + ) diff --git a/scripts/models/glm5.1-744B-A40B_lora.sh b/scripts/models/glm5.1-744B-A40B_lora.sh deleted file mode 100644 index 2b77e7c71d..0000000000 --- a/scripts/models/glm5.1-744B-A40B_lora.sh +++ /dev/null @@ -1,58 +0,0 @@ -MOE_ROUTED_EXPERTS=256 -MOE_ACTIVE_ROUTED_EXPERTS=8 -MOE_SHARED_EXPERTS=1 - -NHIDDEN=6144 -MOE_FFN_HIDDEN=2048 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$(($MOE_FFN_HIDDEN * $MOE_SHARED_EXPERTS)) -FFN_HIDDEN=12288 -N_DENSE_LAYERS=3 -N_MOE_LAYERS=75 -NHEADS=64 - -# GLM-5.1 744B-A40B (zai-org/GLM-5.1, glm_moe_dsa). Identical to glm5-744B-A40B.sh; the only -# architecture difference vs the glm5.2-744B-A40B* registries is --rotary-base (5.2 uses 8e6). -MODEL_ARGS=( - --spec "miles_plugins.models.glm5.glm5" "get_glm5_spec" - --moe-layer-freq "[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" - --num-experts $MOE_ROUTED_EXPERTS - --moe-shared-expert-intermediate-size $MOE_SHARED_EXPERT_INTERMEDIATE_SIZE - --moe-router-topk $MOE_ACTIVE_ROUTED_EXPERTS - --moe-grouped-gemm - --moe-permute-fusion - --moe-ffn-hidden-size $MOE_FFN_HIDDEN - --moe-router-score-function sigmoid - --moe-router-pre-softmax - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-topk-scaling-factor 2.5 - --moe-aux-loss-coeff 0 - --moe-router-dtype fp32 - --make-vocab-size-divisible-by 16 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size $NHIDDEN - --ffn-hidden-size $FFN_HIDDEN - --num-attention-heads $NHEADS - --disable-bias-linear - --swiglu - --untie-embeddings-and-output-weights - --position-embedding-type rope - --no-position-embedding - --normalization RMSNorm - --qk-layernorm - --multi-latent-attention - --q-lora-rank 2048 - --kv-lora-rank 512 - --qk-head-dim 192 - --v-head-dim 256 - --kv-channels 192 - --qk-pos-emb-head-dim 64 - --vocab-size 154880 - --rotary-base 1000000 - --enable-experimental -) - -# LoRA registry for scripts/run_glm5_1_744b_a40b_lora.py: MODEL_ARGS carries the architecture only -# (identical to glm5-744B-A40B.sh); every LoRA / run-mode flag lives in the runner, which -# always wins (argparse last-occurrence). --spec above is inert under bridge LoRA. diff --git a/scripts/models/glm5.2-744B-A40B.py b/scripts/models/glm5.2-744B-A40B.py new file mode 100644 index 0000000000..6f582e5559 --- /dev/null +++ b/scripts/models/glm5.2-744B-A40B.py @@ -0,0 +1,52 @@ +MOE_ROUTED_EXPERTS = 256 +MOE_ACTIVE_ROUTED_EXPERTS = 8 +MOE_SHARED_EXPERTS = 1 +NHIDDEN = 6144 +MOE_FFN_HIDDEN = 2048 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +FFN_HIDDEN = 12288 +N_DENSE_LAYERS = 3 +NHEADS = 64 + + +def model_args(n_moe_layers: int = 75) -> str: + return ( + "--spec miles_plugins.models.glm5.glm5 get_glm5_spec " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{n_moe_layers} " + f"--num-experts {MOE_ROUTED_EXPERTS} " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + f"--moe-router-topk {MOE_ACTIVE_ROUTED_EXPERTS} " + "--moe-grouped-gemm " + "--moe-permute-fusion " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-score-function sigmoid " + "--moe-router-pre-softmax " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-aux-loss-coeff 0 " + "--moe-router-dtype fp32 " + "--make-vocab-size-divisible-by 16 " + f"--num-layers {N_DENSE_LAYERS + n_moe_layers} " + f"--hidden-size {NHIDDEN} " + f"--ffn-hidden-size {FFN_HIDDEN} " + f"--num-attention-heads {NHEADS} " + "--disable-bias-linear " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--position-embedding-type rope " + "--no-position-embedding " + "--normalization RMSNorm " + "--qk-layernorm " + "--multi-latent-attention " + "--q-lora-rank 2048 " + "--kv-lora-rank 512 " + "--qk-head-dim 192 " + "--v-head-dim 256 " + "--kv-channels 192 " + "--qk-pos-emb-head-dim 64 " + "--vocab-size 154880 " + "--rotary-base 8000000 " + "--enable-experimental " + ) diff --git a/scripts/models/glm5.2-744B-A40B.sh b/scripts/models/glm5.2-744B-A40B.sh deleted file mode 100644 index 2b831c6f18..0000000000 --- a/scripts/models/glm5.2-744B-A40B.sh +++ /dev/null @@ -1,59 +0,0 @@ -MOE_ROUTED_EXPERTS=256 -MOE_ACTIVE_ROUTED_EXPERTS=8 -MOE_SHARED_EXPERTS=1 - -NHIDDEN=6144 -MOE_FFN_HIDDEN=2048 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$(($MOE_FFN_HIDDEN * $MOE_SHARED_EXPERTS)) -FFN_HIDDEN=12288 -N_DENSE_LAYERS=3 -N_MOE_LAYERS=75 -NHEADS=64 - -# GLM-5.2 744B-A40B with DSA cross-layer index sharing. Only the computing layers -# (1,2,3,7,11,...,75 in Megatron 1-indexing) carry indexer weights and compute the -# sparse top-k; the remaining layers reuse the most recent computing layer's indices. -# The schedule (index_topk_freq=4, index_skip_topk_offset=3) is read from the HF config -# by the shared glm5 provider; cross-layer sharing activates when index_topk_freq > 1. -# allgather-CP is enabled at train time in the run script (not here) so that checkpoint -# conversion does not need to parse it. Differs from glm5-744B-A40B.sh only in rotary-base. -MODEL_ARGS=( - --spec "miles_plugins.models.glm5.glm5" "get_glm5_spec" - --moe-layer-freq "[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" - --num-experts $MOE_ROUTED_EXPERTS - --moe-shared-expert-intermediate-size $MOE_SHARED_EXPERT_INTERMEDIATE_SIZE - --moe-router-topk $MOE_ACTIVE_ROUTED_EXPERTS - --moe-grouped-gemm - --moe-permute-fusion - --moe-ffn-hidden-size $MOE_FFN_HIDDEN - --moe-router-score-function sigmoid - --moe-router-pre-softmax - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-topk-scaling-factor 2.5 - --moe-aux-loss-coeff 0 - --moe-router-dtype fp32 - --make-vocab-size-divisible-by 16 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size $NHIDDEN - --ffn-hidden-size $FFN_HIDDEN - --num-attention-heads $NHEADS - --disable-bias-linear - --swiglu - --untie-embeddings-and-output-weights - --position-embedding-type rope - --no-position-embedding - --normalization RMSNorm - --qk-layernorm - --multi-latent-attention - --q-lora-rank 2048 - --kv-lora-rank 512 - --qk-head-dim 192 - --v-head-dim 256 - --kv-channels 192 - --qk-pos-emb-head-dim 64 - --vocab-size 154880 - --rotary-base 8000000 - --enable-experimental -) diff --git a/scripts/models/glm5.2-744B-A40B_5layer.py b/scripts/models/glm5.2-744B-A40B_5layer.py new file mode 100644 index 0000000000..35f03c3b9b --- /dev/null +++ b/scripts/models/glm5.2-744B-A40B_5layer.py @@ -0,0 +1,8 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for 5-layer pruned model (first 5 layers: 3 dense + 2 MoE). + # Keeps at least one computing + one skip layer so the DSA cross-layer index + # sharing path is exercised (computing layers 0,1,2; skip layers 3,4). + return load_sibling_model_args(__file__, "glm5.2-744B-A40B", n_moe_layers=2) diff --git a/scripts/models/glm5.2-744B-A40B_5layer.sh b/scripts/models/glm5.2-744B-A40B_5layer.sh deleted file mode 100644 index f98c2c3ed9..0000000000 --- a/scripts/models/glm5.2-744B-A40B_5layer.sh +++ /dev/null @@ -1,14 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5.2-744B-A40B.sh" - -# Override for 5-layer pruned model (first 5 layers: 3 dense + 2 MoE). -# Keeps at least one computing + one skip layer so the DSA cross-layer index -# sharing path is exercised (computing layers 0,1,2; skip layers 3,4). -N_MOE_LAYERS=2 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done diff --git a/scripts/models/glm5.2-744B-A40B_5layer_lora.py b/scripts/models/glm5.2-744B-A40B_5layer_lora.py new file mode 100644 index 0000000000..0df3cf9e29 --- /dev/null +++ b/scripts/models/glm5.2-744B-A40B_5layer_lora.py @@ -0,0 +1,7 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + # Override for the 5-layer pruned model (first 5 layers: 3 dense + 2 MoE). Keeps at least + # one computing + one skip layer so the DSA cross-layer index sharing path is exercised. + return load_sibling_model_args(__file__, "glm5.2-744B-A40B_lora", n_moe_layers=2) diff --git a/scripts/models/glm5.2-744B-A40B_5layer_lora.sh b/scripts/models/glm5.2-744B-A40B_5layer_lora.sh deleted file mode 100644 index 8da4e10f6e..0000000000 --- a/scripts/models/glm5.2-744B-A40B_5layer_lora.sh +++ /dev/null @@ -1,13 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/glm5.2-744B-A40B_lora.sh" - -# Override for the 5-layer pruned model (first 5 layers: 3 dense + 2 MoE). Keeps at least -# one computing + one skip layer so the DSA cross-layer index sharing path is exercised. -N_MOE_LAYERS=2 - -for ((i=0; i<${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i+1))]=$((N_DENSE_LAYERS + N_MOE_LAYERS)) ;; - --moe-layer-freq) MODEL_ARGS[$((i+1))]="[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" ;; - esac -done diff --git a/scripts/models/glm5.2-744B-A40B_lora.py b/scripts/models/glm5.2-744B-A40B_lora.py new file mode 100644 index 0000000000..6f582e5559 --- /dev/null +++ b/scripts/models/glm5.2-744B-A40B_lora.py @@ -0,0 +1,52 @@ +MOE_ROUTED_EXPERTS = 256 +MOE_ACTIVE_ROUTED_EXPERTS = 8 +MOE_SHARED_EXPERTS = 1 +NHIDDEN = 6144 +MOE_FFN_HIDDEN = 2048 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +FFN_HIDDEN = 12288 +N_DENSE_LAYERS = 3 +NHEADS = 64 + + +def model_args(n_moe_layers: int = 75) -> str: + return ( + "--spec miles_plugins.models.glm5.glm5 get_glm5_spec " + f"--moe-layer-freq [0]*{N_DENSE_LAYERS}+[1]*{n_moe_layers} " + f"--num-experts {MOE_ROUTED_EXPERTS} " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + f"--moe-router-topk {MOE_ACTIVE_ROUTED_EXPERTS} " + "--moe-grouped-gemm " + "--moe-permute-fusion " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-score-function sigmoid " + "--moe-router-pre-softmax " + "--moe-router-enable-expert-bias " + "--moe-router-bias-update-rate 0 " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-aux-loss-coeff 0 " + "--moe-router-dtype fp32 " + "--make-vocab-size-divisible-by 16 " + f"--num-layers {N_DENSE_LAYERS + n_moe_layers} " + f"--hidden-size {NHIDDEN} " + f"--ffn-hidden-size {FFN_HIDDEN} " + f"--num-attention-heads {NHEADS} " + "--disable-bias-linear " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--position-embedding-type rope " + "--no-position-embedding " + "--normalization RMSNorm " + "--qk-layernorm " + "--multi-latent-attention " + "--q-lora-rank 2048 " + "--kv-lora-rank 512 " + "--qk-head-dim 192 " + "--v-head-dim 256 " + "--kv-channels 192 " + "--qk-pos-emb-head-dim 64 " + "--vocab-size 154880 " + "--rotary-base 8000000 " + "--enable-experimental " + ) diff --git a/scripts/models/glm5.2-744B-A40B_lora.sh b/scripts/models/glm5.2-744B-A40B_lora.sh deleted file mode 100644 index c9d2d4971f..0000000000 --- a/scripts/models/glm5.2-744B-A40B_lora.sh +++ /dev/null @@ -1,58 +0,0 @@ -MOE_ROUTED_EXPERTS=256 -MOE_ACTIVE_ROUTED_EXPERTS=8 -MOE_SHARED_EXPERTS=1 - -NHIDDEN=6144 -MOE_FFN_HIDDEN=2048 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$(($MOE_FFN_HIDDEN * $MOE_SHARED_EXPERTS)) -FFN_HIDDEN=12288 -N_DENSE_LAYERS=3 -N_MOE_LAYERS=75 -NHEADS=64 - -# GLM-5.2 744B-A40B (DSA cross-layer index sharing; the schedule is read from the HF config -# by the shared glm5 provider). Differs from glm5-744B-A40B.sh only in rotary-base. -MODEL_ARGS=( - --spec "miles_plugins.models.glm5.glm5" "get_glm5_spec" - --moe-layer-freq "[0]*${N_DENSE_LAYERS}+[1]*${N_MOE_LAYERS}" - --num-experts $MOE_ROUTED_EXPERTS - --moe-shared-expert-intermediate-size $MOE_SHARED_EXPERT_INTERMEDIATE_SIZE - --moe-router-topk $MOE_ACTIVE_ROUTED_EXPERTS - --moe-grouped-gemm - --moe-permute-fusion - --moe-ffn-hidden-size $MOE_FFN_HIDDEN - --moe-router-score-function sigmoid - --moe-router-pre-softmax - --moe-router-enable-expert-bias - --moe-router-bias-update-rate 0 - --moe-router-load-balancing-type seq_aux_loss - --moe-router-topk-scaling-factor 2.5 - --moe-aux-loss-coeff 0 - --moe-router-dtype fp32 - --make-vocab-size-divisible-by 16 - --num-layers $((N_DENSE_LAYERS + N_MOE_LAYERS)) - --hidden-size $NHIDDEN - --ffn-hidden-size $FFN_HIDDEN - --num-attention-heads $NHEADS - --disable-bias-linear - --swiglu - --untie-embeddings-and-output-weights - --position-embedding-type rope - --no-position-embedding - --normalization RMSNorm - --qk-layernorm - --multi-latent-attention - --q-lora-rank 2048 - --kv-lora-rank 512 - --qk-head-dim 192 - --v-head-dim 256 - --kv-channels 192 - --qk-pos-emb-head-dim 64 - --vocab-size 154880 - --rotary-base 8000000 - --enable-experimental -) - -# LoRA registry for scripts/run_glm5_2_744b_a40b_lora.py: MODEL_ARGS carries the architecture only -# (identical to glm5.2-744B-A40B.sh); every LoRA / run-mode flag lives in the runner, which -# always wins (argparse last-occurrence). --spec above is inert under bridge LoRA. diff --git a/scripts/models/gpt-oss-20b.py b/scripts/models/gpt-oss-20b.py new file mode 100644 index 0000000000..18009a85e9 --- /dev/null +++ b/scripts/models/gpt-oss-20b.py @@ -0,0 +1,40 @@ +def model_args() -> str: + return ( + # Base architecture + "--num-layers 24 " + "--hidden-size 2880 " + "--ffn-hidden-size 2880 " + "--num-attention-heads 64 " + "--group-query-attention " + "--num-query-groups 8 " + "--kv-channels 64 " + # Positional embeddings + "--use-rotary-position-embeddings " + "--rotary-percent 1.0 " + "--rotary-base 150000 " + # Train with a 4k context, but keep max positions aligned with the HF checkpoint (YaRN scaling). + "--max-position-embeddings 131072 " + # Normalization + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + # Activation & embeddings + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 201088 " + # Note: attention_bias is true in HF config, so we may need bias + # --disable-bias-linear # commented out since attention_bias=true + # Sliding window attention + learnable softmax offset (alternating SWA/full attention). + "--softmax-type learnable " + "--window-size 128,0 " + "--window-attn-skip-freq 2 " + # Fusions can be incompatible with this attention pattern on some stacks. + "--no-masked-softmax-fusion " + "--no-rope-fusion " + # MoE parameters + "--num-experts 32 " + "--moe-router-topk 4 " + "--moe-aux-loss-coeff 0.0 " + "--moe-token-dispatcher-type alltoall " + "--moe-router-dtype fp32 " + "--moe-grouped-gemm " + ) diff --git a/scripts/models/gpt-oss-20b.sh b/scripts/models/gpt-oss-20b.sh deleted file mode 100644 index c1184f515a..0000000000 --- a/scripts/models/gpt-oss-20b.sh +++ /dev/null @@ -1,48 +0,0 @@ -# gpt-oss-20b model architecture -# Expected to match HF config for gpt-oss-20b-BF16 (MoE + sliding window attention). - -MODEL_ARGS=( - # Base architecture - --num-layers 24 - --hidden-size 2880 - --ffn-hidden-size 2880 - --num-attention-heads 64 - --group-query-attention - --num-query-groups 8 - --kv-channels 64 - - # Positional embeddings - --use-rotary-position-embeddings - --rotary-percent 1.0 - --rotary-base 150000 - # Train with a 4k context, but keep max positions aligned with the HF checkpoint (YaRN scaling). - --max-position-embeddings 131072 - - # Normalization - --normalization "RMSNorm" - --norm-epsilon 1e-5 - - # Activation & embeddings - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 201088 - - # Note: attention_bias is true in HF config, so we may need bias - # --disable-bias-linear # commented out since attention_bias=true - - # Sliding window attention + learnable softmax offset (alternating SWA/full attention). - --softmax-type learnable - --window-size 128,0 - --window-attn-skip-freq 2 - # Fusions can be incompatible with this attention pattern on some stacks. - --no-masked-softmax-fusion - --no-rope-fusion - - # MoE parameters - --num-experts 32 - --moe-router-topk 4 - --moe-aux-loss-coeff 0.0 - --moe-token-dispatcher-type alltoall - --moe-router-dtype fp32 - --moe-grouped-gemm -) diff --git a/scripts/models/inkling-small.py b/scripts/models/inkling-small.py new file mode 100644 index 0000000000..e1d0226515 --- /dev/null +++ b/scripts/models/inkling-small.py @@ -0,0 +1,44 @@ +import os + + +def model_args(nlayers: int | None = None) -> str: + # Inkling-Small 276B config (42 layers; derived from the HF config the same way + # inkling.py maps the Inkling one). + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 42) + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 4096 " + "--ffn-hidden-size 2048 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 8 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 201024 " + "--hidden-dropout 0.0 " + "--attention-dropout 0.0 " + "--attention-softmax-in-fp32 " + "--position-embedding-type none " + "--no-rope-fusion " + "--no-masked-softmax-fusion " + "--max-position-embeddings 1048576 " + # MoE + "--num-experts 256 " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 6 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-grouped-gemm " + "--qk-layernorm " + # Inkling model provider + "--custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider " + ) diff --git a/scripts/models/inkling-small.sh b/scripts/models/inkling-small.sh deleted file mode 100644 index 10131973de..0000000000 --- a/scripts/models/inkling-small.sh +++ /dev/null @@ -1,43 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-42}" - -# Inkling-Small 276B config (42 layers; derived from the HF config the same way -# inkling.sh maps the Inkling one). -MODEL_ARGS=( - --disable-bias-linear - --num-layers $NLAYERS - --hidden-size 4096 - --ffn-hidden-size 2048 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 8 - --kv-channels 128 - --normalization RMSNorm - --norm-epsilon 1e-6 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 201024 - --hidden-dropout 0.0 - --attention-dropout 0.0 - --attention-softmax-in-fp32 - --position-embedding-type none - --no-rope-fusion - --no-masked-softmax-fusion - --max-position-embeddings 1048576 - - # MoE - --num-experts 256 - --moe-ffn-hidden-size 2048 - --moe-router-topk 6 - --moe-shared-expert-intermediate-size 2048 - --moe-router-pre-softmax - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-router-load-balancing-type seq_aux_loss - --moe-token-dispatcher-type alltoall - --moe-aux-loss-coeff 0 - --moe-grouped-gemm - --qk-layernorm - - # Inkling model provider - --custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider -) diff --git a/scripts/models/inkling.py b/scripts/models/inkling.py new file mode 100644 index 0000000000..d5b2e72628 --- /dev/null +++ b/scripts/models/inkling.py @@ -0,0 +1,43 @@ +import os + + +def model_args(nlayers: int | None = None) -> str: + # Inkling config (66L full model; set MODEL_ARGS_NUM_LAYERS=4 for the 4-layer slice) + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 66) + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 6144 " + "--ffn-hidden-size 3072 " + "--num-attention-heads 64 " + "--group-query-attention " + "--num-query-groups 8 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 201024 " + "--hidden-dropout 0.0 " + "--attention-dropout 0.0 " + "--attention-softmax-in-fp32 " + "--position-embedding-type none " + "--no-rope-fusion " + "--no-masked-softmax-fusion " + "--max-position-embeddings 1048576 " + # MoE + "--num-experts 256 " + "--moe-ffn-hidden-size 3072 " + "--moe-router-topk 6 " + "--moe-shared-expert-intermediate-size 3072 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-grouped-gemm " + "--qk-layernorm " + # Inkling model provider + "--custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider " + ) diff --git a/scripts/models/inkling.sh b/scripts/models/inkling.sh deleted file mode 100644 index 313f4a3db8..0000000000 --- a/scripts/models/inkling.sh +++ /dev/null @@ -1,42 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-66}" - -# Inkling config (66L full model; set MODEL_ARGS_NUM_LAYERS=4 for the 4-layer slice) -MODEL_ARGS=( - --disable-bias-linear - --num-layers $NLAYERS - --hidden-size 6144 - --ffn-hidden-size 3072 - --num-attention-heads 64 - --group-query-attention - --num-query-groups 8 - --kv-channels 128 - --normalization RMSNorm - --norm-epsilon 1e-6 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 201024 - --hidden-dropout 0.0 - --attention-dropout 0.0 - --attention-softmax-in-fp32 - --position-embedding-type none - --no-rope-fusion - --no-masked-softmax-fusion - --max-position-embeddings 1048576 - - # MoE - --num-experts 256 - --moe-ffn-hidden-size 3072 - --moe-router-topk 6 - --moe-shared-expert-intermediate-size 3072 - --moe-router-pre-softmax - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-router-load-balancing-type seq_aux_loss - --moe-token-dispatcher-type alltoall - --moe-aux-loss-coeff 0 - --moe-grouped-gemm - --qk-layernorm - - # Inkling model provider - --custom-model-provider-path miles_plugins.models.inkling.model.inkling_model_provider -) diff --git a/scripts/models/joyai-llm-flash.py b/scripts/models/joyai-llm-flash.py new file mode 100644 index 0000000000..14296e4502 --- /dev/null +++ b/scripts/models/joyai-llm-flash.py @@ -0,0 +1,55 @@ +import os + +from model_args_utils import moe_layer_freq + + +FIRST_K_DENSE_REPLACE = 1 + + +def model_args(nlayers: int | None = None, rotary_base: str | None = None) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 40) + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "32000000" + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 2048 " + "--ffn-hidden-size 7168 " + "--num-attention-heads 32 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 129280 " + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + f"--rotary-base {rotary_base} " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + "--num-experts 256 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--moe-ffn-hidden-size 768 " + "--moe-router-topk 8 " + "--moe-shared-expert-intermediate-size 768 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 1 " + "--moe-router-num-groups 1 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/joyai-llm-flash.sh b/scripts/models/joyai-llm-flash.sh deleted file mode 100644 index 8a2b28c537..0000000000 --- a/scripts/models/joyai-llm-flash.sh +++ /dev/null @@ -1,60 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-40}" -FIRST_K_DENSE_REPLACE=1 - -arr=() -for ((i=0; i str: + return ( + "--disable-bias-linear " + f"--num-layers {nlayers} " + "--hidden-size 7168 " + "--ffn-hidden-size 18432 " + "--num-attention-heads 64 " + "--kv-channels 64 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-5 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 163840 " + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + "--rotary-scaling-factor 64.0 " + "--rotary-base 50000 " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # moe + "--num-experts 384 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=first_k_dense_replace)} " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 8 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 1 " + "--moe-router-num-groups 1 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.827 " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/kimi-k2-thinking.sh b/scripts/models/kimi-k2-thinking.sh deleted file mode 100644 index b7fceda591..0000000000 --- a/scripts/models/kimi-k2-thinking.sh +++ /dev/null @@ -1,63 +0,0 @@ -NLAYERS=61 -FIRST_K_DENSE_REPLACE=1 - -arr=() -for ((i=0; i str: + return ( + "--disable-bias-linear " + "--num-layers 61 " + "--hidden-size 7168 " + "--ffn-hidden-size 18432 " + "--num-attention-heads 64 " + "--kv-channels 64 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 163840 " + "--multi-latent-attention " + "--q-lora-rank 1536 " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + "--rotary-scaling-factor 32.0 " + "--rotary-base 50000 " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # moe + "--num-experts 384 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--moe-ffn-hidden-size 2048 " + "--moe-router-topk 8 " + "--moe-shared-expert-intermediate-size 2048 " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 1 " + "--moe-router-num-groups 1 " + "--moe-grouped-gemm " + "--moe-router-topk-scaling-factor 2.827 " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/kimi-k2.sh b/scripts/models/kimi-k2.sh deleted file mode 100644 index eafb7acadd..0000000000 --- a/scripts/models/kimi-k2.sh +++ /dev/null @@ -1,63 +0,0 @@ -NLAYERS=61 -FIRST_K_DENSE_REPLACE=1 - -arr=() -for ((i=0; i str: + # Override for the 2-layer pruned debugging model (first_k_dense_replace=1): + # 1 dense layer + 1 MoE layer. Architecture is otherwise identical to the full + # Kimi-K2.5 / K2-Thinking, so we reuse those MODEL_ARGS and only patch the + # layer count and the MoE-layer-frequency mask. + return load_sibling_model_args(__file__, "kimi-k2-thinking", nlayers=2, first_k_dense_replace=1) diff --git a/scripts/models/kimi-k25_2layer.sh b/scripts/models/kimi-k25_2layer.sh deleted file mode 100644 index f57c207b3a..0000000000 --- a/scripts/models/kimi-k25_2layer.sh +++ /dev/null @@ -1,26 +0,0 @@ -SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/kimi-k2-thinking.sh" - -# Override for the 2-layer pruned debugging model (first_k_dense_replace=1): -# 1 dense layer + 1 MoE layer. Architecture is otherwise identical to the full -# Kimi-K2.5 / K2-Thinking, so we reuse those MODEL_ARGS and only patch the -# layer count and the MoE-layer-frequency mask. -NLAYERS=2 -FIRST_K_DENSE_REPLACE=1 - -arr=() -for ((i = 0; i < NLAYERS; i++)); do - if ((i < FIRST_K_DENSE_REPLACE)); then - arr+=(0) - else - arr+=(1) - fi -done -printf -v MOE_LAYER_FREQ "[%s]" "$(IFS=', '; echo "${arr[*]}")" - -for ((i = 0; i < ${#MODEL_ARGS[@]}; i++)); do - case "${MODEL_ARGS[$i]}" in - --num-layers) MODEL_ARGS[$((i + 1))]=$NLAYERS ;; - --moe-layer-freq) MODEL_ARGS[$((i + 1))]="$MOE_LAYER_FREQ" ;; - esac -done diff --git a/scripts/models/llama3.1-8B-Instruct.py b/scripts/models/llama3.1-8B-Instruct.py new file mode 100644 index 0000000000..1375255d84 --- /dev/null +++ b/scripts/models/llama3.1-8B-Instruct.py @@ -0,0 +1,21 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 32 " + "--hidden-size 4096 " + "--ffn-hidden-size 14336 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 8 " + "--max-position-embeddings 131072 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 500000 " + "--vocab-size 128256 " + "--kv-channels 128 " + "--use-rope-scaling " + "--rotary-scaling-factor 8.0 " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/llama3.1-8B-Instruct.sh b/scripts/models/llama3.1-8B-Instruct.sh deleted file mode 100644 index 0815b3e0a3..0000000000 --- a/scripts/models/llama3.1-8B-Instruct.sh +++ /dev/null @@ -1,20 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 32 - --hidden-size 4096 - --ffn-hidden-size 14336 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 8 - --max-position-embeddings 131072 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 500000 - --vocab-size 128256 - --kv-channels 128 - --use-rope-scaling - --rotary-scaling-factor 8.0 - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/llama3.2-3B-Instruct-amd.py b/scripts/models/llama3.2-3B-Instruct-amd.py new file mode 100644 index 0000000000..ba185446be --- /dev/null +++ b/scripts/models/llama3.2-3B-Instruct-amd.py @@ -0,0 +1,20 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 3072 " + "--ffn-hidden-size 8192 " + "--num-attention-heads 24 " + "--group-query-attention " + "--num-query-groups 8 " + "--max-position-embeddings 131072 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 500000 " + "--vocab-size 128256 " + "--kv-channels 128 " + "--use-rope-scaling " + "--rotary-scaling-factor 32.0 " + ) diff --git a/scripts/models/llama3.2-3B-Instruct-amd.sh b/scripts/models/llama3.2-3B-Instruct-amd.sh deleted file mode 100644 index 654de5a386..0000000000 --- a/scripts/models/llama3.2-3B-Instruct-amd.sh +++ /dev/null @@ -1,19 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 3072 - --ffn-hidden-size 8192 - --num-attention-heads 24 - --group-query-attention - --num-query-groups 8 - --max-position-embeddings 131072 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 500000 - --vocab-size 128256 - --kv-channels 128 - --use-rope-scaling - --rotary-scaling-factor 32.0 -) diff --git a/scripts/models/llama3.2-3B-Instruct.py b/scripts/models/llama3.2-3B-Instruct.py new file mode 100644 index 0000000000..ba185446be --- /dev/null +++ b/scripts/models/llama3.2-3B-Instruct.py @@ -0,0 +1,20 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 3072 " + "--ffn-hidden-size 8192 " + "--num-attention-heads 24 " + "--group-query-attention " + "--num-query-groups 8 " + "--max-position-embeddings 131072 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 500000 " + "--vocab-size 128256 " + "--kv-channels 128 " + "--use-rope-scaling " + "--rotary-scaling-factor 32.0 " + ) diff --git a/scripts/models/llama3.2-3B-Instruct.sh b/scripts/models/llama3.2-3B-Instruct.sh deleted file mode 100644 index ff50130c8a..0000000000 --- a/scripts/models/llama3.2-3B-Instruct.sh +++ /dev/null @@ -1,19 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 3072 - --ffn-hidden-size 8192 - --num-attention-heads 24 - --group-query-attention - --num-query-groups 8 - --max-position-embeddings 131072 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 500000 - --vocab-size 128256 - --kv-channels 128 - --use-rope-scaling - --rotary-scaling-factor 32.0 -) \ No newline at end of file diff --git a/scripts/models/mimo-7B-rl.py b/scripts/models/mimo-7B-rl.py new file mode 100644 index 0000000000..d790dbddbc --- /dev/null +++ b/scripts/models/mimo-7B-rl.py @@ -0,0 +1,20 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 36 " + "--hidden-size 4096 " + "--ffn-hidden-size 11008 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-05 " + "--rotary-base 640000 " + "--vocab-size 151680 " + "--untie-embeddings-and-output-weights " + "--max-position-embeddings 32768 " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/mimo-7B-rl.sh b/scripts/models/mimo-7B-rl.sh deleted file mode 100644 index 22366935f9..0000000000 --- a/scripts/models/mimo-7B-rl.sh +++ /dev/null @@ -1,19 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 36 - --hidden-size 4096 - --ffn-hidden-size 11008 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-05 - --rotary-base 640000 - --vocab-size 151680 - --untie-embeddings-and-output-weights - --max-position-embeddings 32768 - --mtp-num-layers 1 -) diff --git a/scripts/models/moonlight.py b/scripts/models/moonlight.py new file mode 100644 index 0000000000..432ef0b6a1 --- /dev/null +++ b/scripts/models/moonlight.py @@ -0,0 +1,60 @@ +from model_args_utils import moe_layer_freq + + +MOE_SHARED_EXPERTS = 2 +MOE_FFN_HIDDEN = 1408 +MOE_SHARED_EXPERT_INTERMEDIATE_SIZE = MOE_FFN_HIDDEN * MOE_SHARED_EXPERTS +MOE_ROUTER_TOPK_SCALING_FACTOR = 2.446 +NLAYERS = 27 +FIRST_K_DENSE_REPLACE = 1 + + +def model_args() -> str: + return ( + "--disable-bias-linear " + "--num-layers 27 " + "--hidden-size 2048 " + "--ffn-hidden-size 11264 " + "--num-attention-heads 16 " + "--kv-channels 128 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-5 " + "--rotary-percent 1.0 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--no-masked-softmax-fusion " + "--vocab-size 163840 " + "--multi-latent-attention " + "--kv-lora-rank 512 " + "--qk-head-dim 128 " + "--qk-pos-emb-head-dim 64 " + "--v-head-dim 128 " + "--qk-layernorm " + "--rotary-scaling-factor 1 " + "--rotary-base 50000 " + "--mscale 1.0 " + "--mscale-all-dim 1.0 " + "--attention-softmax-in-fp32 " + "--no-rope-fusion " + # moe + "--num-experts 64 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + f"--moe-ffn-hidden-size {MOE_FFN_HIDDEN} " + "--moe-router-topk 6 " + f"--moe-shared-expert-intermediate-size {MOE_SHARED_EXPERT_INTERMEDIATE_SIZE} " + "--moe-router-pre-softmax " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-token-dispatcher-type alltoall " + "--moe-aux-loss-coeff 0 " + "--moe-router-bias-update-rate 0 " + "--moe-router-group-topk 1 " + "--moe-router-num-groups 1 " + "--moe-grouped-gemm " + f"--moe-router-topk-scaling-factor {MOE_ROUTER_TOPK_SCALING_FACTOR} " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + ) diff --git a/scripts/models/moonlight.sh b/scripts/models/moonlight.sh deleted file mode 100644 index bcce99892a..0000000000 --- a/scripts/models/moonlight.sh +++ /dev/null @@ -1,69 +0,0 @@ -MOE_SHARED_EXPERTS=2 -MOE_FFN_HIDDEN=1408 -MOE_SHARED_EXPERT_INTERMEDIATE_SIZE=$(($MOE_FFN_HIDDEN * $MOE_SHARED_EXPERTS)) -MOE_ROUTER_TOPK_SCALING_FACTOR=2.446 -NLAYERS=27 -FIRST_K_DENSE_REPLACE=1 - -arr=() -for ((i=0; i str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 32 " + "--num-query-groups 2 " + "--kv-channels 128 " + "--num-layers 52 " + "--hidden-size 2688 " + "--ffn-hidden-size 1856 " + "--normalization RMSNorm " + "--position-embedding-type none " + "--vocab-size 131072 " + "--make-vocab-size-divisible-by 128 " + "--untie-embeddings-and-output-weights " + # MoE specifics + "--num-experts 128 " + "--moe-router-topk 6 " + "--moe-ffn-hidden-size 1856 " + "--moe-shared-expert-intermediate-size 3712 " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + # Routing: config has n_group=1 (MoE groups), topk_group=1, + # routed_scaling_factor=2.5. `n_groups=8` is Mamba groups — unrelated to MoE. + # With n_group=1, group-limited routing is a no-op (single group of 128). + "--moe-router-num-groups 1 " + "--moe-router-group-topk 1 " + "--moe-router-topk-scaling-factor 2.5 " + "--moe-router-pre-softmax " + # Match glm4.7-flash (known-working MoE RL) settings more closely. + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-bias-update-rate 0 " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/nemotron-3-nano-30b-a3b.sh b/scripts/models/nemotron-3-nano-30b-a3b.sh deleted file mode 100644 index bf10a50b7c..0000000000 --- a/scripts/models/nemotron-3-nano-30b-a3b.sh +++ /dev/null @@ -1,47 +0,0 @@ -# NVIDIA Nemotron-3-Nano-30B-A3B (BF16, MoE nemotron_h = hybrid Mamba + Attention + MoE). -# HF config (verified 2026-04-21): -# num_hidden_layers=52 hidden_size=2688 num_attention_heads=32 num_key_value_heads=2 -# head_dim=128 intermediate_size=1856 moe_intermediate_size=1856 -# n_routed_experts=128 num_experts_per_tok=6 n_shared_experts=1 -# moe_shared_expert_intermediate_size=3712 sigmoid routing + aux-free expert bias -# The AutoBridge path (--megatron-to-hf-mode bridge) + miles NemotronHBridge MoE shim -# (see miles/backends/megatron_utils/__init__.py) construct the provider and -# HF↔Megatron mapping_registry at load time. Attention-side structural args go -# in MODEL_ARGS for miles' arg parser. - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 32 - --num-query-groups 2 - --kv-channels 128 - --num-layers 52 - --hidden-size 2688 - --ffn-hidden-size 1856 - --normalization RMSNorm - --position-embedding-type none - --vocab-size 131072 - --make-vocab-size-divisible-by 128 - --untie-embeddings-and-output-weights - - # MoE specifics - --num-experts 128 - --moe-router-topk 6 - --moe-ffn-hidden-size 1856 - --moe-shared-expert-intermediate-size 3712 - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-grouped-gemm - --moe-router-dtype fp32 - # Routing: config has n_group=1 (MoE groups), topk_group=1, - # routed_scaling_factor=2.5. `n_groups=8` is Mamba groups — unrelated to MoE. - # With n_group=1, group-limited routing is a no-op (single group of 128). - --moe-router-num-groups 1 - --moe-router-group-topk 1 - --moe-router-topk-scaling-factor 2.5 - --moe-router-pre-softmax - # Match glm4.7-flash (known-working MoE RL) settings more closely. - --moe-router-load-balancing-type seq_aux_loss - --moe-router-bias-update-rate 0 - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/nemotron-3-nano-4b.py b/scripts/models/nemotron-3-nano-4b.py new file mode 100644 index 0000000000..2a91c4d7f6 --- /dev/null +++ b/scripts/models/nemotron-3-nano-4b.py @@ -0,0 +1,16 @@ +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 40 " + "--num-query-groups 8 " + "--kv-channels 128 " + "--num-layers 42 " + "--hidden-size 3136 " + "--ffn-hidden-size 12544 " + "--normalization RMSNorm " + "--position-embedding-type none " + "--vocab-size 131072 " + "--make-vocab-size-divisible-by 128 " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/nemotron-3-nano-4b.sh b/scripts/models/nemotron-3-nano-4b.sh deleted file mode 100644 index 9e1a76b5e1..0000000000 --- a/scripts/models/nemotron-3-nano-4b.sh +++ /dev/null @@ -1,24 +0,0 @@ -# NVIDIA Nemotron-3-Nano-4B (BF16, dense `nemotron_h` = hybrid Mamba + Attention). -# HF config (verified 2026-04-21): -# num_hidden_layers=42 hidden_size=3136 num_attention_heads=40 num_key_value_heads=8 -# vocab_size=131072 max_position_embeddings=262144 no RoPE squared-relu FFN -# The AutoBridge path (--megatron-to-hf-mode bridge) constructs the full Megatron -# provider from the HF config.json at load time, including all Mamba-specific -# fields (mamba_num_heads, mamba_state_dim, hybrid_override_pattern, etc.), so we -# only keep the attention-side structural args here for miles' arg parser. - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 40 - --num-query-groups 8 - --kv-channels 128 - --num-layers 42 - --hidden-size 3136 - --ffn-hidden-size 12544 - --normalization RMSNorm - --position-embedding-type none - --vocab-size 131072 - --make-vocab-size-divisible-by 128 - --untie-embeddings-and-output-weights -) diff --git a/scripts/models/nemotron-3-super-120b-a12b.py b/scripts/models/nemotron-3-super-120b-a12b.py new file mode 100644 index 0000000000..83dc71b7e7 --- /dev/null +++ b/scripts/models/nemotron-3-super-120b-a12b.py @@ -0,0 +1,42 @@ +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 32 " + "--num-query-groups 2 " + "--kv-channels 128 " + "--num-layers 88 " + "--hidden-size 4096 " + "--ffn-hidden-size 2688 " + "--normalization RMSNorm " + "--position-embedding-type none " + "--vocab-size 131072 " + "--make-vocab-size-divisible-by 128 " + "--untie-embeddings-and-output-weights " + # MoE specifics + "--num-experts 512 " + "--moe-router-topk 22 " + "--moe-ffn-hidden-size 2688 " + "--moe-shared-expert-intermediate-size 5376 " + # Super-120B bottlenecks expert input/output through a 1024-dim latent. + # Routed experts run on moe_latent_size, NOT hidden_size, with two extra + # fc1/fc2 latent projections per MoE layer. The miles NemotronH bridge + # surfaces this from HF config; the CLI arg keeps Megatron's parser happy. + "--moe-latent-size 1024 " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + # Routing: HF config has n_group=1 (MoE groups), topk_group=1, + # routed_scaling_factor=5.0. With n_group=1, group-limited routing is a + # no-op (single group of 512). `n_groups=8` in HF is Mamba groups — + # unrelated to MoE. + "--moe-router-num-groups 1 " + "--moe-router-group-topk 1 " + "--moe-router-topk-scaling-factor 5.0 " + "--moe-router-pre-softmax " + # Match nano-30b-a3b (known-working MoE RL on nemotron_h) settings. + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-bias-update-rate 0 " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/nemotron-3-super-120b-a12b.sh b/scripts/models/nemotron-3-super-120b-a12b.sh deleted file mode 100644 index 13e3eceb8b..0000000000 --- a/scripts/models/nemotron-3-super-120b-a12b.sh +++ /dev/null @@ -1,54 +0,0 @@ -# NVIDIA Nemotron-3-Super-120B-A12B (BF16, MoE nemotron_h = hybrid Mamba + Attention + MoE). -# HF config (verified 2026-05-01): -# num_hidden_layers=88 hidden_size=4096 num_attention_heads=32 num_key_value_heads=2 -# head_dim=128 intermediate_size=2688 moe_intermediate_size=2688 -# n_routed_experts=512 num_experts_per_tok=22 n_shared_experts=1 -# moe_shared_expert_intermediate_size=5376 routed_scaling_factor=5.0 -# n_group=1 topk_group=1 sigmoid routing + aux-free expert bias -# The AutoBridge path (--megatron-to-hf-mode bridge) + miles NemotronHBridge MoE shim -# (see miles_plugins/megatron_bridge/nemotron_h.py) construct the provider and -# HF<->Megatron mapping_registry at load time. Attention-side structural args go -# in MODEL_ARGS for miles' arg parser. - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 32 - --num-query-groups 2 - --kv-channels 128 - --num-layers 88 - --hidden-size 4096 - --ffn-hidden-size 2688 - --normalization RMSNorm - --position-embedding-type none - --vocab-size 131072 - --make-vocab-size-divisible-by 128 - --untie-embeddings-and-output-weights - - # MoE specifics - --num-experts 512 - --moe-router-topk 22 - --moe-ffn-hidden-size 2688 - --moe-shared-expert-intermediate-size 5376 - # Super-120B bottlenecks expert input/output through a 1024-dim latent. - # Routed experts run on moe_latent_size, NOT hidden_size, with two extra - # fc1/fc2 latent projections per MoE layer. The miles NemotronH bridge - # surfaces this from HF config; the CLI arg keeps Megatron's parser happy. - --moe-latent-size 1024 - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-grouped-gemm - --moe-router-dtype fp32 - # Routing: HF config has n_group=1 (MoE groups), topk_group=1, - # routed_scaling_factor=5.0. With n_group=1, group-limited routing is a - # no-op (single group of 512). `n_groups=8` in HF is Mamba groups — - # unrelated to MoE. - --moe-router-num-groups 1 - --moe-router-group-topk 1 - --moe-router-topk-scaling-factor 5.0 - --moe-router-pre-softmax - # Match nano-30b-a3b (known-working MoE RL on nemotron_h) settings. - --moe-router-load-balancing-type seq_aux_loss - --moe-router-bias-update-rate 0 - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/nemotron-3-ultra-550b-a55b-4layer.py b/scripts/models/nemotron-3-ultra-550b-a55b-4layer.py new file mode 100644 index 0000000000..c8795f3d41 --- /dev/null +++ b/scripts/models/nemotron-3-ultra-550b-a55b-4layer.py @@ -0,0 +1,48 @@ +# 4-layer slice of NVIDIA Nemotron-3-Ultra-550B-A55B, for single-node (8 GPU) CI. +# +# Built by cluster_scripts/debug_tool_set/checkpoint/prune_nemotron_h.py, which +# keeps source layers 0,1,7,8 and renumbers them 0..3. That selection is the +# cheapest one covering every block type the full 108-layer model has: +# +# layer 0 mamba layer 1 moe layer 2 attention layer 3 moe -> "ME*E" +# MTP head: attention + moe -> "*E" +# +# A prefix cut would need 8 layers to reach the first attention layer and drag +# in 4 MoE layers (~44B params) instead of 2. Everything else (512 experts, +# top-22, moe_latent_size=2048, sigmoid router + expert bias) is unchanged from +# nemotron-3-ultra-550b-a55b.py, so the weight-conversion path is identical. + + +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 64 " + "--num-query-groups 2 " + "--kv-channels 128 " + "--num-layers 4 " + "--hidden-size 8192 " + "--ffn-hidden-size 5120 " + "--normalization RMSNorm " + "--position-embedding-type none " + "--vocab-size 131072 " + "--make-vocab-size-divisible-by 128 " + "--untie-embeddings-and-output-weights " + # MoE specifics (identical to the full model) + "--num-experts 512 " + "--moe-router-topk 22 " + "--moe-ffn-hidden-size 5120 " + "--moe-shared-expert-intermediate-size 10240 " + "--moe-latent-size 2048 " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + "--moe-router-num-groups 1 " + "--moe-router-group-topk 1 " + "--moe-router-topk-scaling-factor 5.0 " + "--moe-router-pre-softmax " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-bias-update-rate 0 " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh b/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh deleted file mode 100644 index fc3be08a79..0000000000 --- a/scripts/models/nemotron-3-ultra-550b-a55b-4layer.sh +++ /dev/null @@ -1,47 +0,0 @@ -# 4-layer slice of NVIDIA Nemotron-3-Ultra-550B-A55B, for single-node (8 GPU) CI. -# -# Built by cluster_scripts/debug_tool_set/checkpoint/prune_nemotron_h.py, which -# keeps source layers 0,1,7,8 and renumbers them 0..3. That selection is the -# cheapest one covering every block type the full 108-layer model has: -# -# layer 0 mamba layer 1 moe layer 2 attention layer 3 moe -> "ME*E" -# MTP head: attention + moe -> "*E" -# -# A prefix cut would need 8 layers to reach the first attention layer and drag -# in 4 MoE layers (~44B params) instead of 2. Everything else (512 experts, -# top-22, moe_latent_size=2048, sigmoid router + expert bias) is unchanged from -# nemotron-3-ultra-550b-a55b.sh, so the weight-conversion path is identical. - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 64 - --num-query-groups 2 - --kv-channels 128 - --num-layers 4 - --hidden-size 8192 - --ffn-hidden-size 5120 - --normalization RMSNorm - --position-embedding-type none - --vocab-size 131072 - --make-vocab-size-divisible-by 128 - --untie-embeddings-and-output-weights - - # MoE specifics (identical to the full model) - --num-experts 512 - --moe-router-topk 22 - --moe-ffn-hidden-size 5120 - --moe-shared-expert-intermediate-size 10240 - --moe-latent-size 2048 - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-grouped-gemm - --moe-router-dtype fp32 - --moe-router-num-groups 1 - --moe-router-group-topk 1 - --moe-router-topk-scaling-factor 5.0 - --moe-router-pre-softmax - --moe-router-load-balancing-type seq_aux_loss - --moe-router-bias-update-rate 0 - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/nemotron-3-ultra-550b-a55b.py b/scripts/models/nemotron-3-ultra-550b-a55b.py new file mode 100644 index 0000000000..d11d32eeb7 --- /dev/null +++ b/scripts/models/nemotron-3-ultra-550b-a55b.py @@ -0,0 +1,52 @@ +# NVIDIA Nemotron-3-Ultra-550B-A55B (BF16, MoE nemotron_h = hybrid Mamba2 + Attention + MoE). +# HF config: +# num_hidden_layers=108 hidden_size=8192 num_attention_heads=64 num_key_value_heads=2 +# head_dim=128 intermediate_size=5120 moe_intermediate_size=5120 +# n_routed_experts=512 num_experts_per_tok=22 n_shared_experts=1 +# moe_shared_expert_intermediate_size=10240 routed_scaling_factor=5.0 +# moe_latent_size=2048 n_group=1 topk_group=1 sigmoid routing + aux-free expert bias +# num_nextn_predict_layers=1 (MTP head) mamba n_groups=8 +# Same AutoBridge path as Super-120B (--megatron-to-hf-mode bridge) + miles +# NemotronHBridge MoE/latent shim (miles_plugins/megatron_bridge/nemotron_h.py). +# NOTE: Mamba n_groups=8 forces attention/mamba tensor-parallel <= 8 (n_groups % tp == 0). + + +def model_args() -> str: + return ( + "--disable-bias-linear " + "--group-query-attention " + "--num-attention-heads 64 " + "--num-query-groups 2 " + "--kv-channels 128 " + "--num-layers 108 " + "--hidden-size 8192 " + "--ffn-hidden-size 5120 " + "--normalization RMSNorm " + "--position-embedding-type none " + "--vocab-size 131072 " + "--make-vocab-size-divisible-by 128 " + "--untie-embeddings-and-output-weights " + # MoE specifics + "--num-experts 512 " + "--moe-router-topk 22 " + "--moe-ffn-hidden-size 5120 " + "--moe-shared-expert-intermediate-size 10240 " + # Ultra-550B bottlenecks expert input/output through a 2048-dim latent + # (routed experts run on moe_latent_size, not hidden_size; two extra fc1/fc2 + # latent projections per MoE layer). Surfaced from HF config by the miles + # NemotronH bridge; the CLI arg keeps Megatron's parser happy. + "--moe-latent-size 2048 " + "--moe-router-score-function sigmoid " + "--moe-router-enable-expert-bias " + "--moe-grouped-gemm " + "--moe-router-dtype fp32 " + # n_group=1 (MoE groups) -> group-limited routing is a no-op (single group of + # 512). HF n_groups=8 is the Mamba groups, unrelated to MoE. + "--moe-router-num-groups 1 " + "--moe-router-group-topk 1 " + "--moe-router-topk-scaling-factor 5.0 " + "--moe-router-pre-softmax " + "--moe-router-load-balancing-type seq_aux_loss " + "--moe-router-bias-update-rate 0 " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/nemotron-3-ultra-550b-a55b.sh b/scripts/models/nemotron-3-ultra-550b-a55b.sh deleted file mode 100644 index 73d99aca60..0000000000 --- a/scripts/models/nemotron-3-ultra-550b-a55b.sh +++ /dev/null @@ -1,51 +0,0 @@ -# NVIDIA Nemotron-3-Ultra-550B-A55B (BF16, MoE nemotron_h = hybrid Mamba2 + Attention + MoE). -# HF config: -# num_hidden_layers=108 hidden_size=8192 num_attention_heads=64 num_key_value_heads=2 -# head_dim=128 intermediate_size=5120 moe_intermediate_size=5120 -# n_routed_experts=512 num_experts_per_tok=22 n_shared_experts=1 -# moe_shared_expert_intermediate_size=10240 routed_scaling_factor=5.0 -# moe_latent_size=2048 n_group=1 topk_group=1 sigmoid routing + aux-free expert bias -# num_nextn_predict_layers=1 (MTP head) mamba n_groups=8 -# Same AutoBridge path as Super-120B (--megatron-to-hf-mode bridge) + miles -# NemotronHBridge MoE/latent shim (miles_plugins/megatron_bridge/nemotron_h.py). -# NOTE: Mamba n_groups=8 forces attention/mamba tensor-parallel <= 8 (n_groups % tp == 0). - -MODEL_ARGS=( - --disable-bias-linear - --group-query-attention - --num-attention-heads 64 - --num-query-groups 2 - --kv-channels 128 - --num-layers 108 - --hidden-size 8192 - --ffn-hidden-size 5120 - --normalization RMSNorm - --position-embedding-type none - --vocab-size 131072 - --make-vocab-size-divisible-by 128 - --untie-embeddings-and-output-weights - - # MoE specifics - --num-experts 512 - --moe-router-topk 22 - --moe-ffn-hidden-size 5120 - --moe-shared-expert-intermediate-size 10240 - # Ultra-550B bottlenecks expert input/output through a 2048-dim latent - # (routed experts run on moe_latent_size, not hidden_size; two extra fc1/fc2 - # latent projections per MoE layer). Surfaced from HF config by the miles - # NemotronH bridge; the CLI arg keeps Megatron's parser happy. - --moe-latent-size 2048 - --moe-router-score-function sigmoid - --moe-router-enable-expert-bias - --moe-grouped-gemm - --moe-router-dtype fp32 - # n_group=1 (MoE groups) -> group-limited routing is a no-op (single group of - # 512). HF n_groups=8 is the Mamba groups, unrelated to MoE. - --moe-router-num-groups 1 - --moe-router-group-topk 1 - --moe-router-topk-scaling-factor 5.0 - --moe-router-pre-softmax - --moe-router-load-balancing-type seq_aux_loss - --moe-router-bias-update-rate 0 - --moe-aux-loss-coeff 0 -) diff --git a/scripts/models/qwen2.5-0.5B.py b/scripts/models/qwen2.5-0.5B.py new file mode 100644 index 0000000000..d158110313 --- /dev/null +++ b/scripts/models/qwen2.5-0.5B.py @@ -0,0 +1,17 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 24 " + "--hidden-size 896 " + "--ffn-hidden-size 4864 " + "--num-attention-heads 14 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 1000000 " + "--group-query-attention " + "--num-query-groups 2 " + "--vocab-size 151936 " + ) diff --git a/scripts/models/qwen2.5-0.5B.sh b/scripts/models/qwen2.5-0.5B.sh deleted file mode 100644 index 66d5b29a02..0000000000 --- a/scripts/models/qwen2.5-0.5B.sh +++ /dev/null @@ -1,16 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 24 - --hidden-size 896 - --ffn-hidden-size 4864 - --num-attention-heads 14 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 1000000 - --group-query-attention - --num-query-groups 2 - --vocab-size 151936 -) \ No newline at end of file diff --git a/scripts/models/qwen2.5-1.5B.py b/scripts/models/qwen2.5-1.5B.py new file mode 100644 index 0000000000..19d95e69db --- /dev/null +++ b/scripts/models/qwen2.5-1.5B.py @@ -0,0 +1,17 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 1536 " + "--ffn-hidden-size 8960 " + "--num-attention-heads 12 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 10000 " + "--group-query-attention " + "--num-query-groups 2 " + "--vocab-size 151936 " + ) diff --git a/scripts/models/qwen2.5-1.5B.sh b/scripts/models/qwen2.5-1.5B.sh deleted file mode 100644 index b046a95c66..0000000000 --- a/scripts/models/qwen2.5-1.5B.sh +++ /dev/null @@ -1,16 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 1536 - --ffn-hidden-size 8960 - --num-attention-heads 12 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 10000 - --group-query-attention - --num-query-groups 2 - --vocab-size 151936 -) \ No newline at end of file diff --git a/scripts/models/qwen2.5-32B.py b/scripts/models/qwen2.5-32B.py new file mode 100644 index 0000000000..bc1251d5cc --- /dev/null +++ b/scripts/models/qwen2.5-32B.py @@ -0,0 +1,18 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 64 " + "--hidden-size 5120 " + "--ffn-hidden-size 27648 " + "--num-attention-heads 40 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-5 " + "--rotary-base 1000000 " + "--vocab-size 152064 " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/qwen2.5-32B.sh b/scripts/models/qwen2.5-32B.sh deleted file mode 100644 index 26b49845a4..0000000000 --- a/scripts/models/qwen2.5-32B.sh +++ /dev/null @@ -1,17 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 64 - --hidden-size 5120 - --ffn-hidden-size 27648 - --num-attention-heads 40 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-5 - --rotary-base 1000000 - --vocab-size 152064 - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/qwen2.5-3B.py b/scripts/models/qwen2.5-3B.py new file mode 100644 index 0000000000..fe922621ed --- /dev/null +++ b/scripts/models/qwen2.5-3B.py @@ -0,0 +1,17 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 36 " + "--hidden-size 2048 " + "--ffn-hidden-size 11008 " + "--num-attention-heads 16 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 1000000 " + "--group-query-attention " + "--num-query-groups 2 " + "--vocab-size 151936 " + ) diff --git a/scripts/models/qwen2.5-3B.sh b/scripts/models/qwen2.5-3B.sh deleted file mode 100644 index 9da5a9e033..0000000000 --- a/scripts/models/qwen2.5-3B.sh +++ /dev/null @@ -1,16 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 36 - --hidden-size 2048 - --ffn-hidden-size 11008 - --num-attention-heads 16 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 1000000 - --group-query-attention - --num-query-groups 2 - --vocab-size 151936 -) diff --git a/scripts/models/qwen2.5-7B.py b/scripts/models/qwen2.5-7B.py new file mode 100644 index 0000000000..7fcbb618cf --- /dev/null +++ b/scripts/models/qwen2.5-7B.py @@ -0,0 +1,18 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 3584 " + "--ffn-hidden-size 18944 " + "--num-attention-heads 28 " + "--group-query-attention " + "--num-query-groups 4 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--add-qkv-bias " + "--normalization RMSNorm " + "--norm-epsilon 1e-06 " + "--rotary-base 1000000 " + "--vocab-size 152064 " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/qwen2.5-7B.sh b/scripts/models/qwen2.5-7B.sh deleted file mode 100644 index eba912b1d7..0000000000 --- a/scripts/models/qwen2.5-7B.sh +++ /dev/null @@ -1,17 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 3584 - --ffn-hidden-size 18944 - --num-attention-heads 28 - --group-query-attention - --num-query-groups 4 - --use-rotary-position-embeddings - --disable-bias-linear - --add-qkv-bias - --normalization "RMSNorm" - --norm-epsilon 1e-06 - --rotary-base 1000000 - --vocab-size 152064 - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/qwen3-0.6B.py b/scripts/models/qwen3-0.6B.py new file mode 100644 index 0000000000..781fe2bd43 --- /dev/null +++ b/scripts/models/qwen3-0.6B.py @@ -0,0 +1,18 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 1024 " + "--ffn-hidden-size 3072 " + "--num-attention-heads 16 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 1000000 " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + ) diff --git a/scripts/models/qwen3-0.6B.sh b/scripts/models/qwen3-0.6B.sh deleted file mode 100644 index f484ec9519..0000000000 --- a/scripts/models/qwen3-0.6B.sh +++ /dev/null @@ -1,17 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 1024 - --ffn-hidden-size 3072 - --num-attention-heads 16 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 1000000 - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm -) \ No newline at end of file diff --git a/scripts/models/qwen3-1.7B.py b/scripts/models/qwen3-1.7B.py new file mode 100644 index 0000000000..e74dfac0f5 --- /dev/null +++ b/scripts/models/qwen3-1.7B.py @@ -0,0 +1,22 @@ +import os + + +def model_args(rotary_base: str | None = None) -> str: + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "1000000" + return ( + "--swiglu " + "--num-layers 28 " + "--hidden-size 2048 " + "--ffn-hidden-size 6144 " + "--num-attention-heads 16 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + f"--rotary-base {rotary_base} " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + ) diff --git a/scripts/models/qwen3-1.7B.sh b/scripts/models/qwen3-1.7B.sh deleted file mode 100644 index 7435996337..0000000000 --- a/scripts/models/qwen3-1.7B.sh +++ /dev/null @@ -1,17 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 28 - --hidden-size 2048 - --ffn-hidden-size 6144 - --num-attention-heads 16 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base "${MODEL_ARGS_ROTARY_BASE:-1000000}" - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm -) \ No newline at end of file diff --git a/scripts/models/qwen3-14B.py b/scripts/models/qwen3-14B.py new file mode 100644 index 0000000000..12b0af4bd7 --- /dev/null +++ b/scripts/models/qwen3-14B.py @@ -0,0 +1,19 @@ +def model_args() -> str: + return ( + "--swiglu " + "--num-layers 40 " + "--hidden-size 5120 " + "--ffn-hidden-size 17408 " + "--num-attention-heads 40 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 1000000 " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/qwen3-14B.sh b/scripts/models/qwen3-14B.sh deleted file mode 100644 index 11b9377da0..0000000000 --- a/scripts/models/qwen3-14B.sh +++ /dev/null @@ -1,18 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 40 - --hidden-size 5120 - --ffn-hidden-size 17408 - --num-attention-heads 40 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 1000000 - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm - --untie-embeddings-and-output-weights -) diff --git a/scripts/models/qwen3-235B-A22B.py b/scripts/models/qwen3-235B-A22B.py new file mode 100644 index 0000000000..70c53786ae --- /dev/null +++ b/scripts/models/qwen3-235B-A22B.py @@ -0,0 +1,42 @@ +import os + +from model_args_utils import moe_layer_freq + + +NLAYERS = 94 +FIRST_K_DENSE_REPLACE = 0 + + +def model_args(rotary_base: str | None = None) -> str: + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "1000000" + return ( + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 64 " + "--num-query-groups 4 " + "--kv-channels 128 " + "--num-layers 94 " + "--hidden-size 4096 " + "--ffn-hidden-size 12288 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 1.0 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 151936 " + f"--rotary-base {rotary_base} " + # moe + "--moe-ffn-hidden-size 1536 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 128 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/qwen3-235B-A22B.sh b/scripts/models/qwen3-235B-A22B.sh deleted file mode 100644 index 1f66355265..0000000000 --- a/scripts/models/qwen3-235B-A22B.sh +++ /dev/null @@ -1,49 +0,0 @@ -# qwen3-235B-a22B -NLAYERS=94 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return load_sibling_model_args(__file__, "qwen3-30B-A3B", nlayers=5) diff --git a/scripts/models/qwen3-30B-A3B-5layer.sh b/scripts/models/qwen3-30B-A3B-5layer.sh deleted file mode 100644 index 449461ae20..0000000000 --- a/scripts/models/qwen3-30B-A3B-5layer.sh +++ /dev/null @@ -1 +0,0 @@ -MODEL_ARGS_NUM_LAYERS=5 source "$(dirname -- "${BASH_SOURCE[0]}")/qwen3-30B-A3B.sh" diff --git a/scripts/models/qwen3-30B-A3B.py b/scripts/models/qwen3-30B-A3B.py new file mode 100644 index 0000000000..4f1a4c3301 --- /dev/null +++ b/scripts/models/qwen3-30B-A3B.py @@ -0,0 +1,42 @@ +import os + +from model_args_utils import moe_layer_freq + + +FIRST_K_DENSE_REPLACE = 0 + + +def model_args(nlayers: int | None = None, rotary_base: str | None = None) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 48) + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "1000000" + return ( + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 32 " + "--num-query-groups 4 " + "--kv-channels 128 " + f"--num-layers {nlayers} " + "--hidden-size 2048 " + "--ffn-hidden-size 6144 " + "--normalization RMSNorm " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 1.0 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 151936 " + f"--rotary-base {rotary_base} " + # moe + "--moe-ffn-hidden-size 768 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 128 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + ) diff --git a/scripts/models/qwen3-30B-A3B.sh b/scripts/models/qwen3-30B-A3B.sh deleted file mode 100644 index 0221af9bba..0000000000 --- a/scripts/models/qwen3-30B-A3B.sh +++ /dev/null @@ -1,49 +0,0 @@ -NLAYERS="${MODEL_ARGS_NUM_LAYERS:-48}" -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return ( + "--swiglu " + "--num-layers 64 " + "--hidden-size 5120 " + "--ffn-hidden-size 25600 " + "--num-attention-heads 64 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + "--rotary-base 1000000 " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/qwen3-32B.sh b/scripts/models/qwen3-32B.sh deleted file mode 100644 index e7407e327c..0000000000 --- a/scripts/models/qwen3-32B.sh +++ /dev/null @@ -1,18 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 64 - --hidden-size 5120 - --ffn-hidden-size 25600 - --num-attention-heads 64 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base 1000000 - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm - --untie-embeddings-and-output-weights -) diff --git a/scripts/models/qwen3-4B-Instruct-2507.py b/scripts/models/qwen3-4B-Instruct-2507.py new file mode 100644 index 0000000000..7c8150db38 --- /dev/null +++ b/scripts/models/qwen3-4B-Instruct-2507.py @@ -0,0 +1,5 @@ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + return load_sibling_model_args(__file__, "qwen3-4B", rotary_base=5000000) diff --git a/scripts/models/qwen3-4B-Instruct-2507.sh b/scripts/models/qwen3-4B-Instruct-2507.sh deleted file mode 100644 index 67d13c0c82..0000000000 --- a/scripts/models/qwen3-4B-Instruct-2507.sh +++ /dev/null @@ -1 +0,0 @@ -MODEL_ARGS_ROTARY_BASE=5000000 source "$(dirname -- "${BASH_SOURCE[0]}")/qwen3-4B.sh" \ No newline at end of file diff --git a/scripts/models/qwen3-4B.py b/scripts/models/qwen3-4B.py new file mode 100644 index 0000000000..b1a40729b8 --- /dev/null +++ b/scripts/models/qwen3-4B.py @@ -0,0 +1,22 @@ +import os + + +def model_args(rotary_base: str | None = None) -> str: + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "1000000" + return ( + "--swiglu " + "--num-layers 36 " + "--hidden-size 2560 " + "--ffn-hidden-size 9728 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + f"--rotary-base {rotary_base} " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + ) diff --git a/scripts/models/qwen3-4B.sh b/scripts/models/qwen3-4B.sh deleted file mode 100644 index 51f9e47581..0000000000 --- a/scripts/models/qwen3-4B.sh +++ /dev/null @@ -1,17 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 36 - --hidden-size 2560 - --ffn-hidden-size 9728 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base "${MODEL_ARGS_ROTARY_BASE:-1000000}" - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm -) \ No newline at end of file diff --git a/scripts/models/qwen3-8B.py b/scripts/models/qwen3-8B.py new file mode 100644 index 0000000000..029133f0d8 --- /dev/null +++ b/scripts/models/qwen3-8B.py @@ -0,0 +1,23 @@ +import os + + +def model_args(rotary_base: str | None = None) -> str: + rotary_base = rotary_base if rotary_base is not None else os.environ.get("MODEL_ARGS_ROTARY_BASE") or "1000000" + return ( + "--swiglu " + "--num-layers 36 " + "--hidden-size 4096 " + "--ffn-hidden-size 12288 " + "--num-attention-heads 32 " + "--group-query-attention " + "--num-query-groups 8 " + "--use-rotary-position-embeddings " + "--disable-bias-linear " + "--normalization RMSNorm " + "--norm-epsilon 1e-6 " + f"--rotary-base {rotary_base} " + "--vocab-size 151936 " + "--kv-channels 128 " + "--qk-layernorm " + "--untie-embeddings-and-output-weights " + ) diff --git a/scripts/models/qwen3-8B.sh b/scripts/models/qwen3-8B.sh deleted file mode 100644 index fc573adb37..0000000000 --- a/scripts/models/qwen3-8B.sh +++ /dev/null @@ -1,18 +0,0 @@ -MODEL_ARGS=( - --swiglu - --num-layers 36 - --hidden-size 4096 - --ffn-hidden-size 12288 - --num-attention-heads 32 - --group-query-attention - --num-query-groups 8 - --use-rotary-position-embeddings - --disable-bias-linear - --normalization "RMSNorm" - --norm-epsilon 1e-6 - --rotary-base "${MODEL_ARGS_ROTARY_BASE:-1000000}" - --vocab-size 151936 - --kv-channels 128 - --qk-layernorm - --untie-embeddings-and-output-weights -) \ No newline at end of file diff --git a/scripts/models/qwen3-next-80B-A3B.py b/scripts/models/qwen3-next-80B-A3B.py new file mode 100644 index 0000000000..402b870c73 --- /dev/null +++ b/scripts/models/qwen3-next-80B-A3B.py @@ -0,0 +1,46 @@ +from model_args_utils import moe_layer_freq + + +NLAYERS = 48 +FIRST_K_DENSE_REPLACE = 0 + + +def model_args() -> str: + return ( + "--spec miles_plugins.models.qwen3_next get_qwen3_next_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 2 " + "--kv-channels 256 " + "--num-layers 48 " + "--hidden-size 2048 " + "--ffn-hidden-size 5120 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 151936 " + "--rotary-base 10000000 " + # moe + "--moe-ffn-hidden-size 512 " + "--moe-shared-expert-intermediate-size 512 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 10 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 512 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + # qwen3 specific + "--attention-output-gate " + "--moe-shared-expert-gate " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/qwen3-next-80B-A3B.sh b/scripts/models/qwen3-next-80B-A3B.sh deleted file mode 100644 index e539085412..0000000000 --- a/scripts/models/qwen3-next-80B-A3B.sh +++ /dev/null @@ -1,58 +0,0 @@ -NLAYERS=48 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 24 " + "--num-query-groups 4 " + "--kv-channels 256 " + "--num-layers 64 " + "--hidden-size 5120 " + "--ffn-hidden-size 17408 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # qwen3.5 specific + "--attention-output-gate " + ) diff --git a/scripts/models/qwen3.5-27B.sh b/scripts/models/qwen3.5-27B.sh deleted file mode 100644 index 5e76a6d3f9..0000000000 --- a/scripts/models/qwen3.5-27B.sh +++ /dev/null @@ -1,27 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.qwen3_5" "get_qwen3_5_spec" - - --disable-bias-linear - --qk-layernorm - --group-query-attention - --num-attention-heads 24 - --num-query-groups 4 - --kv-channels 256 - --num-layers 64 - --hidden-size 5120 - --ffn-hidden-size 17408 - - --normalization RMSNorm - --apply-layernorm-1p - --position-embedding-type rope - --norm-epsilon 1e-6 - --rotary-percent 0.25 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 248320 - - --rotary-base 10000000 - - # qwen3.5 specific - --attention-output-gate -) diff --git a/scripts/models/qwen3.5-35B-A3B.py b/scripts/models/qwen3.5-35B-A3B.py new file mode 100644 index 0000000000..e63ef67ee3 --- /dev/null +++ b/scripts/models/qwen3.5-35B-A3B.py @@ -0,0 +1,46 @@ +from model_args_utils import moe_layer_freq + + +NLAYERS = 40 +FIRST_K_DENSE_REPLACE = 0 + + +def model_args() -> str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 2 " + "--kv-channels 256 " + "--num-layers 40 " + "--hidden-size 2048 " + "--ffn-hidden-size 512 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # moe + "--moe-ffn-hidden-size 512 " + "--moe-shared-expert-intermediate-size 512 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 256 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + # qwen3.5 specific + "--attention-output-gate " + "--moe-shared-expert-gate " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/qwen3.5-35B-A3B.sh b/scripts/models/qwen3.5-35B-A3B.sh deleted file mode 100644 index e6912b17dd..0000000000 --- a/scripts/models/qwen3.5-35B-A3B.sh +++ /dev/null @@ -1,58 +0,0 @@ -NLAYERS=40 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 2 " + "--kv-channels 256 " + "--num-layers 40 " + "--hidden-size 2048 " + "--ffn-hidden-size 512 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # moe + "--moe-ffn-hidden-size 512 " + "--moe-shared-expert-intermediate-size 512 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 256 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + # qwen3.5 specific + "--attention-output-gate " + "--moe-shared-expert-gate " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/qwen3.5-35B-A3B_lora.sh b/scripts/models/qwen3.5-35B-A3B_lora.sh deleted file mode 100644 index 9efa764fff..0000000000 --- a/scripts/models/qwen3.5-35B-A3B_lora.sh +++ /dev/null @@ -1,62 +0,0 @@ -NLAYERS=40 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 4 " + "--kv-channels 256 " + "--num-layers 32 " + "--hidden-size 2560 " + "--ffn-hidden-size 9216 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # qwen3.5 specific + "--attention-output-gate " + ) diff --git a/scripts/models/qwen3.5-4B.sh b/scripts/models/qwen3.5-4B.sh deleted file mode 100644 index 180ad79763..0000000000 --- a/scripts/models/qwen3.5-4B.sh +++ /dev/null @@ -1,26 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.qwen3_5" "get_qwen3_5_spec" - - --disable-bias-linear - --qk-layernorm - --group-query-attention - --num-attention-heads 16 - --num-query-groups 4 - --kv-channels 256 - --num-layers 32 - --hidden-size 2560 - --ffn-hidden-size 9216 - - --normalization RMSNorm - --apply-layernorm-1p - --position-embedding-type rope - --norm-epsilon 1e-6 - --rotary-percent 0.25 - --swiglu - --vocab-size 248320 - - --rotary-base 10000000 - - # qwen3.5 specific - --attention-output-gate -) diff --git a/scripts/models/qwen3.5-9B.py b/scripts/models/qwen3.5-9B.py new file mode 100644 index 0000000000..38f4e05ad6 --- /dev/null +++ b/scripts/models/qwen3.5-9B.py @@ -0,0 +1,24 @@ +def model_args() -> str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 4 " + "--kv-channels 256 " + "--num-layers 32 " + "--hidden-size 4096 " + "--ffn-hidden-size 12288 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # qwen3.5 specific + "--attention-output-gate " + ) diff --git a/scripts/models/qwen3.5-9B.sh b/scripts/models/qwen3.5-9B.sh deleted file mode 100644 index 433e730ae6..0000000000 --- a/scripts/models/qwen3.5-9B.sh +++ /dev/null @@ -1,27 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.qwen3_5" "get_qwen3_5_spec" - - --disable-bias-linear - --qk-layernorm - --group-query-attention - --num-attention-heads 16 - --num-query-groups 4 - --kv-channels 256 - --num-layers 32 - --hidden-size 4096 - --ffn-hidden-size 12288 - - --normalization RMSNorm - --apply-layernorm-1p - --position-embedding-type rope - --norm-epsilon 1e-6 - --rotary-percent 0.25 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 248320 - - --rotary-base 10000000 - - # qwen3.5 specific - --attention-output-gate -) diff --git a/scripts/models/qwen3.6-27B.py b/scripts/models/qwen3.6-27B.py new file mode 100644 index 0000000000..3d7404b4b9 --- /dev/null +++ b/scripts/models/qwen3.6-27B.py @@ -0,0 +1,24 @@ +def model_args() -> str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 24 " + "--num-query-groups 4 " + "--kv-channels 256 " + "--num-layers 64 " + "--hidden-size 5120 " + "--ffn-hidden-size 17408 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # qwen3.5-family specific + "--attention-output-gate " + ) diff --git a/scripts/models/qwen3.6-27B.sh b/scripts/models/qwen3.6-27B.sh deleted file mode 100644 index c30e566d0a..0000000000 --- a/scripts/models/qwen3.6-27B.sh +++ /dev/null @@ -1,27 +0,0 @@ -MODEL_ARGS=( - --spec "miles_plugins.models.qwen3_5" "get_qwen3_5_spec" - - --disable-bias-linear - --qk-layernorm - --group-query-attention - --num-attention-heads 24 - --num-query-groups 4 - --kv-channels 256 - --num-layers 64 - --hidden-size 5120 - --ffn-hidden-size 17408 - - --normalization RMSNorm - --apply-layernorm-1p - --position-embedding-type rope - --norm-epsilon 1e-6 - --rotary-percent 0.25 - --swiglu - --untie-embeddings-and-output-weights - --vocab-size 248320 - - --rotary-base 10000000 - - # qwen3.5-family specific - --attention-output-gate -) diff --git a/scripts/models/qwen3.6-35B-A3B.py b/scripts/models/qwen3.6-35B-A3B.py new file mode 100644 index 0000000000..6dea958668 --- /dev/null +++ b/scripts/models/qwen3.6-35B-A3B.py @@ -0,0 +1,46 @@ +from model_args_utils import moe_layer_freq + + +NLAYERS = 40 +FIRST_K_DENSE_REPLACE = 0 + + +def model_args() -> str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 2 " + "--kv-channels 256 " + "--num-layers 40 " + "--hidden-size 2048 " + "--ffn-hidden-size 512 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # moe + "--moe-ffn-hidden-size 512 " + "--moe-shared-expert-intermediate-size 512 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 256 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + # qwen3.6 specific (same architecture as qwen3.5) + "--attention-output-gate " + "--moe-shared-expert-gate " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/qwen3.6-35B-A3B.sh b/scripts/models/qwen3.6-35B-A3B.sh deleted file mode 100644 index 48d323213a..0000000000 --- a/scripts/models/qwen3.6-35B-A3B.sh +++ /dev/null @@ -1,58 +0,0 @@ -NLAYERS=40 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i str: + return ( + "--spec miles_plugins.models.qwen3_5 get_qwen3_5_spec " + "--disable-bias-linear " + "--qk-layernorm " + "--group-query-attention " + "--num-attention-heads 16 " + "--num-query-groups 2 " + "--kv-channels 256 " + "--num-layers 40 " + "--hidden-size 2048 " + "--ffn-hidden-size 512 " + "--normalization RMSNorm " + "--apply-layernorm-1p " + "--position-embedding-type rope " + "--norm-epsilon 1e-6 " + "--rotary-percent 0.25 " + "--swiglu " + "--untie-embeddings-and-output-weights " + "--vocab-size 248320 " + "--rotary-base 10000000 " + # moe + "--moe-ffn-hidden-size 512 " + "--moe-shared-expert-intermediate-size 512 " + "--moe-router-score-function softmax " + "--moe-token-dispatcher-type alltoall " + "--moe-router-topk 8 " + f"--moe-layer-freq {moe_layer_freq(nlayers=NLAYERS, first_k_dense_replace=FIRST_K_DENSE_REPLACE)} " + "--num-experts 256 " + "--moe-grouped-gemm " + "--moe-token-drop-policy probs " + "--moe-router-dtype fp32 " + "--moe-permute-fusion " + "--moe-aux-loss-coeff 0 " + # qwen3.6 specific (same architecture as qwen3.5) + "--attention-output-gate " + "--moe-shared-expert-gate " + "--mtp-num-layers 1 " + ) diff --git a/scripts/models/qwen3.6-35B-A3B_lora.sh b/scripts/models/qwen3.6-35B-A3B_lora.sh deleted file mode 100644 index cca1ee1139..0000000000 --- a/scripts/models/qwen3.6-35B-A3B_lora.sh +++ /dev/null @@ -1,62 +0,0 @@ -NLAYERS=40 -FIRST_K_DENSE_REPLACE=0 - -arr=() -for ((i=0; i/dev/null && pwd)" -source "${SCRIPT_DIR}/models/deepseek-v3.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "deepseek-v3")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/DeepSeek-R1/ #--hf-checkpoint $BASE_DIR/DeepSeek-R1-bf16/ diff --git a/scripts/run-glm4-9B-4xgpu-radixtree.sh b/scripts/run-glm4-9B-4xgpu-radixtree.sh index dbebcd3782..2d0b0f2a17 100755 --- a/scripts/run-glm4-9B-4xgpu-radixtree.sh +++ b/scripts/run-glm4-9B-4xgpu-radixtree.sh @@ -26,8 +26,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/glm4-9B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "glm4-9B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/GLM-Z1-9B-0414/ --ref-load /root/GLM-Z1-9B-0414_torch_dist diff --git a/scripts/run-glm4-9B.sh b/scripts/run-glm4-9B.sh index 84080ae63b..b45ecde988 100644 --- a/scripts/run-glm4-9B.sh +++ b/scripts/run-glm4-9B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/glm4-9B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "glm4-9B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/GLM-Z1-9B-0414/ --ref-load /root/GLM-Z1-9B-0414_torch_dist diff --git a/scripts/run-glm4.5-355B-A32B.sh b/scripts/run-glm4.5-355B-A32B.sh index 36e3366e0c..dc0c1a6944 100644 --- a/scripts/run-glm4.5-355B-A32B.sh +++ b/scripts/run-glm4.5-355B-A32B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/glm4.5-355B-A32B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "glm4.5-355B-A32B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/GLM-4.5-355B-A32B --ref-load $BASE_DIR/GLM-4.5-355B-A32B_torch_dist/ diff --git a/scripts/run-glm4.7-flash.sh b/scripts/run-glm4.7-flash.sh index 18e58fa88e..06a8192fad 100644 --- a/scripts/run-glm4.7-flash.sh +++ b/scripts/run-glm4.7-flash.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/../scripts/models/glm4.7-flash.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "glm4.7-flash")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" BASE_DIR=/root/shared CKPT_ARGS=( diff --git a/scripts/run-gpt-oss-20b-bf16.sh b/scripts/run-gpt-oss-20b-bf16.sh index 6ad71ce4c2..4cf823ee1b 100644 --- a/scripts/run-gpt-oss-20b-bf16.sh +++ b/scripts/run-gpt-oss-20b-bf16.sh @@ -18,8 +18,8 @@ export HF_HOME=/workspace/hf_cache # Load model architecture config SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/gpt-oss-20b.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "gpt-oss-20b")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" BASE_DIR=/root/shared CKPT_ARGS=( diff --git a/scripts/run-kimi-k2-Instruct.sh b/scripts/run-kimi-k2-Instruct.sh index 525f63c6a7..f2e6474203 100644 --- a/scripts/run-kimi-k2-Instruct.sh +++ b/scripts/run-kimi-k2-Instruct.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/kimi-k2.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "kimi-k2")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/Kimi-K2-Instruct/ # --hf-checkpoint $BASE_DIR/Kimi-K2-bf16/ diff --git a/scripts/run-kimi-k2-Thinking.sh b/scripts/run-kimi-k2-Thinking.sh index d603fedb47..da6b0371e1 100644 --- a/scripts/run-kimi-k2-Thinking.sh +++ b/scripts/run-kimi-k2-Thinking.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/kimi-k2-thinking.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "kimi-k2-thinking")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( # --hf-checkpoint $BASE_DIR/Kimi-K2-Thinking-bf16/ --hf-checkpoint $BASE_DIR/Kimi-K2-Thinking-fp8/ diff --git a/scripts/run-kimi-k25.sh b/scripts/run-kimi-k25.sh index e0ec3ccccc..01c82e7e1c 100755 --- a/scripts/run-kimi-k25.sh +++ b/scripts/run-kimi-k25.sh @@ -27,8 +27,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/kimi-k2-thinking.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "kimi-k2-thinking")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/Kimi-K2.5-int4 --ref-load $BASE_DIR/Kimi-K2.5-bf16 diff --git a/scripts/run-mimo-7B-rl-eagle.sh b/scripts/run-mimo-7B-rl-eagle.sh index 2efbc2d6be..3d7fa6f771 100644 --- a/scripts/run-mimo-7B-rl-eagle.sh +++ b/scripts/run-mimo-7B-rl-eagle.sh @@ -25,8 +25,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/mimo-7B-rl.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "mimo-7B-rl")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/MiMo-7B-RL #--hf-checkpoint /root/Qwen3-4B-FP8 diff --git a/scripts/run-moonlight-16B-A3B.sh b/scripts/run-moonlight-16B-A3B.sh index 69a66fdfc4..772a7c279f 100644 --- a/scripts/run-moonlight-16B-A3B.sh +++ b/scripts/run-moonlight-16B-A3B.sh @@ -25,8 +25,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/moonlight.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "moonlight")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Moonlight-16B-A3B --ref-load /root/Moonlight-16B-A3B_torch_dist diff --git a/scripts/run-nemotron-3-nano-30b-a3b.sh b/scripts/run-nemotron-3-nano-30b-a3b.sh index 4123adb882..c405eead79 100755 --- a/scripts/run-nemotron-3-nano-30b-a3b.sh +++ b/scripts/run-nemotron-3-nano-30b-a3b.sh @@ -21,8 +21,8 @@ if [ "$NVLINK_COUNT" -gt 0 ]; then HAS_NVLINK=1; else HAS_NVLINK=0; fi echo "HAS_NVLINK: $HAS_NVLINK" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/nemotron-3-nano-30b-a3b.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "nemotron-3-nano-30b-a3b")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 --ref-load $BASE_DIR/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 diff --git a/scripts/run-nemotron-3-nano-4b.sh b/scripts/run-nemotron-3-nano-4b.sh index dfdfe7743b..3316085ba6 100644 --- a/scripts/run-nemotron-3-nano-4b.sh +++ b/scripts/run-nemotron-3-nano-4b.sh @@ -26,8 +26,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/nemotron-3-nano-4b.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "nemotron-3-nano-4b")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint $BASE_DIR/NVIDIA-Nemotron-3-Nano-4B-BF16 --ref-load $BASE_DIR/NVIDIA-Nemotron-3-Nano-4B-BF16 diff --git a/scripts/run-nemotron-3-super-120b-a12b.sh b/scripts/run-nemotron-3-super-120b-a12b.sh index fd1e31f146..54f77e66b8 100755 --- a/scripts/run-nemotron-3-super-120b-a12b.sh +++ b/scripts/run-nemotron-3-super-120b-a12b.sh @@ -45,8 +45,8 @@ if [[ "$ROLE" == "worker" ]]; then fi SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/nemotron-3-super-120b-a12b.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "nemotron-3-super-120b-a12b")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" MODELS_DIR=${MODELS_DIR:-/cluster_public/miles_data/models} DATASETS_DIR=${DATASETS_DIR:-/cluster_public/miles_data/datasets} diff --git a/scripts/run-qwen3-235B-A22B-sft.sh b/scripts/run-qwen3-235B-A22B-sft.sh index a5a801c4c8..3233241189 100644 --- a/scripts/run-qwen3-235B-A22B-sft.sh +++ b/scripts/run-qwen3-235B-A22B-sft.sh @@ -35,8 +35,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-235B-A22B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-235B-A22B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint ${BASE_FOLDER}/Qwen3-235B-A22B --ref-load ${BASE_FOLDER}/Qwen3-235B-A22B_torch_dist diff --git a/scripts/run-qwen3-235B-A22B.sh b/scripts/run-qwen3-235B-A22B.sh index 45067036fb..51cb60afbd 100644 --- a/scripts/run-qwen3-235B-A22B.sh +++ b/scripts/run-qwen3-235B-A22B.sh @@ -35,8 +35,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-235B-A22B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-235B-A22B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint ${BASE_FOLDER}/Qwen3-235B-A22B-FP8 --ref-load ${BASE_FOLDER}/Qwen3-235B-A22B_torch_dist diff --git a/scripts/run-qwen3-32B.sh b/scripts/run-qwen3-32B.sh index 156bcf5d03..92b5f6ce30 100644 --- a/scripts/run-qwen3-32B.sh +++ b/scripts/run-qwen3-32B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-32B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-32B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-32B --ref-load /root/Qwen3-32B_torch_dist/ diff --git a/scripts/run-qwen3-4B-base-sft.sh b/scripts/run-qwen3-4B-base-sft.sh index a30209f750..e8acefd9ea 100644 --- a/scripts/run-qwen3-4B-base-sft.sh +++ b/scripts/run-qwen3-4B-base-sft.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B-Base/ --ref-load /root/Qwen3-4B-Base_torch_dist diff --git a/scripts/run-qwen3-4B.sh b/scripts/run-qwen3-4B.sh index 2285cf57c0..d52e732fbe 100644 --- a/scripts/run-qwen3-4B.sh +++ b/scripts/run-qwen3-4B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B #--hf-checkpoint /root/Qwen3-4B-FP8 diff --git a/scripts/run-qwen3-4B_4xgpu.sh b/scripts/run-qwen3-4B_4xgpu.sh index 085266c7dd..54a268e657 100755 --- a/scripts/run-qwen3-4B_4xgpu.sh +++ b/scripts/run-qwen3-4B_4xgpu.sh @@ -26,8 +26,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3-4B #--hf-checkpoint /root/Qwen3-4B-FP8 diff --git a/scripts/run-qwen3-next-80B-A3B-8gpus.sh b/scripts/run-qwen3-next-80B-A3B-8gpus.sh index bc110cf43b..e8e2aee2c8 100644 --- a/scripts/run-qwen3-next-80B-A3B-8gpus.sh +++ b/scripts/run-qwen3-next-80B-A3B-8gpus.sh @@ -35,8 +35,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-next-80B-A3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-next-80B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint ${BASE_FOLDER}/Qwen3-Next-80B-A3B-Thinking --ref-load ${BASE_FOLDER}/Qwen3-Next-80B-A3B-Thinking_torch_dist diff --git a/scripts/run-qwen3-next-80B-A3B.sh b/scripts/run-qwen3-next-80B-A3B.sh index 545c8a1309..6973de821f 100644 --- a/scripts/run-qwen3-next-80B-A3B.sh +++ b/scripts/run-qwen3-next-80B-A3B.sh @@ -35,8 +35,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3-next-80B-A3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3-next-80B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint ${BASE_FOLDER}/Qwen3-Next-80B-A3B-Thinking --ref-load ${BASE_FOLDER}/Qwen3-Next-80B-A3B-Thinking_torch_dist diff --git a/scripts/run-qwen3.5-27B.sh b/scripts/run-qwen3.5-27B.sh index 3eab260fb1..4221e996ca 100644 --- a/scripts/run-qwen3.5-27B.sh +++ b/scripts/run-qwen3.5-27B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3.5-27B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3.5-27B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3.5-27B --ref-load /root/Qwen3.5-27B_torch_dist diff --git a/scripts/run-qwen3.5-35B-A3B-mtp.sh b/scripts/run-qwen3.5-35B-A3B-mtp.sh index 062d99686e..cc8122645a 100755 --- a/scripts/run-qwen3.5-35B-A3B-mtp.sh +++ b/scripts/run-qwen3.5-35B-A3B-mtp.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3.5-35B-A3B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3.5-35B-A3B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3.5-35B-A3B --ref-load /root/Qwen3.5-35B-A3B_torch_dist diff --git a/scripts/run-qwen3.5-4B.sh b/scripts/run-qwen3.5-4B.sh index 7fce9bdae9..c9278f6ef8 100644 --- a/scripts/run-qwen3.5-4B.sh +++ b/scripts/run-qwen3.5-4B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3.5-4B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3.5-4B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3.5-4B --ref-load /root/Qwen3.5-4B_torch_dist diff --git a/scripts/run-qwen3.5-9B.sh b/scripts/run-qwen3.5-9B.sh index 7664feb47b..66db36dfaf 100644 --- a/scripts/run-qwen3.5-9B.sh +++ b/scripts/run-qwen3.5-9B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3.5-9B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3.5-9B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" CKPT_ARGS=( --hf-checkpoint /root/Qwen3.5-9B --ref-load /root/Qwen3.5-9B_torch_dist diff --git a/scripts/run-qwen3.6-27B.sh b/scripts/run-qwen3.6-27B.sh index dbe7c7c2c0..c7b66f2ad1 100755 --- a/scripts/run-qwen3.6-27B.sh +++ b/scripts/run-qwen3.6-27B.sh @@ -24,8 +24,8 @@ fi echo "HAS_NVLINK: $HAS_NVLINK (detected $NVLINK_COUNT NVLink references)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${SCRIPT_DIR}/models/qwen3.6-27B.sh" - +MODEL_ARGS_LINE="$(python3 "${SCRIPT_DIR}/../miles/utils/external_utils/model_args_utils.py" "qwen3.6-27B")" || exit 1 +read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" MODEL_DIR="${MODEL_DIR:-/cluster_public/miles_data/models}" DATA_DIR="${DATA_DIR:-/cluster_public/miles_data/datasets}" OUTPUT_DIR="${OUTPUT_DIR:?set OUTPUT_DIR to a writable checkpoint directory}" diff --git a/scripts/run_gemma_4_26b_a4b.py b/scripts/run_gemma_4_26b_a4b.py index f654badc13..c87b86438a 100644 --- a/scripts/run_gemma_4_26b_a4b.py +++ b/scripts/run_gemma_4_26b_a4b.py @@ -4,7 +4,7 @@ Trained via the HF<->Megatron bridge (`--megatron-to-hf-mode bridge`) on the base VLM checkpoint directly — sglang runs Gemma4ForConditionalGeneration (hybrid swa), which loads gemma-4's hybrid head_dim weights correctly. MODEL_ARGS come from -scripts/models/gemma-4-26b-a4b-it.sh. +scripts/models/gemma-4-26b-a4b-it.py. Single-node smoke test: python scripts/run_gemma_4_26b_a4b.py full-train --num-nodes 1 diff --git a/scripts/run_gemma_4_31b.py b/scripts/run_gemma_4_31b.py index 8e8f40a67a..81d83739de 100644 --- a/scripts/run_gemma_4_31b.py +++ b/scripts/run_gemma_4_31b.py @@ -5,7 +5,7 @@ parallelism. Trained via the HF<->Megatron bridge (`--megatron-to-hf-mode bridge`); the dense config is driven directly through Gemma4VLBridge, so there is no LLM-view rewrite or offline conversion — `prepare` only downloads. -MODEL_ARGS come from scripts/models/gemma-4-31b-it.sh. +MODEL_ARGS come from scripts/models/gemma-4-31b-it.py. Requires the radixark/Megatron-Bridge gemma4-dense branch. diff --git a/scripts/run_inkling.py b/scripts/run_inkling.py index df3c59e8d0..a59a15952c 100644 --- a/scripts/run_inkling.py +++ b/scripts/run_inkling.py @@ -68,7 +68,7 @@ app = typer.Typer() -# model name -> scripts/models/.sh; the 4-layer slices reuse the base +# model name -> scripts/models/.py; the 4-layer slices reuse the base # definition with MODEL_ARGS_NUM_LAYERS=4 (set in ScriptArgs.__post_init__) _MODEL_REGISTRY = { "Inkling": "inkling", diff --git a/scripts/run_kimi_k25.py b/scripts/run_kimi_k25.py index 589c540f20..00e92821c3 100644 --- a/scripts/run_kimi_k25.py +++ b/scripts/run_kimi_k25.py @@ -8,7 +8,7 @@ weights for the SGLang rollout while Megatron loads a BF16 reference via the HF<->Megatron bridge (`--megatron-to-hf-mode bridge`), so there is no offline `torch_dist` conversion step. The architecture is shared with Kimi-K2-Thinking, -whose Megatron MODEL_ARGS we reuse (`scripts/models/kimi-k2-thinking.sh`). +whose Megatron MODEL_ARGS we reuse (`scripts/models/kimi-k2-thinking.py`). ===================== diff --git a/tests/e2e/sglang/test_r3_router_equivalence.py b/tests/e2e/sglang/test_r3_router_equivalence.py index 5ade9d0d43..3334cdfe65 100644 --- a/tests/e2e/sglang/test_r3_router_equivalence.py +++ b/tests/e2e/sglang/test_r3_router_equivalence.py @@ -32,7 +32,7 @@ Backend / checkpoint ~~~~~~~~~~~~~~~~~~~~ Megatron backend (same as the sibling ``tests/e2e/megatron/*_r3.py`` -tests) — sourcing ``scripts/models/{type}.sh`` populates +tests) — loading ``scripts/models/{type}.py`` populates ``args.num_layers`` / ``args.moe_router_topk`` that the rollout-side reshape of ``routed_experts`` depends on. We do *not* set ``--use-kl-loss`` or ``--kl-coef`` > 0, which is what gates the diff --git a/tests/fast/launch_scripts/model_args_harness.py b/tests/fast/launch_scripts/model_args_harness.py index ceaa42a47d..516927958e 100644 --- a/tests/fast/launch_scripts/model_args_harness.py +++ b/tests/fast/launch_scripts/model_args_harness.py @@ -1,31 +1,14 @@ -import subprocess - from tests.fast.launch_scripts.sh_harness import REPO_ROOT -MODEL_SCRIPT_DIR = REPO_ROOT / "scripts" / "models" +from miles.utils.external_utils.model_args_utils import load_model_args -_ENV_WITHOUT_THE_MODEL_ARGS_KNOBS = { - "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "HOME": "/root", - "LANG": "C", - "LC_ALL": "C", -} +MODEL_SCRIPT_DIR = REPO_ROOT / "scripts" / "models" def iter_model_types() -> list[str]: - return sorted(path.stem for path in MODEL_SCRIPT_DIR.glob("*.sh")) + return sorted(path.stem for path in MODEL_SCRIPT_DIR.glob("*.py")) def expand_model_args(model_type: str) -> list[str]: - """The golden files are taken from this shell expansion; whatever replaces it must reproduce them.""" - script = MODEL_SCRIPT_DIR / f"{model_type}.sh" - result = subprocess.run( - f'source "{script}" && printf "%s\\n" "${{MODEL_ARGS[@]}}"', - shell=True, - executable="/bin/bash", - env=_ENV_WITHOUT_THE_MODEL_ARGS_KNOBS, - capture_output=True, - text=True, - check=True, - ) - return result.stdout.splitlines() + """Only the producer changed here; the golden files still hold what the shell era expanded to.""" + return load_model_args(model_type).split() diff --git a/tests/fast/launch_scripts/py_harness.py b/tests/fast/launch_scripts/py_harness.py index d50baf9e67..9690989669 100644 --- a/tests/fast/launch_scripts/py_harness.py +++ b/tests/fast/launch_scripts/py_harness.py @@ -1,10 +1,8 @@ import ast -import importlib.util import inspect import os import re import subprocess -import sys import time from collections.abc import Iterator from contextlib import contextmanager @@ -16,6 +14,7 @@ from tests.fast.utils.command_recorder import record_commands import miles.utils.external_utils.command_utils as command_utils +from miles.utils.external_utils.model_args_utils import import_module_from_path FROZEN_RUN_ID = "260101-000000-000" @@ -126,15 +125,7 @@ def fake_encode_pseudo_file(text: str) -> str: def import_launch_script(path: Path) -> ModuleType: name = "miles_launch_script_" + path.relative_to(REPO_ROOT).with_suffix("").as_posix().replace("/", "_") - spec = importlib.util.spec_from_file_location(name, path) - assert spec is not None and spec.loader is not None - module = importlib.util.module_from_spec(spec) - sys.modules[name] = module - try: - spec.loader.exec_module(module) - finally: - del sys.modules[name] - return module + return import_module_from_path(path, name) @contextmanager diff --git a/tests/fast/launch_scripts/sh_harness.py b/tests/fast/launch_scripts/sh_harness.py index c3069e8f70..16bbbfbab3 100644 --- a/tests/fast/launch_scripts/sh_harness.py +++ b/tests/fast/launch_scripts/sh_harness.py @@ -66,6 +66,7 @@ } _PYTHON_SHIM_BODY = """case "${1:-}" in +*/model_args_utils.py) "$MILES_SH_HARNESS_REAL_PYTHON" "$@" ;; -c) case "$2" in *cluster_resources*) printf '%s\\n' 'REPLACE_GPU_COUNT' ;; diff --git a/tests/fast/launch_scripts/test_sh_harness.py b/tests/fast/launch_scripts/test_sh_harness.py index c0de9fc1b0..f91a3163b7 100644 --- a/tests/fast/launch_scripts/test_sh_harness.py +++ b/tests/fast/launch_scripts/test_sh_harness.py @@ -60,7 +60,7 @@ def test_ray_start_is_recorded_with_the_frozen_master_addr(self, run): assert ray_start[ray_start.index("--node-ip-address") + 1] == "127.0.0.1" def test_ray_job_submit_argv_contains_the_expanded_model_args(self, run): - """`source scripts/models/*.sh` expansion must be visible in the captured argv.""" + """The scripts/models/*.py expansion must be visible in the captured argv.""" argv = run.ray_job_submit_argv() assert argv[:3] == ["ray", "job", "submit"] assert "--num-layers" in argv diff --git a/tests/fast/launch_scripts/test_shell_script_hygiene.py b/tests/fast/launch_scripts/test_shell_script_hygiene.py index 22c4502e75..501012d41d 100644 --- a/tests/fast/launch_scripts/test_shell_script_hygiene.py +++ b/tests/fast/launch_scripts/test_shell_script_hygiene.py @@ -6,6 +6,10 @@ _REMOVED_COMMAND_HELPERS = re.compile(r"(? None: class TestRunImplExecCommand: """Only mock exec_command_gpu, generate_token_ids, write_token_ids_to_tmpfile, - and resolve_model_script — let the rest (build_worker_args, build_dumper_env, + and load_model_args — let the rest (build_worker_args, build_dumper_env, build_torchrun_cmd, ParallelConfig, WorkerScriptArgs) run for real.""" @pytest.fixture(autouse=True) @@ -58,8 +58,8 @@ def _patch_externals(self) -> Generator[None, None, None]: return_value=Path("/tmp/tokens.json"), ), patch( - "miles.utils.debug_utils.run_megatron.cli.worker_executor.resolve_model_script", - return_value=Path("/repo/scripts/models/deepseek_v3.sh"), + "miles.utils.debug_utils.run_megatron.cli.worker_executor.load_model_args", + return_value="--num-layers 61", ), ): self.mock_exec = mock_exec diff --git a/tests/fast/utils/debug_utils/run_megatron/cli/test_path_utils.py b/tests/fast/utils/debug_utils/run_megatron/cli/test_path_utils.py index 3858d58d24..7c9790ec97 100644 --- a/tests/fast/utils/debug_utils/run_megatron/cli/test_path_utils.py +++ b/tests/fast/utils/debug_utils/run_megatron/cli/test_path_utils.py @@ -29,7 +29,7 @@ class TestResolveModelScript: def test_returns_path_when_exists(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: scripts_dir = tmp_path / "scripts" / "models" scripts_dir.mkdir(parents=True) - script_file = scripts_dir / "deepseek_v3.sh" + script_file = scripts_dir / "deepseek_v3.py" script_file.touch() monkeypatch.setattr( diff --git a/tests/fast/utils/debug_utils/run_megatron/cli/test_worker_executor.py b/tests/fast/utils/debug_utils/run_megatron/cli/test_worker_executor.py index ea0aa24d8d..27f4c3929a 100644 --- a/tests/fast/utils/debug_utils/run_megatron/cli/test_worker_executor.py +++ b/tests/fast/utils/debug_utils/run_megatron/cli/test_worker_executor.py @@ -182,9 +182,9 @@ def test_no_routing_replay(self) -> None: class TestBuildTorchrunCmd: - @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.resolve_model_script") - def test_basic_structure(self, mock_resolve: object) -> None: - mock_resolve.return_value = Path("/repo/scripts/models/deepseek_v3.sh") # type: ignore[union-attr] + @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.load_model_args") + def test_basic_structure(self, mock_load: object) -> None: + mock_load.return_value = "--num-layers 61" # type: ignore[union-attr] cmd = build_torchrun_cmd( model_type="deepseek_v3", megatron_path=Path("/megatron"), @@ -192,12 +192,12 @@ def test_basic_structure(self, mock_resolve: object) -> None: worker_args="--foo bar", ) assert "torchrun" in cmd - assert "source" in cmd + assert "--num-layers 61" in cmd assert "PYTHONPATH" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.resolve_model_script") - def test_nproc(self, mock_resolve: object) -> None: - mock_resolve.return_value = Path("/repo/scripts/models/test.sh") # type: ignore[union-attr] + @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.load_model_args") + def test_nproc(self, mock_load: object) -> None: + mock_load.return_value = "--num-layers 61" # type: ignore[union-attr] cmd = build_torchrun_cmd( model_type="test", megatron_path=Path("/megatron"), @@ -206,9 +206,9 @@ def test_nproc(self, mock_resolve: object) -> None: ) assert "--nproc-per-node 8" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.resolve_model_script") - def test_worker_args_in_cmd(self, mock_resolve: object) -> None: - mock_resolve.return_value = Path("/repo/scripts/models/test.sh") # type: ignore[union-attr] + @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.load_model_args") + def test_worker_args_in_cmd(self, mock_load: object) -> None: + mock_load.return_value = "--num-layers 61" # type: ignore[union-attr] cmd = build_torchrun_cmd( model_type="test", megatron_path=Path("/megatron"), @@ -217,9 +217,9 @@ def test_worker_args_in_cmd(self, mock_resolve: object) -> None: ) assert "--my-flag 42" in cmd - @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.resolve_model_script") - def test_megatron_in_pythonpath(self, mock_resolve: object) -> None: - mock_resolve.return_value = Path("/repo/scripts/models/test.sh") # type: ignore[union-attr] + @patch("miles.utils.debug_utils.run_megatron.cli.worker_executor.load_model_args") + def test_megatron_in_pythonpath(self, mock_load: object) -> None: + mock_load.return_value = "--num-layers 61" # type: ignore[union-attr] cmd = build_torchrun_cmd( model_type="test", megatron_path=Path("/my/megatron"), diff --git a/tests/fast/utils/external_utils/test_model_args_utils.py b/tests/fast/utils/external_utils/test_model_args_utils.py new file mode 100644 index 0000000000..3b6fece1c6 --- /dev/null +++ b/tests/fast/utils/external_utils/test_model_args_utils.py @@ -0,0 +1,233 @@ +import os +import subprocess +import sys +from pathlib import Path + +import pytest + +import miles.utils.external_utils.model_args_utils as model_args_utils +from miles.utils.external_utils.model_args_utils import load_model_args, load_sibling_model_args, moe_layer_freq + +_MODEL_ARGS_CLI = Path(model_args_utils.__file__).resolve() + +_SCRIPT_BODY = """ +import os + +from model_args_utils import moe_layer_freq + + +def model_args(nlayers: int | None = None) -> str: + nlayers = nlayers if nlayers is not None else int(os.environ.get("MODEL_ARGS_NUM_LAYERS") or 61) + return ( + "--swiglu " + f"--num-layers {nlayers} " + f"--moe-layer-freq {moe_layer_freq(nlayers=nlayers, first_k_dense_replace=3)} " + ) +""" + +_WRAPPER_BODY = """ +from model_args_utils import load_sibling_model_args + + +def model_args() -> str: + return load_sibling_model_args(__file__, "fake-model.4layer", nlayers=4) +""" + + +@pytest.fixture +def model_script(monkeypatch, tmp_path): + path = tmp_path / "fake-model.4layer.py" + path.write_text(_SCRIPT_BODY) + (tmp_path / "fake-wrapper.py").write_text(_WRAPPER_BODY) + monkeypatch.setattr("miles.utils.external_utils.model_args_utils.MODEL_SCRIPT_DIR", tmp_path) + monkeypatch.delenv("MODEL_ARGS_NUM_LAYERS", raising=False) + return path + + +class TestLoadModelArgsSplitting: + def test_splits_each_line_the_way_read_ra_would(self, model_script): + """One source line per flag must expand to the same argv the shell array held.""" + assert load_model_args("fake-model.4layer").split()[:3] == ["--swiglu", "--num-layers", "61"] + + def test_collapses_a_declaration_that_spans_several_lines(self, model_script): + """A newline makes the launcher's `read -ra ... <<< "$(...)"` stop after the first line, silently.""" + model_script.write_text("def model_args() -> str:\n return '--a 1\\n--b 2'\n") + + assert load_model_args("fake-model.4layer") == "--a 1 --b 2" + + def test_rejects_a_model_script_that_declares_nothing(self, model_script): + """An all-whitespace declaration is a generator bug, not an empty argument.""" + model_script.write_text("def model_args() -> str:\n return ' '\n") + + with pytest.raises(AssertionError): + load_model_args("fake-model.4layer") + + def test_keeps_the_bracket_patterns_megatron_expects(self, model_script): + """--moe-layer-freq values contain brackets and stars, which must survive as one token.""" + model_script.write_text("def model_args() -> str:\n return '--moe-layer-freq [0]*3+[1]*75'\n") + + assert load_model_args("fake-model.4layer") == "--moe-layer-freq [0]*3+[1]*75" + + +class TestMoeLayerFreq: + def test_renders_the_dense_prefix_then_moe_layers(self): + """The mask must match `arr+=(0)` for the first K layers and `arr+=(1)` after.""" + assert moe_layer_freq(nlayers=5, first_k_dense_replace=2) == "[0,0,1,1,1]" + + def test_renders_only_dense_layers_when_the_model_is_shorter_than_the_dense_prefix(self): + """The shell loop ran over the layer count, so a 2-layer deepseek-v3 got [0,0], not [0,0,0].""" + assert moe_layer_freq(nlayers=2, first_k_dense_replace=3) == "[0,0]" + + def test_renders_an_all_moe_mask_when_no_dense_layers(self): + """DeepSeek V4 has no dense prefix, so every entry is a MoE layer.""" + assert moe_layer_freq(nlayers=3, first_k_dense_replace=0) == "[1,1,1]" + + +class TestLoadModelArgs: + def test_returns_the_declared_argv(self, model_script): + """A python consumer gets argv tokens directly instead of sourcing a shell script.""" + assert load_model_args("fake-model.4layer").split() == [ + "--swiglu", + "--num-layers", + "61", + "--moe-layer-freq", + moe_layer_freq(nlayers=61, first_k_dense_replace=3), + ] + + def test_forwards_keyword_overrides(self, model_script): + """Layer-count variants are the same script called with a different argument.""" + assert load_model_args("fake-model.4layer", nlayers=4).split()[2] == "4" + + def test_rejects_an_unknown_model_type(self, model_script): + """A typo must fail loudly rather than silently produce an argument-less run.""" + with pytest.raises(AssertionError): + load_model_args("no-such-model") + + def test_a_dotted_filename_is_importable(self, model_script): + """Model names like glm4.5-106B-A12B cannot be imported by module path.""" + assert "." in model_script.stem + assert load_model_args(model_script.stem) + + def test_reads_the_model_scripts_of_the_requested_checkout(self, model_script, tmp_path_factory): + """A launcher must get the model definition of its own checkout, not of the installed package.""" + other = tmp_path_factory.mktemp("other-checkout") + (other / model_script.name).write_text( + _SCRIPT_BODY.replace('"MODEL_ARGS_NUM_LAYERS") or 61', '"UNUSED") or 7') + ) + + assert load_model_args(model_script.stem, model_script_dir=other).split()[2] == "7" + + def test_a_wrapper_stays_inside_the_checkout_it_was_loaded_from(self, model_script, tmp_path_factory): + """A variant script must reach the base script next to it, not the one of the installed package.""" + other = tmp_path_factory.mktemp("other-checkout") + (other / "fake-wrapper.py").write_text(_WRAPPER_BODY) + (other / model_script.name).write_text( + _SCRIPT_BODY.replace('"MODEL_ARGS_NUM_LAYERS") or 61', '"UNUSED") or 7') + ) + + assert load_model_args("fake-wrapper", model_script_dir=other).split() == ["--swiglu", "--num-layers", "4"] + [ + "--moe-layer-freq", + moe_layer_freq(nlayers=4, first_k_dense_replace=3), + ] + + def test_still_honours_the_environment_override_the_shell_scripts_read(self, model_script, monkeypatch): + """MODEL_ARGS_NUM_LAYERS used to reach the sourced .sh, so it must reach the .py too.""" + monkeypatch.setenv("MODEL_ARGS_NUM_LAYERS", "9") + + assert load_model_args("fake-model.4layer").split()[2] == "9" + + def test_ignores_an_empty_environment_override(self, model_script, monkeypatch): + """`${VAR:-default}` falls back to the default when the variable is set but empty.""" + monkeypatch.setenv("MODEL_ARGS_NUM_LAYERS", "") + + assert load_model_args("fake-model.4layer").split()[2] == "61" + + def test_an_explicit_override_beats_the_environment(self, model_script, monkeypatch): + """`MODEL_ARGS_NUM_LAYERS=5 source x.sh` let the caller's assignment win; keyword arguments must too.""" + monkeypatch.setenv("MODEL_ARGS_NUM_LAYERS", "9") + + assert load_model_args("fake-model.4layer", nlayers=4).split()[2] == "4" + + def test_honours_a_zero_override(self, model_script): + """A dense-layer count of zero is a real value; `x or default` would silently restore the default.""" + model_script.write_text(_SCRIPT_BODY.replace("first_k_dense_replace=3", "first_k_dense_replace=nlayers")) + + assert load_model_args("fake-model.4layer", nlayers=0) == "--swiglu --num-layers 0 --moe-layer-freq []" + + def test_ignores_an_environment_override_the_model_does_not_declare(self, model_script, monkeypatch): + """A model without a rotary base must not fail because some other model's variable is exported.""" + monkeypatch.setenv("MODEL_ARGS_ROTARY_BASE", "5000000") + + assert load_model_args("fake-model.4layer").split()[2] == "61" + + def test_rejects_an_override_the_model_does_not_declare(self, model_script): + """The keyword reaches model_args() directly, so a misspelling is a TypeError rather than a silent no-op.""" + with pytest.raises(TypeError): + load_model_args("fake-model.4layer", n_layers=4) + + +class TestLoadSiblingModelArgs: + def test_resolves_the_base_next_to_the_variant_script(self, model_script, tmp_path_factory): + """The variant knows where it lives; nothing else in the process does.""" + other = tmp_path_factory.mktemp("sibling-checkout") + (other / model_script.name).write_text( + _SCRIPT_BODY.replace('"MODEL_ARGS_NUM_LAYERS") or 61', '"UNUSED") or 7') + ) + + assert load_sibling_model_args(str(other / "anything.py"), model_script.stem).split()[2] == "7" + + +class TestModelArgsScript: + def test_shell_consumers_recover_the_original_tokens(self): + """Bracket patterns must survive read -ra without being glob-expanded.""" + script = ( + f'set -e; MODEL_ARGS_LINE="$({sys.executable} {_MODEL_ARGS_CLI} qwen3-4B)" || exit 1; ' + 'read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}"; printf "%s\\n" "${MODEL_ARGS[@]}"' + ) + result = subprocess.run(["bash", "-c", script], capture_output=True, text=True, check=True) + + assert result.stdout.splitlines() == load_model_args("qwen3-4B").split() + + def test_an_unknown_model_type_stops_the_launcher(self): + """A bare `read -ra ... <<< "$(...)"` swallows the failure and trains with no architecture flags.""" + script = ( + f'MODEL_ARGS_LINE="$({sys.executable} {_MODEL_ARGS_CLI} no-such-model 2>/dev/null)" || exit 1; ' + 'echo "the launcher kept going"' + ) + result = subprocess.run(["bash", "-c", script], capture_output=True, text=True) + + assert result.returncode == 1 + assert result.stdout == "" + + def test_a_here_string_read_stops_at_the_first_line(self): + """Why load_model_args() collapses its result: read -ra drops the rest of a multi-line value silently.""" + script = 'read -ra MODEL_ARGS <<< "$1"; printf "%s\\n" "${MODEL_ARGS[@]}"' + result = subprocess.run( + ["bash", "-c", script, "_", "--a 1\n--b 2"], capture_output=True, text=True, check=True + ) + + assert result.stdout.split() == ["--a", "1"] + + def test_runs_from_a_checkout_whose_package_is_not_installed(self): + """Executed by path with no site-packages, a model script must still reach the loader's helpers.""" + result = subprocess.run( + [sys.executable, "-S", "-E", str(_MODEL_ARGS_CLI), "qwen3-30B-A3B"], + capture_output=True, + text=True, + check=True, + cwd="/", + ) + + assert "--num-layers" in result.stdout + + def test_forwards_the_rotary_base_override(self): + """The geo3k launcher prefixes the command with MODEL_ARGS_ROTARY_BASE, as the shell scripts did.""" + result = subprocess.run( + [sys.executable, str(_MODEL_ARGS_CLI), "qwen3-4B"], + capture_output=True, + text=True, + check=True, + env={**os.environ, "MODEL_ARGS_ROTARY_BASE": "5000000"}, + ) + + assert "--rotary-base 5000000" in result.stdout diff --git a/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt b/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt index ad94fb21e0..04337367e5 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/experimental/formal_math/single_round/run_minimal.py/import.txt @@ -1,8 +1,24 @@ ### 0 -bash -c export PYTHONUNBUFFERED=1 && source "/scripts/models/qwen3-8B.sh" && ray job submit +bash -c export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1"}}' - -- python3 train.py ${MODEL_ARGS[@]} + -- python3 train.py + --swiglu + --num-layers 36 + --hidden-size 4096 + --ffn-hidden-size 12288 + --num-attention-heads 32 + --group-query-attention + --num-query-groups 8 + --use-rotary-position-embeddings + --disable-bias-linear + --normalization RMSNorm + --norm-epsilon 1e-6 + --rotary-base 1000000 + --vocab-size 151936 + --kv-channels 128 + --qk-layernorm + --untie-embeddings-and-output-weights --hf-checkpoint /root/models/Qwen3-8B/ --ref-load /root/models/Qwen3-8B_torch_dist --save-interval 20 diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt index 4a24915d1f..316ebbc221 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=1000000 python3 "/miles/utils/external_utils/model_args_utils.py" glm4.5-106B-A12B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt index b992f74774..a839b640b9 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.5-Air/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/glm4.5-106B-A12B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=1000000 python3 "/miles/utils/external_utils/model_args_utils.py" glm4.5-106B-A12B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt index 433f05bf26..c4dec6d382 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm4.7-flash.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm4.7-flash)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt index fd2c92f05f..0758e1a264 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-4.7-Flash/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm4.7-flash.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm4.7-flash)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt index 878aae279c..6a1821a529 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt index 84ba31d392..8a9ec08070 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt index f2e0345b5d..66c44a8f74 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B_20layer.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B_20layer)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt index 060b1c407c..8985ffe0ed 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_20layer/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B_20layer.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B_20layer)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt index 76fdfe325c..1ee2b15c8e 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B_4layer.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B_4layer)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt index d1012211f0..51b11f3c7c 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-5_4layer/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/glm5-744B-A40B_4layer.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm5-744B-A40B_4layer)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "600", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt index 560206d420..98d9bec599 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/broadcast.txt @@ -35,7 +35,7 @@ ray start --dashboard-port=8265 ### 10 -source "/scripts/models/glm4-9B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm4-9B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt index cb2a9a61cb..f05548c663 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/GLM-Z1-9B-0414/p2p.txt @@ -35,7 +35,7 @@ ray start --dashboard-port=8265 ### 10 -source "/scripts/models/glm4-9B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" glm4-9B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt index 115505f9e0..335c01146d 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/kimi-k2.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" kimi-k2)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt index 52de614a9d..3106137733 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Kimi-K2-Instruct/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/kimi-k2.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" kimi-k2)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt index ee975b6212..4b5032c1c7 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/moonlight.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" moonlight)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt index 5886226820..5fa21e2e52 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Moonlight-16B-A3B-Instruct/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -source "/scripts/models/moonlight.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" moonlight)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt index 225afb2058..19721090d7 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=5000000 source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=5000000 python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-235B-A22B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt index 0a96a13815..274ec40082 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-235B-A22B-Instruct-2507/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=5000000 source "/scripts/models/qwen3-235B-A22B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=5000000 python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-235B-A22B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "5000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt index 74ab1db0ca..1bcdc16346 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/broadcast.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=1000000 python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-30B-A3B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt index 259940107b..a6e57018a7 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-30B-A3B/p2p.txt @@ -39,7 +39,7 @@ RAY_memory_monitor_refresh_ms=0 ray start python3 -c "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" ### 11 -MODEL_ARGS_ROTARY_BASE=1000000 source "/scripts/models/qwen3-30B-A3B.sh" && ray job submit +MODEL_ARGS_LINE="$(MODEL_ARGS_ROTARY_BASE=1000000 python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-30B-A3B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "1", "MILES_LOG_DIR": "", "MC_TRANSFER_TIMEOUT": "300", "MODEL_ARGS_ROTARY_BASE": "1000000"}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt index 40fc615187..5a8149a76f 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/broadcast.txt @@ -35,7 +35,7 @@ ray start --dashboard-port=8265 ### 10 -source "/scripts/models/qwen3-4B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-4B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt index c89b79aaf1..7480814ef1 100644 --- a/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt +++ b/tests/snapshots/launch_scripts/self_executing/examples/infra_features/p2p_weight_transfer/run.py/run/Qwen3-4B/p2p.txt @@ -35,7 +35,7 @@ ray start --dashboard-port=8265 ### 10 -source "/scripts/models/qwen3-4B.sh" && ray job submit +MODEL_ARGS_LINE="$(python3 "/miles/utils/external_utils/model_args_utils.py" qwen3-4B)" || exit 1; read -ra MODEL_ARGS <<< "${MODEL_ARGS_LINE}" && ray job submit --address='http://127.0.0.1:8265' --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "RAY_DEBUG": "1", "PYTHONPATH": "/root/Megatron-LM/", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "MILES_LOG_DIR": ""}}' -- python3 "/train.py" ${MODEL_ARGS[@]} diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt index 4ce3827918..1b4a112ce3 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-32B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-32B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt index 24bd9216b6..14392971a5 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval/scripts/run-qwen3-4B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt index 7217c79d1f..a0a0c93801 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/eval_multi_task/multi_task.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt index 797fee6c21..6cc7ba5134 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/multi_agent/run-qwen3-30B-A3B-multi-agent.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/experimental/multi_agent/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-30B-A3B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt index 132b497801..a10b60aa56 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/reproducibility/run-qwen2.5-0.5B-gsm8k.sh.txt @@ -39,6 +39,11 @@ "python" ### 8 +"python3" +"/examples/experimental/reproducibility/../../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-0.5B" + +### 9 "ray" "start" "--head" @@ -48,7 +53,7 @@ "8" "--disable-usage-stats" -### 9 +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt index abbfec1eca..88f140e55e 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/search-r1/run_qwen2.5_3B.sh.txt @@ -39,6 +39,11 @@ "python" ### 8 +"python3" +"/examples/experimental/search-r1/../../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-3B" + +### 9 "ray" "start" "--head" @@ -48,7 +53,7 @@ "8" "--disable-usage-stats" -### 9 +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt index b7344a73b1..b11aa34737 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/strands_sglang/strands_qwen3_8b.sh.txt @@ -44,10 +44,15 @@ "-m" ### 9 +"python3" +"/examples/experimental/strands_sglang/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 10 "date" "+%Y%m%d_%H%M%S" -### 10 +### 11 "ray" "start" "--head" @@ -59,7 +64,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt b/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt index d0fb68d3d7..51b208db41 100644 --- a/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/experimental/tau-bench/run_qwen3_4B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/experimental/tau-bench/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B-Instruct-2507" + +### 10 "ray" "start" "--head" @@ -57,7 +62,7 @@ "--temp-dir" "/root/shared/ray_temp" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt b/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt index 4e35206c44..cf90b6930e 100644 --- a/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/fully_async/run-qwen3-4b-fully_async.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/fully_async/../../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -53,7 +58,7 @@ "8" "--disable-usage-stats" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt index e00be71454..dd9a072c6b 100644 --- a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm.sh.txt @@ -71,6 +71,11 @@ "/root/datasets/geo3k_imgurl" ### 13 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 14 "ray" "start" "--head" @@ -82,7 +87,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 14 +### 15 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt index a2355b5e92..55d0962960 100644 --- a/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/geo3k_vlm/run_geo3k_vlm_sft.sh.txt @@ -71,6 +71,11 @@ "/root/datasets/geo3k_imgurl" ### 13 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 14 "ray" "start" "--head" @@ -82,7 +87,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 14 +### 15 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt index c32efbf09f..cf1878c66a 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-kimi-k2-Thinking-int4.sh.txt @@ -42,6 +42,11 @@ "nvidia-smi" ### 9 +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"kimi-k2-thinking" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt index 3c647619e0..6df380bb00 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-moonlight-16B-A3B-int4.sh.txt @@ -49,6 +49,11 @@ "-m" ### 10 +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"moonlight" + +### 11 "ray" "start" "--head" @@ -60,7 +65,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt index c5f34c7d39..1b05aa7262 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-235B-A22B-int4.sh.txt @@ -42,6 +42,11 @@ "nvidia-smi" ### 9 +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-235B-A22B" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt index d0b9841772..62fe888f50 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30B-A3B-int4.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-30B-A3B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt index a89c5e24a6..7506aab474 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-30b-a3b-fp8-two-nodes.sh.txt @@ -6,14 +6,19 @@ "-m" ### 1 -"ps" -"aux" +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-30B-A3B" ### 2 "ps" "aux" ### 3 +"ps" +"aux" + +### 4 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt index 3580be18de..3877f48f96 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/low_precision/run-qwen3-4b-fp8.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/infra_features/low_precision/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt index 433a99f452..a2f17d691d 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.5-air-8node-profile.sh.txt @@ -45,10 +45,15 @@ ### 9 "python3" +"/miles/utils/external_utils/model_args_utils.py" +"glm4.5-106B-A12B" + +### 10 +"python3" "-c" "print(int(1.0 * 1024 * 1024 * 1024))" -### 10 +### 11 "ray" "start" "--head" @@ -60,22 +65,22 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 12 +### 13 "mkdir" "-p" "/workdir" -### 13 +### 14 "rm" "-f" "/workdir/job_done_p2p" -### 14 +### 15 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt index 2fcae95126..033bacb2cc 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm4.7-flash-2node-profile.sh.txt @@ -49,6 +49,11 @@ "-m" ### 10 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"glm4.7-flash" + +### 11 "ray" "start" "--head" @@ -60,12 +65,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 12 +### 13 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt index 03d6e0dd41..23363db179 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-glm5-disagg-profile.sh.txt @@ -44,6 +44,11 @@ "redis" ### 9 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"glm5-744B-A40B" + +### 10 "ray" "start" "--head" @@ -55,22 +60,22 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 11 +### 12 "mkdir" "-p" "/workdir" -### 12 +### 13 "rm" "-f" "/workdir/job_done_p2p" -### 13 +### 14 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt index b53d6ae242..724c1f63b9 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-kimi-k2-64node-profile.sh.txt @@ -49,6 +49,11 @@ "-m" ### 10 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"kimi-k2" + +### 11 "ray" "start" "--head" @@ -60,12 +65,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 12 +### 13 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt index 6576a46dad..36d913e872 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-235B-A22B-16node-profile.sh.txt @@ -50,10 +50,15 @@ ### 10 "python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-235B-A22B" + +### 11 +"python3" "-c" "print(int(1.0 * 1024 * 1024 * 1024))" -### 11 +### 12 "ray" "start" "--head" @@ -65,12 +70,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 12 +### 13 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 13 +### 14 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt index d04fe971f3..4293790491 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/p2p_weight_transfer/run-qwen3-30B-A3B-4node-profile.sh.txt @@ -49,6 +49,11 @@ "-m" ### 10 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-30B-A3B" + +### 11 "ray" "start" "--head" @@ -60,12 +65,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 12 +### 13 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt index 5d0cf0562d..0b47754d4c 100644 --- a/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/infra_features/train_infer_mismatch_helper/run-qwen3-4b-mis.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/infra_features/train_infer_mismatch_helper/../../../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt index dda91e58a8..d23df4cf68 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/dev.sh.txt @@ -29,6 +29,11 @@ "python" ### 6 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-3B" + +### 7 "ray" "start" "--head" @@ -38,7 +43,7 @@ "1" "--disable-usage-stats" -### 7 +### 8 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt index a1025b6d46..cfc63b109a 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-gpt-oss-20B-megatron-moe-lora.sh.txt @@ -39,6 +39,11 @@ "python" ### 8 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"gpt-oss-20b" + +### 9 "ray" "start" "--head" @@ -50,7 +55,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 9 +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt index 48d1e0ee36..a92c64589e 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-kimi-k25-megatron-lora.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"kimi-k2-thinking" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt index 87c29860d4..8ffdd1560a 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-0.5B-megatron-lora.sh.txt @@ -29,6 +29,11 @@ "python" ### 6 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-0.5B" + +### 7 "ray" "start" "--head" @@ -38,7 +43,7 @@ "8" "--disable-usage-stats" -### 7 +### 8 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt index a0c726c514..69deec869e 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated-multi-node.sh.txt @@ -53,6 +53,11 @@ "python" ### 10 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-3B" + +### 11 "ray" "start" "--head" @@ -64,12 +69,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "python3" "-c" "import ray; ray.init(address='auto', ignore_reinit_error=True); print(int(ray.cluster_resources().get('GPU', 0))); ray.shutdown()" -### 12 +### 13 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt index f6c62b12ad..ef8dee4b7a 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen2.5-3B-megatron-lora-disaggregated.sh.txt @@ -29,6 +29,11 @@ "python" ### 6 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"qwen2.5-3B" + +### 7 "ray" "start" "--head" @@ -38,7 +43,7 @@ "2" "--disable-usage-stats" -### 7 +### 8 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt index e70fe24e1c..6864acd787 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4B-megatron-lora.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt index c7444461f4..82a5466201 100644 --- a/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/lora/run-qwen3-4b-megatron-lora-result.sh.txt @@ -42,6 +42,11 @@ "nvidia-smi" ### 9 +"python3" +"/examples/lora/../../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -51,7 +56,7 @@ "4" "--disable-usage-stats" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt index d4a648418a..d746325862 100644 --- a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-megatron.sh.txt @@ -6,6 +6,11 @@ "-m" ### 1 +"python3" +"/examples/on_policy_distillation/../../miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 2 "ray" "start" "--head" @@ -17,7 +22,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 2 +### 3 "ray" "job" "submit" @@ -150,40 +155,40 @@ "--rm-type" "math" -### 3 +### 4 "pkill" "-9" "sglang" -### 4 +### 5 "sleep" "3" -### 5 +### 6 "ray" "stop" "--force" -### 6 +### 7 "pkill" "-9" "ray" -### 7 +### 8 "pkill" "-9" "python" -### 8 +### 9 "sleep" "3" -### 9 +### 10 "pkill" "-9" "ray" -### 10 +### 11 "pkill" "-9" "python" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt index 590060a19f..2ee5f94bad 100644 --- a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd-multi-teacher.sh.txt @@ -71,6 +71,11 @@ "-m" ### 10 +"python3" +"/examples/on_policy_distillation/../../miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 11 "ray" "start" "--head" @@ -82,7 +87,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "ray" "job" "submit" @@ -227,40 +232,40 @@ "--opd-teacher-key" "opd_teacher" -### 12 +### 13 "pkill" "-9" "sglang" -### 13 +### 14 "sleep" "3" -### 14 +### 15 "ray" "stop" "--force" -### 15 +### 16 "pkill" "-9" "ray" -### 16 +### 17 "pkill" "-9" "python" -### 17 +### 18 "sleep" "3" -### 18 +### 19 "pkill" "-9" "ray" -### 19 +### 20 "pkill" "-9" "python" diff --git a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt index 7e32ebd59d..33b048a20a 100644 --- a/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt +++ b/tests/snapshots/launch_scripts/sh/examples/on_policy_distillation/run-qwen3-8B-opd.sh.txt @@ -36,6 +36,11 @@ "-m" ### 5 +"python3" +"/examples/on_policy_distillation/../../miles/utils/external_utils/model_args_utils.py" +"qwen3-8B" + +### 6 "ray" "start" "--head" @@ -47,7 +52,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 6 +### 7 "ray" "job" "submit" @@ -188,40 +193,40 @@ "--rm-url" "http://127.0.0.1:13141/generate" -### 7 +### 8 "pkill" "-9" "sglang" -### 8 +### 9 "sleep" "3" -### 9 +### 10 "ray" "stop" "--force" -### 10 +### 11 "pkill" "-9" "ray" -### 11 +### 12 "pkill" "-9" "python" -### 12 +### 13 "sleep" "3" -### 13 +### 14 "pkill" "-9" "ray" -### 14 +### 15 "pkill" "-9" "python" diff --git a/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt index 05e1b71c70..553ca0e631 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/amd/run-qwen3-4B-amd.sh.txt @@ -39,6 +39,11 @@ "python" ### 8 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 9 "ray" "start" "--head" @@ -50,7 +55,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 9 +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt index c3bf834fc9..ee964dfc2f 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-deepseek-r1.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"deepseek-v3" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt index 9e5b0b4f7f..a6e70ac09f 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B-4xgpu-radixtree.sh.txt @@ -42,6 +42,11 @@ "nvidia-smi" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"glm4-9B" + +### 10 "ray" "start" "--head" @@ -53,7 +58,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt index 26f5eddcd2..36fe469186 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4-9B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"glm4-9B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt index fb0cb55235..c7af53a0b7 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.5-355B-A32B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"glm4.5-355B-A32B" + +### 10 "ray" "start" "--head" @@ -54,12 +59,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "awk" "{print $1}" "/root/mpi_rack_hostfile" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt index b1fd672585..9262d58117 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-glm4.7-flash.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"glm4.7-flash" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt index 577a4b430c..093da50e7a 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-gpt-oss-20b-bf16.sh.txt @@ -39,6 +39,11 @@ "python" ### 8 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"gpt-oss-20b" + +### 9 "ray" "start" "--head" @@ -50,7 +55,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 9 +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt index 66dad480f7..11a38513a3 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Instruct.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"kimi-k2" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt index 88a8cd890f..fc6e3a6def 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k2-Thinking.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"kimi-k2-thinking" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt index 909108edc3..47cb8d8e81 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-kimi-k25.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"kimi-k2-thinking" + +### 10 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt index b8b62f4995..9fa1648672 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-mimo-7B-rl-eagle.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"mimo-7B-rl" + +### 10 "ray" "start" "--head" @@ -53,7 +58,7 @@ "8" "--disable-usage-stats" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt index b71b7296de..278c7479a2 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-moonlight-16B-A3B.sh.txt @@ -49,6 +49,11 @@ "-m" ### 10 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"moonlight" + +### 11 "ray" "start" "--head" @@ -60,7 +65,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt index 3e128f7144..fa7ca0d683 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-30b-a3b.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"nemotron-3-nano-30b-a3b" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt index 25060e5996..908fb643bb 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-nano-4b.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"nemotron-3-nano-4b" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt index 97010455b1..d19fef80bc 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-nemotron-3-super-120b-a12b.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"nemotron-3-super-120b-a12b" + +### 10 "ray" "start" "--head" @@ -55,971 +60,971 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "status" -### 11 +### 12 "sleep" "5" -### 12 +### 13 "ray" "status" -### 13 +### 14 "sleep" "5" -### 14 +### 15 "ray" "status" -### 15 +### 16 "sleep" "5" -### 16 +### 17 "ray" "status" -### 17 +### 18 "sleep" "5" -### 18 +### 19 "ray" "status" -### 19 +### 20 "sleep" "5" -### 20 +### 21 "ray" "status" -### 21 +### 22 "sleep" "5" -### 22 +### 23 "ray" "status" -### 23 +### 24 "sleep" "5" -### 24 +### 25 "ray" "status" -### 25 +### 26 "sleep" "5" -### 26 +### 27 "ray" "status" -### 27 +### 28 "sleep" "5" -### 28 +### 29 "ray" "status" -### 29 +### 30 "sleep" "5" -### 30 +### 31 "ray" "status" -### 31 +### 32 "sleep" "5" -### 32 +### 33 "ray" "status" -### 33 +### 34 "sleep" "5" -### 34 +### 35 "ray" "status" -### 35 +### 36 "sleep" "5" -### 36 +### 37 "ray" "status" -### 37 +### 38 "sleep" "5" -### 38 +### 39 "ray" "status" -### 39 +### 40 "sleep" "5" -### 40 +### 41 "ray" "status" -### 41 +### 42 "sleep" "5" -### 42 +### 43 "ray" "status" -### 43 +### 44 "sleep" "5" -### 44 +### 45 "ray" "status" -### 45 +### 46 "sleep" "5" -### 46 +### 47 "ray" "status" -### 47 +### 48 "sleep" "5" -### 48 +### 49 "ray" "status" -### 49 +### 50 "sleep" "5" -### 50 +### 51 "ray" "status" -### 51 +### 52 "sleep" "5" -### 52 +### 53 "ray" "status" -### 53 +### 54 "sleep" "5" -### 54 +### 55 "ray" "status" -### 55 +### 56 "sleep" "5" -### 56 +### 57 "ray" "status" -### 57 +### 58 "sleep" "5" -### 58 +### 59 "ray" "status" -### 59 +### 60 "sleep" "5" -### 60 +### 61 "ray" "status" -### 61 +### 62 "sleep" "5" -### 62 +### 63 "ray" "status" -### 63 +### 64 "sleep" "5" -### 64 +### 65 "ray" "status" -### 65 +### 66 "sleep" "5" -### 66 +### 67 "ray" "status" -### 67 +### 68 "sleep" "5" -### 68 +### 69 "ray" "status" -### 69 +### 70 "sleep" "5" -### 70 +### 71 "ray" "status" -### 71 +### 72 "sleep" "5" -### 72 +### 73 "ray" "status" -### 73 +### 74 "sleep" "5" -### 74 +### 75 "ray" "status" -### 75 +### 76 "sleep" "5" -### 76 +### 77 "ray" "status" -### 77 +### 78 "sleep" "5" -### 78 +### 79 "ray" "status" -### 79 +### 80 "sleep" "5" -### 80 +### 81 "ray" "status" -### 81 +### 82 "sleep" "5" -### 82 +### 83 "ray" "status" -### 83 +### 84 "sleep" "5" -### 84 +### 85 "ray" "status" -### 85 +### 86 "sleep" "5" -### 86 +### 87 "ray" "status" -### 87 +### 88 "sleep" "5" -### 88 +### 89 "ray" "status" -### 89 +### 90 "sleep" "5" -### 90 +### 91 "ray" "status" -### 91 +### 92 "sleep" "5" -### 92 +### 93 "ray" "status" -### 93 +### 94 "sleep" "5" -### 94 +### 95 "ray" "status" -### 95 +### 96 "sleep" "5" -### 96 +### 97 "ray" "status" -### 97 +### 98 "sleep" "5" -### 98 +### 99 "ray" "status" -### 99 +### 100 "sleep" "5" -### 100 +### 101 "ray" "status" -### 101 +### 102 "sleep" "5" -### 102 +### 103 "ray" "status" -### 103 +### 104 "sleep" "5" -### 104 +### 105 "ray" "status" -### 105 +### 106 "sleep" "5" -### 106 +### 107 "ray" "status" -### 107 +### 108 "sleep" "5" -### 108 +### 109 "ray" "status" -### 109 +### 110 "sleep" "5" -### 110 +### 111 "ray" "status" -### 111 +### 112 "sleep" "5" -### 112 +### 113 "ray" "status" -### 113 +### 114 "sleep" "5" -### 114 +### 115 "ray" "status" -### 115 +### 116 "sleep" "5" -### 116 +### 117 "ray" "status" -### 117 +### 118 "sleep" "5" -### 118 +### 119 "ray" "status" -### 119 +### 120 "sleep" "5" -### 120 +### 121 "ray" "status" -### 121 +### 122 "sleep" "5" -### 122 +### 123 "ray" "status" -### 123 +### 124 "sleep" "5" -### 124 +### 125 "ray" "status" -### 125 +### 126 "sleep" "5" -### 126 +### 127 "ray" "status" -### 127 +### 128 "sleep" "5" -### 128 +### 129 "ray" "status" -### 129 +### 130 "sleep" "5" -### 130 +### 131 "ray" "status" -### 131 +### 132 "sleep" "5" -### 132 +### 133 "ray" "status" -### 133 +### 134 "sleep" "5" -### 134 +### 135 "ray" "status" -### 135 +### 136 "sleep" "5" -### 136 +### 137 "ray" "status" -### 137 +### 138 "sleep" "5" -### 138 +### 139 "ray" "status" -### 139 +### 140 "sleep" "5" -### 140 +### 141 "ray" "status" -### 141 +### 142 "sleep" "5" -### 142 +### 143 "ray" "status" -### 143 +### 144 "sleep" "5" -### 144 +### 145 "ray" "status" -### 145 +### 146 "sleep" "5" -### 146 +### 147 "ray" "status" -### 147 +### 148 "sleep" "5" -### 148 +### 149 "ray" "status" -### 149 +### 150 "sleep" "5" -### 150 +### 151 "ray" "status" -### 151 +### 152 "sleep" "5" -### 152 +### 153 "ray" "status" -### 153 +### 154 "sleep" "5" -### 154 +### 155 "ray" "status" -### 155 +### 156 "sleep" "5" -### 156 +### 157 "ray" "status" -### 157 +### 158 "sleep" "5" -### 158 +### 159 "ray" "status" -### 159 +### 160 "sleep" "5" -### 160 +### 161 "ray" "status" -### 161 +### 162 "sleep" "5" -### 162 +### 163 "ray" "status" -### 163 +### 164 "sleep" "5" -### 164 +### 165 "ray" "status" -### 165 +### 166 "sleep" "5" -### 166 +### 167 "ray" "status" -### 167 +### 168 "sleep" "5" -### 168 +### 169 "ray" "status" -### 169 +### 170 "sleep" "5" -### 170 +### 171 "ray" "status" -### 171 +### 172 "sleep" "5" -### 172 +### 173 "ray" "status" -### 173 +### 174 "sleep" "5" -### 174 +### 175 "ray" "status" -### 175 +### 176 "sleep" "5" -### 176 +### 177 "ray" "status" -### 177 +### 178 "sleep" "5" -### 178 +### 179 "ray" "status" -### 179 +### 180 "sleep" "5" -### 180 +### 181 "ray" "status" -### 181 +### 182 "sleep" "5" -### 182 +### 183 "ray" "status" -### 183 +### 184 "sleep" "5" -### 184 +### 185 "ray" "status" -### 185 +### 186 "sleep" "5" -### 186 +### 187 "ray" "status" -### 187 +### 188 "sleep" "5" -### 188 +### 189 "ray" "status" -### 189 +### 190 "sleep" "5" -### 190 +### 191 "ray" "status" -### 191 +### 192 "sleep" "5" -### 192 +### 193 "ray" "status" -### 193 +### 194 "sleep" "5" -### 194 +### 195 "ray" "status" -### 195 +### 196 "sleep" "5" -### 196 +### 197 "ray" "status" -### 197 +### 198 "sleep" "5" -### 198 +### 199 "ray" "status" -### 199 +### 200 "sleep" "5" -### 200 +### 201 "ray" "status" -### 201 +### 202 "sleep" "5" -### 202 +### 203 "ray" "status" -### 203 +### 204 "sleep" "5" -### 204 +### 205 "ray" "status" -### 205 +### 206 "sleep" "5" -### 206 +### 207 "ray" "status" -### 207 +### 208 "sleep" "5" -### 208 +### 209 "ray" "status" -### 209 +### 210 "sleep" "5" -### 210 +### 211 "ray" "status" -### 211 +### 212 "sleep" "5" -### 212 +### 213 "ray" "status" -### 213 +### 214 "sleep" "5" -### 214 +### 215 "ray" "status" -### 215 +### 216 "sleep" "5" -### 216 +### 217 "ray" "status" -### 217 +### 218 "sleep" "5" -### 218 +### 219 "ray" "status" -### 219 +### 220 "sleep" "5" -### 220 +### 221 "ray" "status" -### 221 +### 222 "sleep" "5" -### 222 +### 223 "ray" "status" -### 223 +### 224 "sleep" "5" -### 224 +### 225 "ray" "status" -### 225 +### 226 "sleep" "5" -### 226 +### 227 "ray" "status" -### 227 +### 228 "sleep" "5" -### 228 +### 229 "ray" "status" -### 229 +### 230 "sleep" "5" -### 230 +### 231 "ray" "status" -### 231 +### 232 "sleep" "5" -### 232 +### 233 "ray" "status" -### 233 +### 234 "sleep" "5" -### 234 +### 235 "ray" "status" -### 235 +### 236 "sleep" "5" -### 236 +### 237 "ray" "status" -### 237 +### 238 "sleep" "5" -### 238 +### 239 "ray" "status" -### 239 +### 240 "sleep" "5" -### 240 +### 241 "ray" "status" -### 241 +### 242 "sleep" "5" -### 242 +### 243 "ray" "status" -### 243 +### 244 "sleep" "5" -### 244 +### 245 "ray" "status" -### 245 +### 246 "sleep" "5" -### 246 +### 247 "ray" "status" -### 247 +### 248 "sleep" "5" -### 248 +### 249 "ray" "status" -### 249 +### 250 "sleep" "5" -### 250 +### 251 "ray" "status" -### 251 +### 252 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt index e91727a97d..3915b2df14 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B-sft.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-235B-A22B" + +### 10 "ray" "start" "--head" @@ -55,12 +60,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "awk" "{print $1}" "/root/mpi_rack_hostfile" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt index 2387b134ba..801704f8d0 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-235B-A22B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-235B-A22B" + +### 10 "ray" "start" "--head" @@ -55,12 +60,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "awk" "{print $1}" "/root/mpi_rack_hostfile" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt index 9fab9236ea..8adb2d846f 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-32B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-32B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt index 3563312a8c..de7ee3f9dc 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B-base-sft.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt index d4c1bb37af..62832339fc 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt index 5aca51b031..0ac3ee9d6a 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-4B_4xgpu.sh.txt @@ -42,6 +42,11 @@ "nvidia-smi" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-4B" + +### 10 "ray" "start" "--head" @@ -53,7 +58,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt index fa31c87684..48497e0a2f 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B-8gpus.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-next-80B-A3B" + +### 10 "ray" "start" "--head" @@ -55,12 +60,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "awk" "{print $1}" "/root/mpi_rack_hostfile" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt index 87689bcd22..d579cbfe6a 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3-next-80B-A3B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3-next-80B-A3B" + +### 10 "ray" "start" "--head" @@ -55,12 +60,12 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "awk" "{print $1}" "/root/mpi_rack_hostfile" -### 11 +### 12 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt index 53c86221e6..58ee19fba5 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-27B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3.5-27B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt index 042f63869f..e9e4f080a3 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-35B-A3B-mtp.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3.5-35B-A3B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt index 49b84e687b..4c4cb5787f 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-4B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3.5-4B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt index b44019d4a5..55e5bcccdd 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.5-9B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3.5-9B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" diff --git a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt index e3ec1d8269..a8a67450fd 100644 --- a/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt +++ b/tests/snapshots/launch_scripts/sh/scripts/run-qwen3.6-27B.sh.txt @@ -44,6 +44,11 @@ "-m" ### 9 +"python3" +"/scripts/../miles/utils/external_utils/model_args_utils.py" +"qwen3.6-27B" + +### 10 "ray" "start" "--head" @@ -55,7 +60,7 @@ "--dashboard-host=0.0.0.0" "--dashboard-port=8265" -### 10 +### 11 "ray" "job" "submit" From 79e9a3c31683a12e7b44dc95fc2046c5d183a33c Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Tue, 28 Jul 2026 17:07:41 +0800 Subject: [PATCH 17/18] Quote the model args miles inlines into the launch command Squashed from: - Quote the model args miles inlines into the launch command - Regenerate the launcher snapshots with the model args quoted - Quote the model args on the NPU path too - Quote the model args the formal-math launcher inlines too - Keep the quoting next to the loader it quotes --- docker/npu_patch/miles.patch | 2 +- .../formal_math/single_round/run_minimal.py | 4 +-- miles/utils/external_utils/command_utils.py | 6 ++-- .../utils/external_utils/model_args_utils.py | 8 ++++++ .../external_utils/test_model_args_utils.py | 28 ++++++++++++++++++- tests/fast/utils/test_command_utils.py | 18 ++++++++++++ .../amd/run_deepseek_v4.py/full_train.txt | 4 +-- .../amd/run_deepseek_v4.py/prepare_spmd.txt | 2 +- .../scripts/amd/run_deepseek_v4.py/train.txt | 2 +- .../amd/run_qwen3_30b_a3b.py/execute.txt | 2 +- .../amd/run_qwen3_30b_a3b.py/prepare.txt | 2 +- .../py/scripts/run_deepseek.py/train.txt | 4 +-- .../run_deepseek_v32.py/full_train.txt | 4 +-- .../scripts/run_deepseek_v32.py/prepare.txt | 2 +- .../prepare_megatron_ckpt.txt | 2 +- .../py/scripts/run_deepseek_v32.py/train.txt | 2 +- .../scripts/run_deepseek_v4.py/full_train.txt | 4 +-- .../run_deepseek_v4.py/prepare_spmd.txt | 2 +- .../py/scripts/run_deepseek_v4.py/train.txt | 2 +- .../scripts/run_glm45_355b_a32b.py/train.txt | 4 +-- .../py/scripts/run_glm47_flash.py/execute.txt | 2 +- .../py/scripts/run_glm47_flash.py/prepare.txt | 2 +- .../full_train.txt | 2 +- .../run_glm5_1_744b_a40b_lora.py/train.txt | 2 +- .../run_glm5_2_744b_a40b.py/full_train.txt | 4 +-- .../run_glm5_2_744b_a40b.py/prepare.txt | 2 +- .../scripts/run_glm5_2_744b_a40b.py/train.txt | 2 +- .../full_train.txt | 2 +- .../run_glm5_2_744b_a40b_lora.py/train.txt | 2 +- .../run_glm5_744b_a40b.py/full_train.txt | 4 +-- .../scripts/run_glm5_744b_a40b.py/prepare.txt | 2 +- .../scripts/run_glm5_744b_a40b.py/train.txt | 2 +- .../run_joy_ai_llm_flash.py/execute.txt | 2 +- .../run_joy_ai_llm_flash.py/prepare.txt | 2 +- .../py/scripts/run_kimi_k25.py/full_train.txt | 2 +- .../py/scripts/run_kimi_k25.py/train.txt | 2 +- .../scripts/run_qwen3_30b_a3b.py/execute.txt | 2 +- .../scripts/run_qwen3_30b_a3b.py/prepare.txt | 2 +- .../full_train.txt | 2 +- .../run_qwen3_5_35b_a3b_lora.py/train.txt | 2 +- .../execute.txt | 2 +- .../prepare.txt | 2 +- .../run_qwen3_6_35b_a3b_mtp.py/execute.txt | 2 +- .../run_qwen3_6_35b_a3b_mtp.py/prepare.txt | 2 +- 44 files changed, 104 insertions(+), 52 deletions(-) diff --git a/docker/npu_patch/miles.patch b/docker/npu_patch/miles.patch index 0708d4d671..58d2c30408 100644 --- a/docker/npu_patch/miles.patch +++ b/docker/npu_patch/miles.patch @@ -434,7 +434,7 @@ index d016e01ac..08b4d6eff 100644 + ) + + if get_bool_env_var("SLIME_SCRIPT_ENABLE_RAY_SUBMIT", "1"): -+ model_args = load_model_args(megatron_model_type) if megatron_model_type is not None else "" ++ model_args = shell_safe_model_args(megatron_model_type) + exec_command_cpu( + f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " + f'ray job submit --address="http://127.0.0.1:8265" ' diff --git a/examples/experimental/formal_math/single_round/run_minimal.py b/examples/experimental/formal_math/single_round/run_minimal.py index 7e7d774538..354d7dcf56 100644 --- a/examples/experimental/formal_math/single_round/run_minimal.py +++ b/examples/experimental/formal_math/single_round/run_minimal.py @@ -8,7 +8,7 @@ import subprocess from pathlib import Path -from miles.utils.external_utils.model_args_utils import load_model_args +from miles.utils.external_utils.model_args_utils import shell_safe_model_args repo_base_dir = Path(os.path.abspath(__file__)).resolve().parents[4] @@ -136,7 +136,7 @@ f'ray job submit --address="http://127.0.0.1:8265" ' f"--runtime-env-json='{runtime_env_json}' " f"-- python3 train.py " - f"{load_model_args(MODEL_TYPE)} " + f"{shell_safe_model_args(MODEL_TYPE)} " f"{train_args}" ) diff --git a/miles/utils/external_utils/command_utils.py b/miles/utils/external_utils/command_utils.py index ae0e96ee2a..cae5a49263 100644 --- a/miles/utils/external_utils/command_utils.py +++ b/miles/utils/external_utils/command_utils.py @@ -14,7 +14,7 @@ from pathlib import Path from miles.utils.external_utils.exec_command import exec_command_cpu, exec_command_gpu, exec_command_multi_node -from miles.utils.external_utils.model_args_utils import load_model_args +from miles.utils.external_utils.model_args_utils import shell_safe_model_args from miles.utils.file_arg_utils import PSEUDO_FILE_PREFIX from miles.utils.http_utils import wait_for_server_ready from miles.utils.typer_utils import dataclass_cli @@ -69,7 +69,7 @@ def convert_checkpoint( f"--nproc-per-node {num_gpus_per_node} " f"{multinode_args}" f"{repo_base_dir}/tools/convert_hf_to_torch_dist.py " - f"{load_model_args(megatron_model_type)} " + f"{shell_safe_model_args(megatron_model_type)} " f"--hf-checkpoint {hf_checkpoint} " f"--save {path_dst} " f"{extra_args}" @@ -195,7 +195,7 @@ def execute_train( runtime_env_json = json.dumps({"env_vars": runtime_env_vars}) if get_bool_env_var("MILES_SCRIPT_ENABLE_RAY_SUBMIT", "1"): - model_args = load_model_args(megatron_model_type) if megatron_model_type is not None else "" + model_args = shell_safe_model_args(megatron_model_type) exec_command_cpu( f"export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && " f"""ray job submit {'' if 'RAY_ADDRESS' in os.environ else '--address="http://127.0.0.1:8265" '}""" diff --git a/miles/utils/external_utils/model_args_utils.py b/miles/utils/external_utils/model_args_utils.py index 698f38aa2a..427878b4b9 100644 --- a/miles/utils/external_utils/model_args_utils.py +++ b/miles/utils/external_utils/model_args_utils.py @@ -1,4 +1,5 @@ import importlib.util +import shlex import sys from pathlib import Path from types import ModuleType @@ -26,6 +27,13 @@ def load_sibling_model_args(model_script: str, model_type: str, **kwargs: object return load_model_args(model_type, model_script_dir=Path(model_script).resolve().parent, **kwargs) +def shell_safe_model_args(model_type: str | None) -> str: + """For callers splicing the args into a command line, where --moe-layer-freq [1,1,1] is a glob.""" + if model_type is None: + return "" + return " ".join(shlex.quote(token) for token in load_model_args(model_type).split()) + + # ==================== what a model script may call ==================== diff --git a/tests/fast/utils/external_utils/test_model_args_utils.py b/tests/fast/utils/external_utils/test_model_args_utils.py index 3b6fece1c6..56aafa6af4 100644 --- a/tests/fast/utils/external_utils/test_model_args_utils.py +++ b/tests/fast/utils/external_utils/test_model_args_utils.py @@ -1,4 +1,5 @@ import os +import shlex import subprocess import sys from pathlib import Path @@ -6,7 +7,12 @@ import pytest import miles.utils.external_utils.model_args_utils as model_args_utils -from miles.utils.external_utils.model_args_utils import load_model_args, load_sibling_model_args, moe_layer_freq +from miles.utils.external_utils.model_args_utils import ( + load_model_args, + load_sibling_model_args, + moe_layer_freq, + shell_safe_model_args, +) _MODEL_ARGS_CLI = Path(model_args_utils.__file__).resolve() @@ -231,3 +237,23 @@ def test_forwards_the_rotary_base_override(self): ) assert "--rotary-base 5000000" in result.stdout + + +class TestShellSafeModelArgs: + def test_quotes_the_tokens_a_shell_would_reinterpret(self): + """--moe-layer-freq [0,0,0,1,1] is a glob; unquoted it expands against the launch directory.""" + assert "--moe-layer-freq '[0,0,0,1,1]'" in shell_safe_model_args("deepseek-v3-5layer") + + def test_leaves_ordinary_tokens_alone(self): + """Quoting everything would churn every snapshot for no gain.""" + assert "--num-layers 36" in shell_safe_model_args("qwen3-4B") + + def test_survives_a_shell_round_trip_unchanged(self): + """Escaping is only correct if the training process receives exactly the declared argv.""" + assert ( + shlex.split(shell_safe_model_args("deepseek-v3-5layer")) == load_model_args("deepseek-v3-5layer").split() + ) + + def test_is_empty_without_a_model_type(self): + """FSDP launchers pass None and must contribute no argv at all.""" + assert shell_safe_model_args(None) == "" diff --git a/tests/fast/utils/test_command_utils.py b/tests/fast/utils/test_command_utils.py index 28b9c0b15f..cb9b2e2215 100644 --- a/tests/fast/utils/test_command_utils.py +++ b/tests/fast/utils/test_command_utils.py @@ -6,6 +6,7 @@ from tests.fast.utils.command_recorder import record_commands import miles.utils.external_utils.command_utils as command_utils +from miles.utils.external_utils.model_args_utils import load_model_args from miles.utils.file_arg_utils import resolve_file_arg @@ -337,6 +338,23 @@ def test_expands_the_model_config_into_the_submitted_command(self, commands): assert "source" not in submit assert submit.endswith("--x 1") + def test_quotes_the_model_args_the_shell_would_otherwise_reinterpret(self, commands): + """--moe-layer-freq [1,1,1] is a glob; an unquoted token expands against the launch directory.""" + command_utils.execute_train(train_args="--x 1", num_gpus_per_node=8, megatron_model_type="deepseek-v3-5layer") + + submit = commands[-1] + assert "--moe-layer-freq '[0,0,0,1,1]'" in submit + assert shlex.split(submit)[shlex.split(submit).index("--moe-layer-freq") + 1] == "[0,0,0,1,1]" + + def test_model_args_survive_a_shell_round_trip_unchanged(self, commands): + """Quoting is only correct if the training process still receives exactly the declared argv.""" + command_utils.execute_train(train_args="", num_gpus_per_node=8, megatron_model_type="deepseek-v3-5layer") + + declared = load_model_args("deepseek-v3-5layer").split() + submitted = shlex.split(commands[-1]) + + assert submitted[len(submitted) - len(declared) :] == declared + def test_omits_the_model_args_for_fsdp(self, commands): """FSDP has no megatron model config to expand.""" command_utils.execute_train(train_args="--train-backend fsdp", num_gpus_per_node=8, megatron_model_type=None) diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt index e13b718821..a4f7a477c3 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/full_train.txt @@ -61,7 +61,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 @@ -144,7 +144,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt index a628e78167..7f2195c8d0 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/prepare_spmd.txt @@ -29,7 +29,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt index 5ea025564a..e2d1127518 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_deepseek_v4.py/train.txt @@ -45,7 +45,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt index baff9e14df..e42b9ce372 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/execute.txt @@ -38,7 +38,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 128 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt index 99783d0289..d26e2fcc35 100644 --- a/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/amd/run_qwen3_30b_a3b.py/prepare.txt @@ -39,7 +39,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 128 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt index 300d7a98f8..3f47ebe230 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek.py/train.txt @@ -53,7 +53,7 @@ python /tools/fp8_cast_bf16.py --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 @@ -132,7 +132,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt index c74183d685..1f7c0df46f 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/full_train.txt @@ -54,7 +54,7 @@ python /tools/fp8_cast_bf16.py --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 @@ -125,7 +125,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt index 34fc8fcfbb..c81859e184 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare.txt @@ -54,7 +54,7 @@ python /tools/fp8_cast_bf16.py --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt index 50b7d6b52c..832188833f 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/prepare_megatron_ckpt.txt @@ -32,7 +32,7 @@ --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt index 59bfcd7d6d..96f2ec2113 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v32.py/train.txt @@ -44,7 +44,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt index 2098bd0d89..dc9f45cf36 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/full_train.txt @@ -61,7 +61,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1] + --moe-layer-freq '[1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 @@ -144,7 +144,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1] + --moe-layer-freq '[1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt index 85964a5eb1..0f0d043e2b 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/prepare_spmd.txt @@ -29,7 +29,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1] + --moe-layer-freq '[1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt index b21954850e..c2a0beaa5e 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_deepseek_v4.py/train.txt @@ -45,7 +45,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [1,1,1,1] + --moe-layer-freq '[1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 6 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt index cf459fe44e..7cc64f3e27 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm45_355b_a32b.py/train.txt @@ -54,7 +54,7 @@ hf download --moe-token-dispatcher-type alltoall --moe-router-topk 8 --moe-router-topk-scaling-factor 2.5 - --moe-layer-freq [0]*3+[1]*89 + --moe-layer-freq '[0]*3+[1]*89' --num-experts 160 --moe-grouped-gemm --moe-router-dtype fp32 @@ -117,7 +117,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-token-dispatcher-type alltoall --moe-router-topk 8 --moe-router-topk-scaling-factor 2.5 - --moe-layer-freq [0]*3+[1]*89 + --moe-layer-freq '[0]*3+[1]*89' --num-experts 160 --moe-grouped-gemm --moe-router-dtype fp32 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt index 7782666556..1099658c7c 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/execute.txt @@ -17,7 +17,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py - --moe-layer-freq [0]*1+[1]*46 + --moe-layer-freq '[0]*1+[1]*46' --num-experts 64 --moe-shared-expert-intermediate-size 1536 --moe-router-topk 4 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt index cc01da0288..ce760d9ee0 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm47_flash.py/prepare.txt @@ -18,7 +18,7 @@ hf download ### 4 PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --nproc-per-node 8 /tools/convert_hf_to_torch_dist.py - --moe-layer-freq [0]*1+[1]*46 + --moe-layer-freq '[0]*1+[1]*46' --num-experts 64 --moe-shared-expert-intermediate-size 1536 --moe-router-topk 4 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt index 3076db8edb..89a0ba07bb 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/full_train.txt @@ -30,7 +30,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*3 + --moe-layer-freq '[0]*3+[1]*3' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt index 7a1a1e2933..ffa8cb4380 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_1_744b_a40b_lora.py/train.txt @@ -18,7 +18,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*3 + --moe-layer-freq '[0]*3+[1]*3' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt index 914ecdaadb..f4ac5a8787 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/full_train.txt @@ -18,7 +18,7 @@ hf download --nnodes={{nnodes}} --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 @@ -92,7 +92,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt index eb959cfbc5..9bce6f73ee 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/prepare.txt @@ -18,7 +18,7 @@ hf download --nnodes={{nnodes}} --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt index d65c48f28a..9614a91ee4 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b.py/train.txt @@ -18,7 +18,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt index 988ca39322..cde78eda94 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/full_train.txt @@ -30,7 +30,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*2 + --moe-layer-freq '[0]*3+[1]*2' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt index c85da53edd..8c9f77417a 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_2_744b_a40b_lora.py/train.txt @@ -18,7 +18,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "MILES_EXPERIMENTAL_ROLLOUT_REFACTOR": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "SGLANG_NSA_FORCE_MLA": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*2 + --moe-layer-freq '[0]*3+[1]*2' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt index 291ab823e7..3614af4e5c 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/full_train.txt @@ -18,7 +18,7 @@ hf download --nnodes={{nnodes}} --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 @@ -91,7 +91,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt index 04916b0b5a..863ed77121 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/prepare.txt @@ -18,7 +18,7 @@ hf download --nnodes={{nnodes}} --node-rank {{node_rank}} /tools/convert_hf_to_torch_dist.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt index ba368a85ba..373919b55d 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_glm5_744b_a40b.py/train.txt @@ -18,7 +18,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --runtime-env-json='{"env_vars": {"PYTHONUNBUFFERED": "1", "CUDA_DEVICE_MAX_CONNECTIONS": "1", "NCCL_NVLS_ENABLE": "0", "no_proxy": "127.0.0.1,127.0.0.1", "MASTER_ADDR": "127.0.0.1", "SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK": "256", "SGLANG_NSA_FORCE_MLA": "1", "INDEXER_ROPE_NEOX_STYLE": "0", "NVSHMEM_DISABLE_NCCL": "1", "PYTHONPATH": ":/root/Megatron-LM:/frozen/pythonpath"}}' -- python3 /train.py --spec miles_plugins.models.glm5.glm5 get_glm5_spec - --moe-layer-freq [0]*3+[1]*75 + --moe-layer-freq '[0]*3+[1]*75' --num-experts 256 --moe-shared-expert-intermediate-size 2048 --moe-router-topk 8 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt index c4916847fd..f2630f1aa2 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/execute.txt @@ -42,7 +42,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 768 --moe-router-topk 8 --moe-shared-expert-intermediate-size 768 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt index 0d7f5fc082..c4f872fc0c 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_joy_ai_llm_flash.py/prepare.txt @@ -43,7 +43,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --attention-softmax-in-fp32 --no-rope-fusion --num-experts 256 - --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 768 --moe-router-topk 8 --moe-shared-expert-intermediate-size 768 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt index 420a9dbba9..051d164a95 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/full_train.txt @@ -60,7 +60,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 384 - --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt index a735595ce1..35da21b964 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_kimi_k25.py/train.txt @@ -43,7 +43,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --attention-softmax-in-fp32 --no-rope-fusion --num-experts 384 - --moe-layer-freq [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --moe-ffn-hidden-size 2048 --moe-router-topk 8 --moe-shared-expert-intermediate-size 2048 diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt index 6e61f1336b..91adaa3fdf 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/execute.txt @@ -38,7 +38,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 128 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt index 99783d0289..d26e2fcc35 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_30b_a3b.py/prepare.txt @@ -39,7 +39,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 128 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt index 7414680ef1..0b912ede66 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/full_train.txt @@ -53,7 +53,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt index 3607c0f02b..3d93708d30 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_lora.py/train.txt @@ -41,7 +41,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt index d4d384601f..4662f60db3 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/execute.txt @@ -41,7 +41,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt index a218e41481..b8e3905cc0 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_5_35b_a3b_mtp_cp2_ep8.py/prepare.txt @@ -42,7 +42,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt index 57ebd89049..19492c4937 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/execute.txt @@ -41,7 +41,7 @@ export no_proxy=127.0.0.1 && export PYTHONUNBUFFERED=1 && ray job submit --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs diff --git a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt index 1b4076f510..2c08eae225 100644 --- a/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt +++ b/tests/snapshots/launch_scripts/py/scripts/run_qwen3_6_35b_a3b_mtp.py/prepare.txt @@ -42,7 +42,7 @@ PYTHONPATH=:/root/Megatron-LM:/frozen/pythonpath torchrun --moe-router-score-function softmax --moe-token-dispatcher-type alltoall --moe-router-topk 8 - --moe-layer-freq [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] + --moe-layer-freq '[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]' --num-experts 256 --moe-grouped-gemm --moe-token-drop-policy probs From 4e8f20f49e0cfc722542f201c2d5d6db8aec9008 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Sat, 8 Aug 2026 10:32:13 +0800 Subject: [PATCH 18/18] Run the launch script snapshot tests by hand instead of in CI The CI runner discovers tests under tests/fast, tests/fast-gpu, tests/e2e and tests/ci (_DISCOVERY_ROOTS in tests/ci/ci_register.py), and everything under tests/fast is registered implicitly by location. Moving the four snapshot tests to tests/manual/launch_scripts takes them out of that set without disabling them: they still run, just only when invoked by hand. The harness modules stay in tests/fast/launch_scripts, so the harness self-test and the shell script hygiene checks keep running in CI, and the moved tests keep importing them by their existing absolute paths. --- tests/manual/launch_scripts/__init__.py | 0 .../launch_scripts/test_model_args.py | 0 .../launch_scripts/test_py_launch_scripts.py | 0 .../test_self_executing_launchers.py | 0 .../launch_scripts/test_sh_launch_scripts.py | 0 tests/snapshots/README.md | 16 +++++++++++++--- 6 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/manual/launch_scripts/__init__.py rename tests/{fast => manual}/launch_scripts/test_model_args.py (100%) rename tests/{fast => manual}/launch_scripts/test_py_launch_scripts.py (100%) rename tests/{fast => manual}/launch_scripts/test_self_executing_launchers.py (100%) rename tests/{fast => manual}/launch_scripts/test_sh_launch_scripts.py (100%) diff --git a/tests/manual/launch_scripts/__init__.py b/tests/manual/launch_scripts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/fast/launch_scripts/test_model_args.py b/tests/manual/launch_scripts/test_model_args.py similarity index 100% rename from tests/fast/launch_scripts/test_model_args.py rename to tests/manual/launch_scripts/test_model_args.py diff --git a/tests/fast/launch_scripts/test_py_launch_scripts.py b/tests/manual/launch_scripts/test_py_launch_scripts.py similarity index 100% rename from tests/fast/launch_scripts/test_py_launch_scripts.py rename to tests/manual/launch_scripts/test_py_launch_scripts.py diff --git a/tests/fast/launch_scripts/test_self_executing_launchers.py b/tests/manual/launch_scripts/test_self_executing_launchers.py similarity index 100% rename from tests/fast/launch_scripts/test_self_executing_launchers.py rename to tests/manual/launch_scripts/test_self_executing_launchers.py diff --git a/tests/fast/launch_scripts/test_sh_launch_scripts.py b/tests/manual/launch_scripts/test_sh_launch_scripts.py similarity index 100% rename from tests/fast/launch_scripts/test_sh_launch_scripts.py rename to tests/manual/launch_scripts/test_sh_launch_scripts.py diff --git a/tests/snapshots/README.md b/tests/snapshots/README.md index ceb20f2f83..29325d7006 100644 --- a/tests/snapshots/README.md +++ b/tests/snapshots/README.md @@ -5,13 +5,23 @@ generated: never edit a file by hand, regenerate it and review the diff. | Directory | Produced by | Contains | | --- | --- | --- | -| `launch_scripts/sh/` | `tests/fast/launch_scripts/test_sh_launch_scripts.py` | every external command each `scripts/**.sh` and `examples/**.sh` launcher issues, including the full `ray job submit` argv | -| `launch_scripts/py/` | `tests/fast/launch_scripts/test_py_launch_scripts.py` | every shell command each `scripts/run_*.py` entrypoint builds | +| `launch_scripts/sh/` | `tests/manual/launch_scripts/test_sh_launch_scripts.py` | every external command each `scripts/**.sh` and `examples/**.sh` launcher issues, including the full `ray job submit` argv | +| `launch_scripts/py/` | `tests/manual/launch_scripts/test_py_launch_scripts.py` | every shell command each `scripts/run_*.py` entrypoint builds | +| `launch_scripts/self_executing/` | `tests/manual/launch_scripts/test_self_executing_launchers.py` | the `ray job submit` argv of the launchers that build their own command line | +| `model_args/` | `tests/manual/launch_scripts/test_model_args.py` | the expanded argv of every `scripts/models/*.py` model definition | + +These tests live under `tests/manual/`, which the CI runner does not discover +(see `_DISCOVERY_ROOTS` in `tests/ci/ci_register.py`), so they run only when +invoked by hand. Run them after touching a launcher or a model definition: + +```bash +pytest tests/manual/launch_scripts +``` Regenerate after an intentional change: ```bash -MILES_UPDATE_LAUNCH_SCRIPT_SNAPSHOTS=1 pytest tests/fast/launch_scripts +MILES_UPDATE_LAUNCH_SCRIPT_SNAPSHOTS=1 pytest tests/manual/launch_scripts ``` The recordings are reproducible on any machine: the launchers run under a