[CICD] Simplified workflows, Add lint_check & functional_tests, Switch to FlagCICD metax runner#29
Conversation
- Simplify functional_tests_common.yml: merge setup steps, add yq/envsubst/pybind11/uv-shim - Simplify unit_tests_common.yml: streamline environment setup and coverage - Fix all_tests_common.yml: always() condition for complete jobs - Add lint_common.yml with pylint integration - Add all_tests_cuda.yml with BAAI runner support - Update all_tests_metax.yml: enable unit+functional tests on BAAI runner - Update metax.yml: comprehensive ignored_tests for >2GPU/CUDA-only cases - Remove 20+ unused upstream NVIDIA workflows - Add PR template, remove obsolete CODEOWNERS/copy-pr-bot
- Add self-contained GPT inference and GRPO functional tests (no external data) - Add golden values for dev/dgx_a100 - Add CUDA GPT mock-data pretraining cases: regular, resume, recompute, SwiGLU, disable-bias, TP-overlap - Add multimodal LLaVA resume test case - Add yq_common.sh/yq_compat.py for self-contained yq resolution - Add mock null_numeric_agent for RL environments - Tune GRPO golden iteration-time thresholds for CI stability
- Fix static inference token scheduling and position embedding for tiny models - Fix GRPO self-contained inference batching fallback - Handle missing optimizer group compatibility flags - Make wandb, fastapi, RL server deps lazy/optional for test isolation - Declare six as base runtime dependency in pyproject.toml - Add unit tests for RL inference and text generation controller
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s CI/CD and test infrastructure to run linting + unit/functional tests across CUDA and Metax (BAAI runners), while also adding several code fixes to make inference/RL flows and functional tests more self-contained and robust.
Changes:
- Adds a shared
lint_common.ymlworkflow and refactors CI entrypoints (all_tests_*,unit_tests_common,functional_tests_common) to simplify execution across platforms/runners. - Introduces new self-contained functional test cases (tiny GPT static inference + GRPO RL loop) plus expanded GPT/mock-data training matrix coverage and multimodal LLaVA mock-data coverage.
- Fixes/adjusts inference + RL integration (static engine support in
MegatronLocal, tokenizer compatibility, static context reset, attention mask behavior, optimizer param-group compatibility).
Reviewed changes
Copilot reviewed 77 out of 77 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit_tests/test_rl_inference_megatron.py | Adds async unit tests for MegatronLocal launch/generate paths. |
| tests/unit_tests/inference/text_generation_controllers/test_simple_text_generation_controller.py | Adds regression test for termination-token accounting. |
| tests/functional_tests/test_cases/multimodal-llava/multimodal_llava_mcore_te_tp1_pp1_resume_torch/model_config.yaml | Adds LLaVA ckpt-resume functional config (torch ckpt). |
| tests/functional_tests/test_cases/multimodal-llava/multimodal_llava_mcore_te_tp1_pp1_resume_torch/golden_values_dev_dgx_a100.json | Adds golden metrics for LLaVA resume case. |
| tests/functional_tests/test_cases/multimodal-llava/multimodal_llava_mcore_te_tp1_pp1/model_config.yaml | Updates LLaVA env vars (nondeterministic toggle). |
| tests/functional_tests/test_cases/gpt/gpt_static_inference_tp1_pp1_tiny_null_selfcontained/model_config.yaml | Adds self-contained tiny GPT static inference config. |
| tests/functional_tests/test_cases/gpt/gpt_static_inference_tp1_pp1_tiny_null_selfcontained/golden_values_dev_dgx_a100.json | Adds golden outputs for tiny GPT inference. |
| tests/functional_tests/test_cases/gpt/gpt_grpo_tp1_pp1_tiny_null_selfcontained/model_config.yaml | Adds self-contained tiny GRPO RL config. |
| tests/functional_tests/test_cases/gpt/gpt_grpo_tp1_pp1_tiny_null_selfcontained/golden_values_dev_dgx_a100.json | Adds golden metrics for GRPO loop. |
| tests/functional_tests/test_cases/gpt/gpt_grpo_tp1_pp1_tiny_null_selfcontained/env_config.yaml | Adds mock RL env config for GRPO functional run. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp4_pp1_mock_data_resume_torch_dist_dist_optimizer_overlap_grad_reduce_param_gather/model_config.yaml | Adds overlap+resume functional config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp4_pp1_mock_data_dist_optimizer_overlap_grad_reduce_param_gather/model_config.yaml | Adds overlap functional config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp4_mock_data_swiglu/model_config.yaml | Adds pipeline+SwiGLU functional config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp4_mock_data_resume_torch_dist_swiglu/model_config.yaml | Adds pipeline+SwiGLU resume config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp4_mock_data_resume_torch_dist_disable_bias_linear/model_config.yaml | Adds disable-bias resume config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp4_mock_data_disable_bias_linear/model_config.yaml | Adds disable-bias functional config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp1_mock_data_uniform_full_recompute/model_config.yaml | Adds recompute functional config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp1_mock_data_resume_torch_dist_uniform_full_recompute/model_config.yaml | Adds recompute resume config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp1_mock_data_resume_torch_dist_dist_optimizer/model_config.yaml | Adds dist-optim resume config. |
| tests/functional_tests/test_cases/gpt/gpt3_mcore_te_tp1_pp1_mock_data_dist_optimizer/model_config.yaml | Adds dist-optim functional config. |
| tests/functional_tests/test_cases/gpt/_selfcontained/prepare_tiny_null_gpt_checkpoint.sh | Adds script to generate a tiny checkpoint for self-contained tests. |
| tests/functional_tests/shell_test_utils/yq_compat.py | Adds minimal yq-compatible YAML query/update helper. |
| tests/functional_tests/shell_test_utils/yq_common.sh | Adds yq resolution wrapper used by shell test utils. |
| tests/functional_tests/shell_test_utils/run_ci_test.sh | Switches to resolved yq, adds RL mode, tweaks args handling. |
| tests/functional_tests/shell_test_utils/_run_training.sh | Switches to resolved yq and adds extra distributed log listing. |
| tests/functional_tests/python_test_utils/test_grpo_training_loop.py | Loosens strict iteration-time gating for GRPO tiny loop. |
| pyproject.toml | Adds six to runtime dependencies. |
| pretrain_vlm.py | Extends model_provider signature and supports passing config/PG collection. |
| megatron/training/training.py | Makes param-group reordering tolerant of missing compatibility flags. |
| megatron/training/tokenizer/tokenizer.py | Adds pad/bos/eos/unk aliases for tokenizer compatibility. |
| megatron/rl/server/init.py | Removes heavy package-level imports to avoid optional deps at import time. |
| megatron/rl/rl_utils.py | Makes wandb typing optional; lazily imports HTTP server; fixes attention-mask slicing. |
| megatron/rl/inference/megatron.py | Adds static-engine path + locking and request building for local inference. |
| megatron/rl/inference/inference_interface.py | Adjusts relative import path. |
| megatron/rl/inference/api.py | Adjusts relative import path. |
| megatron/rl/agent/pass_at_evaluation_agent.py | Adjusts relative import path. |
| megatron/rl/agent/api.py | Adjusts relative import path. |
| megatron/plugin/utils.py | Makes no_shared_fs access safe via getattr. |
| megatron/core/transformer/transformer_layer.py | Disables BDA fusion during traced/static inference contexts. |
| megatron/core/transformer/mlp.py | Disables bias-activation fusion when inference mode is enabled. |
| megatron/core/transformer/dot_product_attention.py | Ensures fused softmax tracks runtime attn_mask_type. |
| megatron/core/tokenizers/text/libraries/null_tokenizer.py | Adds missing tokenizer API methods/properties for compatibility. |
| megatron/core/optimizer/optimizer.py | Makes param-group matching tolerant of missing flags/pre_* keys. |
| megatron/core/inference/text_generation_controllers/text_generation_controller.py | Fixes generated-length counting to include terminating token once. |
| megatron/core/inference/contexts/static_context.py | Clears KV cache on static context reset to avoid reuse across batches. |
| examples/rl/environments/mock/null_numeric_agent.py | Adds a mock RL agent for self-contained GRPO functional tests. |
| examples/rl/environments/mock/init.py | Adds package init for mock RL env module. |
| examples/inference/gpt/utils.py | Makes simpy optional; falls back to immediate enqueue offsets. |
| .github/workflows/unit_tests_common.yml | Simplifies workflow, always generates coverage, updates deps. |
| .github/workflows/lint_common.yml | Adds reusable pylint workflow (fail-under 9.0). |
| .github/workflows/functional_tests_common.yml | Refactors functional workflow, adds log artifact upload, metax toolchain compat. |
| .github/workflows/all_tests_metax.yml | Enables unit + functional tests for metax via common workflow. |
| .github/workflows/all_tests_cuda.yml | Enables unit + functional tests for cuda via common workflow. |
| .github/workflows/all_tests_common.yml | Orchestrates lint + unit + functional in one entry workflow. |
| .github/pull_request_template.md | Replaces PR template content (currently PR-specific). |
| .github/configs/metax.yml | Switches to BAAI runner/image and defines metax functional matrix. |
| .github/configs/cuda.yml | Switches to BAAI runner/image and defines expanded functional matrix. |
| .github/workflows/trigger-mbridge-tests.yml | Removes unused workflow. |
| .github/workflows/release.yaml | Removes unused workflow. |
| .github/workflows/release-freeze.yml | Removes unused workflow. |
| .github/workflows/multi-approval-bot.yml | Removes unused workflow. |
| .github/workflows/install-test.yml | Removes unused workflow. |
| .github/workflows/dependabot.yml | Removes unused workflow. |
| .github/workflows/copyright-check.yml | Removes unused workflow. |
| .github/workflows/community-bot.yml | Removes unused workflow. |
| .github/workflows/close-inactive-issue-pr.yml | Removes unused workflow. |
| .github/workflows/cherry-pick-release-commit.yml | Removes unused workflow. |
| .github/workflows/check_api_backwards_compatibility_workflow.yml | Removes unused workflow. |
| .github/workflows/auto-update-copy-pr-bot.yml | Removes unused workflow. |
| .github/workflows/auto-swap-labels.yml | Removes unused workflow. |
| .github/workflows/auto-reminder-bot.yml | Removes unused workflow. |
| .github/workflows/auto-assign-milestone.yml | Removes unused workflow. |
| .github/workflows/_update_dependencies.yml | Removes unused workflow. |
| .github/workflows/_release_library.yml | Removes unused workflow. |
| .github/workflows/_build_test_publish_wheel.yml | Removes unused workflow. |
| .github/copy-pr-bot.yaml | Removes unused config. |
| .github/CODEOWNERS | Removes CODEOWNERS file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
You can disable workflows forked from the original NVIDIA Megatron-LM repository, but do not remove them like .github/workflows/_build_test_publish_wheel.yml, .github/workflows/_release_library.yml, .github/workflows/_update_dependencies.yml etc. We may need merge into NVIDIA Megatron-LM one day. |
There was a problem hiding this comment.
Megatron-LM has its own rules; please align with the original repository.
https://github.com/NVIDIA/Megatron-LM/blob/ded22f42849e679dd65c1fba832951d7c712a3c7/.github/workflows/cicd-main.yml#L244-L285
There was a problem hiding this comment.
Seems not like a template to me
| try: | ||
| import simpy # Guard against this import in test case | ||
| except ModuleNotFoundError: | ||
| # Fall back to enqueuing all requests immediately when simpy is unavailable. | ||
| return [-1] * num_requests |
There was a problem hiding this comment.
Why not just install simpy?
There was a problem hiding this comment.
Why do we add this file
There was a problem hiding this comment.
Why do we add this file
|
Why do we have lots of changes in megatron/core and megatron/rl |
There was a problem hiding this comment.
Why do we need so many code changes to fix the issues with the yq tool? Is this really necessary?
There was a problem hiding this comment.
Why do we add so many new config file? We only test our own cases?
| - mx-4g-cicd-megatron | ||
|
|
||
| # Container volumes (hardware-specific paths) | ||
| container_volumes: |
There was a problem hiding this comment.
metax platform runner
container_volumes:
- /mnt/op/cicd/baai_datasets:/home/gitlab-runner/data
- /mnt/op/cicd/baai_tokenizers:/home/gitlab-runner/tokenizers
# Conflicts: # .github/workflows/lint_common.yml
# Conflicts: # tests/functional_tests/shell_test_utils/run_ci_test.sh
Description
Add CI/CD workflow support for multi-platform (CUDA & Metax) linting, functional testing, and log reporting. With significant workflow simplification, and Metax platform use BAAI runner configs.
Type of change
Changes
unit_tests_common.yml, andall_tests_common.ymllint_common.ymlwith pylint integration (score ≥ 9.0)ignored_testslist for >2 GPU / CUDA-only cases; limited functional coverage to validated 2-GPU GPT casessixas runtime dependencyChecklist