From d1cee0c45fc7c353f55f7241c5fc735e54a97926 Mon Sep 17 00:00:00 2001 From: Dan McPherson Date: Thu, 29 Aug 2024 18:55:08 -0400 Subject: [PATCH 1/2] Fix typos Signed-off-by: Dan McPherson --- src/instructlab/training/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/instructlab/training/utils.py b/src/instructlab/training/utils.py index 96d86c57..89fd3c24 100644 --- a/src/instructlab/training/utils.py +++ b/src/instructlab/training/utils.py @@ -373,7 +373,7 @@ def prepare_universal_checkpoint_from_latest(output_dir): Be aware that this creates an extra dir `zero/` in the checkpoint dir, which doubles the DS checkpoint storage requirement. - DS checkpoints store 3X model parameters in 32bit. - - e.g., will be 6X a model paramter-only checkpoint in 16bit. + - e.g., will be 6X a model parameter-only checkpoint in 16bit. Note that this requires a latest version of deepspeed. It kind of works if the model is not saving universal checkpoint info, but only in the @@ -509,7 +509,7 @@ def ensure_loadable_granite_checkpoint( # in different nodes tmpdir = Path(tmpdir) / f"tmp.{group_rank}" if os.path.exists(tmpdir) and (not dist.is_initialized() or local_rank == 0): - # need to delete if it exists because import doesnt like it to + # need to delete if it exists because import doesn't like it to shutil.rmtree(tmpdir, ignore_errors=True) if not dist.is_initialized() or local_rank == 0: @@ -670,7 +670,7 @@ def save_hf_format_ds( save_file(model_state, Path(tmpdir) / WEIGHTS_NAME) tmp_conf.to_json_file(Path(tmpdir) / CONFIG_NAME) tokenizer.save_pretrained(tmpdir) - # export doesnt like the directory to exist + # export doesn't like the directory to exist shutil.rmtree(output_dir) export_to_huggingface( From 9310180b0b55b2b48f90680ffb66a8fe2db0770e Mon Sep 17 00:00:00 2001 From: Nathan Weinberg Date: Fri, 30 Aug 2024 11:09:27 -0400 Subject: [PATCH 2/2] ci: update lint action to align with other repos Signed-off-by: Nathan Weinberg --- .github/mergify.yml | 1 - .github/workflows/lint.yml | 64 ++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index 6d3c0b48..842c3225 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -60,7 +60,6 @@ pull_request_rules: - -files~=^scripts/[^/]+\.sh$ - -files=.github/workflows/lint.yml - actions: merge: method: merge diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d7fd25ea..ca82f6a3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,8 +12,8 @@ on: - 'pyproject.toml' - 'requirements*.txt' - 'tox.ini' - - 'scripts/*.sh' - - '.github/workflows/lint.yml' + - 'scripts/*.sh' # Used by this workflow + - '.github/workflows/lint.yml' # This workflow pull_request: branches: - "main" @@ -23,18 +23,40 @@ on: - 'pyproject.toml' - 'requirements*.txt' - 'tox.ini' - - 'scripts/*.sh' - - '.github/workflows/lint.yml' + - 'scripts/*.sh' # Used by this workflow + - '.github/workflows/lint.yml' # This workflow env: - PYTHON_VERSION: 3.11 + LC_ALL: en_US.UTF-8 + +defaults: + run: + shell: bash + +permissions: + contents: read jobs: lint: runs-on: ubuntu-latest + name: "${{ matrix.lint.name }}" + strategy: + fail-fast: false + matrix: + lint: + - name: "ruff" + commands: | + tox -e ruff -- check + - name: "pylint" + commands: | + echo "::add-matcher::.github/workflows/matchers/pylint.json" + tox -e lint + - name: "mypy" + commands: | + tox -e mypy steps: - name: "Harden Runner" - uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 + uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 with: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs @@ -43,10 +65,9 @@ jobs: with: # https://github.com/actions/checkout/issues/249 fetch-depth: 0 - submodules: true - name: Setup Python 3.11 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 with: python-version: 3.11 cache: pip @@ -54,23 +75,20 @@ jobs: **/pyproject.toml **/requirements*.txt - - name: Install dependencies - id: deps + - name: Install tox run: | python -m pip install --upgrade pip - python -m pip install tox - - - name: Run Ruff check - run: | - tox -e ruff -- check + python -m pip install tox tox-gh - - name: Run linting - if: ${{ !cancelled() && (steps.deps.outcome == 'success') }} + - name: "${{ matrix.lint.name }}" run: | - echo "::add-matcher::.github/workflows/matchers/pylint.json" - tox -e lint + ${{ matrix.lint.commands }} + env: + RUFF_OUTPUT_FORMAT: github - - name: Run mypy type checks - if: ${{ !cancelled() && (steps.deps.outcome == 'success') }} - run: | - tox -e mypy + lint-workflow-complete: + needs: ["lint"] + runs-on: ubuntu-latest + steps: + - name: Lint Workflow Complete + run: echo "Lint Workflow Complete"