Skip to content

Commit 3f36d14

Browse files
authored
chore: major version bump (torch 2.8, vllm 0.11, ray 2.49) & SP fixes (#1334)
Signed-off-by: Terry Kong <terryk@nvidia.com>
1 parent 79269af commit 3f36d14

58 files changed

Lines changed: 1073 additions & 462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/cicd-main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
- name: Install uv
163163
uses: astral-sh/setup-uv@v5
164164
with:
165-
version: "0.7.2"
165+
version: "0.9.1"
166166
enable-cache: true
167167
prune-cache: false
168168
# Faster than uv python install since it caches python alongside runner

‎3rdparty/Penguin-workspace/setup.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525

2626

2727
CACHED_DEPENDENCIES = [
28-
"openai<=1.97.1",
28+
# TODO: openai was un-pinned in https://github.com/NVIDIA-NeMo/RL/pull/1334 to comply with the version vllm mandates
29+
# When penguin is actually added, this install will fail and we'll need penguin to ensure compatibility.
30+
"openai",
2931
"tqdm",
3032
"pydantic",
3133
"pydantic_core",

‎README.md‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ For more examples and setup details, continue to the [Prerequisites](#prerequisi
131131
<tr>
132132
<td colspan="2" style="border:1px solid #d0d7de; padding:8px; vertical-align:top; word-break:break-word; overflow-wrap:anywhere; white-space:normal;">
133133
<strong>Clone and create the environment</strong>
134-
<pre style="white-space:pre-wrap; word-break:break-word; overflow-wrap:anywhere;"><code class="language-sh">git clone git@github.com:NVIDIA-NeMo/RL.git nemo-rl
134+
<pre style="white-space:pre-wrap; word-break:break-word; overflow-wrap:anywhere;"><code class="language-sh">git clone git@github.com:NVIDIA-NeMo/RL.git nemo-rl --recursive
135135
cd nemo-rl
136-
git submodule update --init --recursive
137136
uv venv</code></pre>
138137
<em>Note:</em> If you previously ran without checking out the submodules, you may need to rebuild virtual environments by setting <code>NRL_FORCE_REBUILD_VENVS=true</code>. See <a href="#tips-and-tricks">Tips and Tricks</a>.
139138
</td>
@@ -203,19 +202,6 @@ uv venv
203202
> Please do not use `-p/--python` and instead allow `uv venv` to read it from `.python-version`.
204203
> This ensures that the version of python used is always what we prescribe.
205204
206-
If working outside a container, it can help to build [flash-attn](https://github.com/Dao-AILab/flash-attention) and warm the uv cache before your first run.
207-
```sh
208-
bash tools/build-flash-attn-in-uv-cache.sh
209-
```
210-
> [!NOTE]
211-
> On the first install, `flash-attn` can take a while to install (~45min with 48 CPU hyperthreads). After it is built once, it is cached in your uv's cache directory, making subsequent installs much quicker.
212-
213-
> [!TIP]
214-
> The NeMo RL Dockerfile will warm the uv cache with flash-attn.
215-
> See https://docs.nvidia.com/nemo/rl/latest/docker.html for instructions if you are looking for the NeMo RL container.
216-
217-
If successful, you should see `✅ flash-attn successfully added to uv cache`.
218-
219205
Use `uv run` to launch all commands. It handles pip installing implicitly and ensures your environment is up to date with our lock file.
220206
> [!NOTE]
221207
> - It is not recommended to activate the `venv`, and you should use `uv run <command>` instead to execute scripts within the managed environment.

‎docker/Dockerfile‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ rm -rf /var/lib/apt/lists/*
4141
EOF
4242

4343
# Install uv and python
44-
ARG UV_VERSION=0.7.2
44+
ARG UV_VERSION=0.9.1
4545
ARG PYTHON_VERSION=3.12
4646
ENV PATH="/root/.local/bin:$PATH"
4747
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh && \
@@ -50,6 +50,10 @@ RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh && \
5050
# Disable usage stats by default for users who are sensitive to sharing usage.
5151
# Users are encouraged to enable if the wish.
5252
ENV RAY_USAGE_STATS_ENABLED=0
53+
# After ray>=2.47, this feature is enabled by default which creates uv venvs for any py_executable starting with `uv run`.
54+
# There is severe contention and performance issues with this enabled considering our dependencies are so large and occasionally
55+
# need to be compiled, so NeMo RL has an implementation in nemo_rl/utils/venv.py that does it once per node as opposed to once per task.
56+
ENV RAY_ENABLE_UV_RUN_RUNTIME_ENV=0
5357
ENV NEMO_RL_VENV_DIR=/opt/ray_venvs
5458

5559

@@ -67,15 +71,6 @@ ARG BUILD_CUSTOM_VLLM
6771
ENV UV_PROJECT_ENVIRONMENT=/opt/nemo_rl_venv
6872
ENV UV_LINK_MODE=copy
6973

70-
# This step is to warm the uv cache with flash-attn without invalidating it due to COPY layers
71-
# This layer has to be manually updated
72-
RUN <<"EOF" bash -exu
73-
uv venv ${UV_PROJECT_ENVIRONMENT}
74-
75-
VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT uv pip install --link-mode symlink setuptools torch==2.7.0 psutil ninja --torch-backend=cu128
76-
VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT uv pip install --link-mode symlink flash-attn==2.7.4.post1 --no-build-isolation
77-
EOF
78-
7974
# First copy only the dependency files
8075
COPY --from=nemo-rl pyproject.toml uv.lock ./
8176
COPY --from=nemo-rl tools/build-custom-vllm.sh ./tools/build-custom-vllm.sh

‎docker/Dockerfile.ngc_pytorch‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ rm -rf /var/lib/apt/lists/*
3838
EOF
3939

4040
# Install uv at /usr/local/bin in case the root home directory is bind mounted
41-
ARG UV_VERSION=0.7.2
41+
ARG UV_VERSION=0.9.1
4242
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | XDG_BIN_HOME=/usr/local/bin sh
4343

4444
# Disable usage stats by default for users who are sensitive to sharing usage.
4545
# Users are encouraged to enable if they wish.
4646
ENV RAY_USAGE_STATS_ENABLED=0
47+
# After ray>=2.47, this feature is enabled by default which creates uv venvs for any py_executable starting with `uv run`.
48+
# There is severe contention and performance issues with this enabled considering our dependencies are so large and occasionally
49+
# need to be compiled, so NeMo RL has an implementation in nemo_rl/utils/venv.py that does it once per node as opposed to once per task.
50+
ENV RAY_ENABLE_UV_RUN_RUNTIME_ENV=0
4751
ENV NEMO_RL_VENV_DIR=/opt/ray_venvs
4852

4953
# Build vLLM from source to use with the NVIDIA PyTorch base image

‎examples/configs/dpo.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ policy:
113113
moe_permute_fusion: false
114114
#gives ~20% training perf speedup with sequence packing
115115
apply_rope_fusion: True
116+
# gives ~25% training perf speedup with sequence packing and apply_rope_fusion
117+
bias_activation_fusion: True
118+
defer_fp32_logits: null
116119

117120
optimizer:
118121
optimizer: "adam"

‎examples/configs/grpo_math_1B.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ policy:
8484

8585
megatron_cfg:
8686
enabled: false
87-
empty_unused_memory_level: 0
87+
empty_unused_memory_level: 1 # 1 is the minimum recommendation for RL since we almost always need to offload before beginning generation. Setting to 0 is faster, but you are more likely to run out of GPU memory.
8888
activation_checkpointing: false
8989
converter_type: "Qwen2ForCausalLM"
9090
tensor_model_parallel_size: 1

‎examples/configs/grpo_math_1B_megatron.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ policy:
7777

7878
megatron_cfg:
7979
enabled: true
80-
empty_unused_memory_level: 0
80+
empty_unused_memory_level: 1 # 1 is the minimum recommendation for RL since we almost always need to offload before beginning generation. Setting to 0 is faster, but you are more likely to run out of GPU memory.
8181
activation_checkpointing: false
8282
converter_type: "Qwen2ForCausalLM"
8383
tensor_model_parallel_size: 1

‎examples/configs/grpo_math_8B_megatron.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ policy:
3030

3131
megatron_cfg:
3232
enabled: true
33-
empty_unused_memory_level: 0
33+
empty_unused_memory_level: 1 # 1 is the minimum recommendation for RL since we almost always need to offload before beginning generation. Setting to 0 is faster, but you are more likely to run out of GPU memory.
3434
converter_type: "LlamaForCausalLM"
3535
tensor_model_parallel_size: 1
3636
# On H100, can run with pp=1 for better performance with expandable segments (which is enabled by default)

0 commit comments

Comments
 (0)