diff --git a/.github/workflows/_run_test.yml b/.github/workflows/_run_test.yml index 3a85b30c04..faf1848cad 100644 --- a/.github/workflows/_run_test.yml +++ b/.github/workflows/_run_test.yml @@ -39,6 +39,9 @@ on: description: Failure will cancel all other tests if set to true required: false default: false + secrets: + HF_TOKEN: + required: true outputs: conclusion: description: Conclusion of main test step @@ -60,24 +63,26 @@ jobs: - name: Docker pull image run: | - docker pull nemoci.azurecr.io/nemo__placeholder_container:${{ github.run_id }} + docker pull nemoci.azurecr.io/nemo_reinforcer_container:${{ github.run_id }} - name: Start container run: | docker run --rm -d --name nemo_container_${{ github.run_id }} --runtime=nvidia --gpus all --shm-size=64g \ --env TRANSFORMERS_OFFLINE=0 \ --env HYDRA_FULL_ERROR=1 \ - --env HF_HOME=/home/TestData/_placeholder/hf_home \ - --env _PLACEHOLDER_CI_DIR=/home/TestData/_placeholder \ - --env _PLACEHOLDER_REPO_DIR=/opt/NeMo-_Placeholder \ - --volume /mnt/datadrive/TestData/_placeholder/checkpoints:/home/TestData/_placeholder/checkpoints:ro \ - --volume /mnt/datadrive/TestData/_placeholder/hf_home/hub:/home/TestData/_placeholder/hf_home/hub:ro \ - nemoci.azurecr.io/nemo__placeholder_container:${{ github.run_id }} \ + --env HF_HOME=/home/TestData/reinforcer/hf_home \ + --env REINFORCER_CI_DIR=/home/TestData/reinforcer \ + --env REINFORCER_REPO_DIR=/opt/NeMo-Reinforcer \ + --volume /mnt/datadrive/TestData/reinforcer/checkpoints:/home/TestData/reinforcer/checkpoints:ro \ + --volume /mnt/datadrive/TestData/reinforcer/hf_home/hub:/home/TestData/reinforcer/hf_home/hub \ + nemoci.azurecr.io/nemo_reinforcer_container:${{ github.run_id }} \ bash -c "sleep $(( ${{ inputs.TIMEOUT }} * 60 + 60 ))" - id: main name: Run main script timeout-minutes: ${{ inputs.TIMEOUT }} + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | # Print the host driver for debugging nvidia-smi @@ -90,14 +95,13 @@ jobs: cmd=$(cat <<"RUN_TEST_EOF" nvidia-smi - # Sanity check the driver/cuda combo - cudaCheck - # In case git commands need to be run inside _Placeholder - git config --global --add safe.directory $_PLACHOLDER_REPO_DIR + + # In case git commands need to be run inside Reinforcer + git config --global --add safe.directory $REINFORCER_REPO_DIR ${{ inputs.SCRIPT }} RUN_TEST_EOF ) - docker exec nemo_container_${{ github.run_id }} bash -eux -o pipefail -c "$cmd" + docker exec -u root -e HF_TOKEN nemo_container_${{ github.run_id }} bash -eux -o pipefail -c "$cmd" ) 2> >(tee err.log) EXIT_CODE=$? diff --git a/.github/workflows/build-test-publish-wheel.yml b/.github/workflows/build-test-publish-wheel.yml deleted file mode 100644 index 1b6c5a3021..0000000000 --- a/.github/workflows/build-test-publish-wheel.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2025, 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. -# name: Build, test, and publish a PyPi wheel (to testpypi) - -# on: -# push: -# branches: -# - main -# - 'r**' - -# defaults: -# run: -# shell: bash -x -e -u -o pipefail {0} - -# jobs: -# build-test-publish-wheel: -# uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_build_test_publish_wheel.yml@v0.22.3 -# with: -# dry-run: true -# python-package: nemo__placeholder -# python-version: "3.12" -# secrets: -# TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} -# TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} -# SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_ENDPOINT }} -# SLACK_WEBHOOK_ADMIN: ${{ secrets.SLACK_WEBHOOK_ADMIN }} diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml index 627544fc81..d79d0cf61f 100644 --- a/.github/workflows/cicd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -11,7 +11,7 @@ # 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. -name: "CICD NeMo _Placeholder" +name: "CICD Reinforcer" on: pull_request: @@ -101,23 +101,30 @@ jobs: pip install pre-commit pre-commit install pre-commit run --all-files --show-diff-on-failure --color=always + + build-container: + if: ${{ needs.pre-flight.outputs.run_ci == 'true' }} + needs: [pre-flight] + uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_build_container.yml@v0.22.7 + with: + build-ref: ${{ github.sha }} + image-name: nemo_reinforcer_container + dockerfile: docker/Dockerfile + image-label: nemo-reinforcer + build-args: | + MAX_JOBS=32 + REINFORCER_COMMIT=${{ github.sha }} unit-tests: name: Unit tests - needs: [pre-flight] - runs-on: ubuntu-latest + needs: [build-container, pre-flight] + uses: ./.github/workflows/_run_test.yml if: ${{ needs.pre-flight.outputs.run_ci == 'true' }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Run unit tests - run: | - pip install uv - uv venv -p python3.10 .venv - uv pip install --force-reinstall . - uv run --group test -- pytest - - - name: after_script - if: always() - run: | - rm -rf .venv + with: + RUNNER: self-hosted-azure + TIMEOUT: 10 + SCRIPT: | + cd ${REINFORCER_REPO_DIR} + uv run bash -x ./tests/run_unit.sh + secrets: + HF_TOKEN: ${{ secrets.HF_TOKEN }} diff --git a/.github/workflows/release-freeze.yml b/.github/workflows/release-freeze.yml index 176b6681e0..5588b97e0f 100644 --- a/.github/workflows/release-freeze.yml +++ b/.github/workflows/release-freeze.yml @@ -36,8 +36,8 @@ jobs: code-freeze: uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_code_freeze.yml@v0.22.5 with: - library-name: NeMo-_Placeholder - python-package: nemo__placeholder + library-name: NeMo-reinforcer + python-package: nemo_reinforcer release-type: ${{ inputs.release-type }} freeze-commit: ${{ inputs.freeze-commit }} dry-run: ${{ inputs.dry-run }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 247e821beb..829193c302 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ # 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. -name: "Release _Placeholder" +name: "Release Reinforcer" on: workflow_dispatch: @@ -35,9 +35,9 @@ jobs: uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_release_library.yml@v0.22.6 with: release-ref: ${{ inputs.release-ref }} - python-package: nemo__placeholder + python-package: nemo_reinforcer python-version: "3.11" - library-name: NeMo-_Placeholder + library-name: NeMo-Reinforcer dry-run: ${{ inputs.dry-run }} version-bump-branch: ${{ inputs.version-bump-branch }} secrets: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba48b680ae..2b02a7fb63 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,8 +37,8 @@ We follow a direct clone and branch workflow for now: 1. Clone the repository directly: ```bash - git clone https://github.com/NVIDIA/nemo__placeholder - cd nemo-reinforcer + git clone https://github.com/NVIDIA/reinforcer + cd reinforcer ``` 2. Create a new branch for your changes: diff --git a/docker/Dockerfile b/docker/Dockerfile index 9031b0a9be..3ac272200e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,18 @@ ARG BASE_IMAGE=anyscale/ray:2.43.0-py312-cu125 FROM ${BASE_IMAGE} +WORKDIR /opt/NeMo-Reinforcer + RUN sudo apt-get update && sudo apt-get install -y jq -RUN pip install --no-cache-dir uv RUN echo "unset RAY_RUNTIME_ENV_HOOK" >> /home/ray/.bashrc + +COPY pyproject.toml . + +RUN pip install uv && \ + uv venv -p python3.12 && \ + uv pip install -r pyproject.toml --extra dev --extra test + +COPY . . + +RUN uv pip install -e . diff --git a/nemo__placeholder/__init__.py b/nemo__placeholder/__init__.py deleted file mode 100644 index f5e16b0d09..0000000000 --- a/nemo__placeholder/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from nemo__placeholder.package_info import ( - __contact_emails__, - __contact_names__, - __description__, - __download_url__, - __homepage__, - __keywords__, - __license__, - __package_name__, - __repository_url__, - __shortversion__, - __version__, -) diff --git a/nemo_reinforcer/__init__.py b/nemo_reinforcer/__init__.py index e69de29bb2..76b1dda065 100644 --- a/nemo_reinforcer/__init__.py +++ b/nemo_reinforcer/__init__.py @@ -0,0 +1,13 @@ +from nemo_reinforcer.package_info import ( + __contact_emails__, + __contact_names__, + __description__, + __download_url__, + __homepage__, + __keywords__, + __license__, + __package_name__, + __repository_url__, + __shortversion__, + __version__, +) diff --git a/nemo__placeholder/package_info.py b/nemo_reinforcer/package_info.py similarity index 70% rename from nemo__placeholder/package_info.py rename to nemo_reinforcer/package_info.py index e1daf52f75..ea2977b049 100644 --- a/nemo__placeholder/package_info.py +++ b/nemo_reinforcer/package_info.py @@ -24,12 +24,12 @@ __shortversion__ = ".".join(map(str, VERSION[:3])) __version__ = ".".join(map(str, VERSION[:3])) + "".join(VERSION[3:]) -__package_name__ = "nemo__placeholder" +__package_name__ = "nemo_reinforcer" __contact_names__ = "NVIDIA" -__contact_emails__ = "nemo-_placeholder@nvidia.com" +__contact_emails__ = "nemo-tookit@nvidia.com" __homepage__ = "https://docs.nvidia.com/deeplearning/nemo/user-guide/docs/en/stable/" -__repository_url__ = "https://github.com/nvidia/nemo__placeholder" -__download_url__ = "https://github.com/NVIDIA/NeMo__placeholder" -__description__ = "_placeholder" +__repository_url__ = "https://github.com/NVIDIA/reinforcer" +__download_url__ = "https://github.com/NVIDIA/reinforcer/releases" +__description__ = "NeMo-Reinforcer - a toolkit for model alignment" __license__ = "Apache2" -__keywords__ = "_placeholder" +__keywords__ = "deep learning, machine learning, gpu, NLP, NeMo, nvidia, pytorch, torch, language, reinforcement learning, RLHF, preference modeling, SteerLM, DPO" diff --git a/tests/unit/test__placeholder.py b/tests/unit/test__placeholder.py deleted file mode 100644 index 0ae23d24f7..0000000000 --- a/tests/unit/test__placeholder.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2025, 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. - - -def test__placeholder(): - """Should be True""" - assert True is True