-
Notifications
You must be signed in to change notification settings - Fork 555
test: [3/3] add L3 Nano 4B Gym training E2E #4015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e263f48
933b72b
2a3edcb
585004a
d961928
669c8c7
d759166
174f3d3
9b35225
ee56dd6
e1cb603
4e6e44e
579e298
b22c4e8
ac7f9ea
e655949
41dd194
292e4c6
1a6d7ad
9aa1dce
4358882
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from nemo_rl.models.generation.vllm.config import VLLM_SPARSE_REFIT_TRANSPORTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TokenizerType = PreTrainedTokenizerBase | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _VLLM_MIN_NON_ZERO_TEMPERATURE = 1e-2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def resolve_generation_class( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -64,6 +65,16 @@ def configure_generation_config( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| trains_mtp: bool = False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> GenerationConfig: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Apply specific configurations to generation config.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # vLLM clamps tiny positive temperatures before sampling. Normalize the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # shared config at this backend boundary so policy logprob recomputation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # receives the same effective temperature without changing other backends. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| temperature = config.get("temperature") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config["backend"] in ("vllm", "dynamo") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and temperature is not None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and 0.0 < temperature < _VLLM_MIN_NON_ZERO_TEMPERATURE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config["temperature"] = _VLLM_MIN_NON_ZERO_TEMPERATURE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+68
to
+77
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
1 action item, please fix in this PR. TL;DR: clamping only Walk-through with
Before this PR the same command ran (with a silent train ÷0.005 vs vLLM ÷0.01 mismatch that this clamp rightly removes), so the remaining defect is the misattributed error. The Gym path is unaffected because validation requests are clamped inside vLLM ( Action: clamp
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config["backend"] != "vllm" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and config.get("worker_extension_cls_fqn") is not None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||
| # limitations under the License. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||||||||||||||||||||||||||||||||
| PROJECT_ROOT=$(realpath "${SCRIPT_DIR}/../..") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| cd "${PROJECT_ROOT}" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if [[ "${FAST:-0}" == "1" ]]; then | ||||||||||||||||||||||||||||||||
| echo "FAST: Skipping Nano 4B Gym training E2E on GB200" | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| time uv run --no-sync bash ./tests/functional/grpo_nano4b_gym_training_e2e.sh | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
Comment on lines
+24
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
1 action item. This is the only one of the 22 L1 wrappers without the
Suggested change
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| PROJECT_ROOT=$(realpath "${SCRIPT_DIR}/../..") | ||
| EXP_NAME=$(basename "$0" .sh) | ||
| EXP_DIR="${SCRIPT_DIR}/${EXP_NAME}" | ||
| LOG_DIR="${EXP_DIR}/logs" | ||
| JSON_METRICS="${EXP_DIR}/metrics.json" | ||
| RUN_LOG="${EXP_DIR}/run.log" | ||
| CONFIG_PATH="${SCRIPT_DIR}/grpo_nano4b_gym_training_e2e.yaml" | ||
|
|
||
| export PYTHONPATH="${PROJECT_ROOT}:${PYTHONPATH:-}" | ||
|
|
||
| rm -rf "${EXP_DIR}" | ||
| mkdir -p "${LOG_DIR}" | ||
|
|
||
| cd "${PROJECT_ROOT}" | ||
|
|
||
| uv run coverage run -a --data-file="${PROJECT_ROOT}/tests/.coverage" --source="${PROJECT_ROOT}/nemo_rl" \ | ||
| "${PROJECT_ROOT}/examples/nemo_gym/run_grpo_nemo_gym.py" \ | ||
| --config "${CONFIG_PATH}" \ | ||
| logger.log_dir="${LOG_DIR}" \ | ||
| "$@" \ | ||
| 2>&1 | tee "${RUN_LOG}" | ||
|
|
||
| grep -Fq "Running synchronous GRPO training" "${RUN_LOG}" | ||
|
|
||
| uv run tests/json_dump_tb_logs.py "${LOG_DIR}" --output_path "${JSON_METRICS}" | ||
|
|
||
| # The fixture intentionally contains one accepted and one rejected rollout. In | ||
| # addition to testing both verifier outcomes, this gives Reinforce++ a non-zero | ||
| # advantage so a finite nonzero grad norm and positive learning rate prove that | ||
| # a trainable update signal reached the optimizer path. | ||
| uv run tests/check_metrics.py "${JSON_METRICS}" \ | ||
| 'len(data["train/loss"]) == 1' \ | ||
| 'all_finite(data["train/loss"])' \ | ||
| 'all_finite(data["train/grad_norm"])' \ | ||
| 'min(data["train/grad_norm"]) > 0' \ | ||
| 'all_finite(data["train/lr"])' \ | ||
| 'min(data["train/lr"]) > 0' \ | ||
| 'all_finite(data["train/advantages/min"])' \ | ||
| 'all_finite(data["train/advantages/max"])' \ | ||
| 'min(data["train/advantages/min"]) < 0' \ | ||
| 'max(data["train/advantages/max"]) > 0' \ | ||
| 'data["train/total_reward/min"]["1"] == 0' \ | ||
| 'data["train/total_reward/max"]["1"] == 1' \ | ||
| 'data["train/total_reward/mean"]["1"] == 0.5' \ | ||
| 'all_finite(data["train/token_mult_prob_error"])' \ | ||
| 'max(data["train/token_mult_prob_error"]) < 1.05' \ | ||
| 'data["refit/generation_workers_updated"]["1"] > 0' \ | ||
| 'data["timing/train/generation"]["1"] > 0' \ | ||
| 'data["validation/accuracy"]["1"] == 0.5' \ | ||
| 'data["timing/validation/total_validation_time"]["1"] > 0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nemo_rl/algorithms/grpo.py:2540-25421 action item (wording).
len(results)counts TP/PP rank-0 workers, one per data-parallel replica (run_rank_0_only_axeson the IPC path,_refit_leader_workers()on the NCCL path), not worker groups; there is exactly one worker group. The E2E's2.0on two TP1 GPUs is the DP count.