Skip to content

Commit

Permalink
switch to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
baberabb committed Dec 30, 2024
1 parent 79251b4 commit 51bc400
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 51 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/new_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
# comment/edit out the above to stop/change the triggers
jobs:
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
runs-on: ubuntu-latest
timeout-minutes: 120
name: Scan for changed tasks
steps:
- name: checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2 # OR "2" -> To retrieve the preceding commit.
fetch-depth: 2

# Uses the tj-actions/changed-files action to check for changes.
# Outputs provided here: https://github.com/tj-actions/changed-files#outputs
Expand All @@ -36,37 +36,35 @@ jobs:
- lm_eval/api/**
write_output_files: true

# The next step is optional; the files are written to the workspace by default (above).
# so it's just for debugging
- name: Run Tests
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
run: |
echo .github/outputs/tasks_all_changed_and_modified_files.txt >> 'GITHUB_ENV'
echo "One or more test file(s) has changed."
echo "List of all the files that have changed: ${{ steps.changed-tasks.outputs.tasks_all_modified_files }}"
- name: Set up Python 3.9
- name: Install uv
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v5
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: setup.py
python-version: "3.9"
enable-cache: true
cache-dependency-glob: "setup.py"

- name: Install dependencies
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
env:
UV_SYSTEM_PYTHON: 1
run: |
python -m pip install --upgrade pip
pip install -e '.[dev,ifeval]' --extra-index-url https://download.pytorch.org/whl/cpu
# Install optional git dependencies
# pip install bleurt@https://github.com/google-research/bleurt/archive/b610120347ef22b494b6d69b4316e303f5932516.zip#egg=bleurt
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
uv pip install -e '.[dev,ifeval]' --extra-index-url https://download.pytorch.org/whl/cpu
- name: Test with pytest
# if new tasks are added, run tests on them
if: steps.changed-tasks.outputs.tasks_any_modified == 'true'
run: python -m pytest tests/test_tasks.py -s -vv
run: uv run pytest tests/test_tasks.py -s -vv
# if api is modified, run tests on it
- name: Test more tasks with pytest
env:
API: true
if: steps.changed-tasks.outputs.api_any_modified == 'true'
run: python -m pytest tests/test_tasks.py -s -vv
run: uv run pytest tests/test_tasks.py -s -vv
61 changes: 27 additions & 34 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# just comment out unwanted steps to turn off the test.
name: Unit Tests

on:
push:
branches:
Expand All @@ -11,8 +7,7 @@ on:
branches:
- 'main'
workflow_dispatch:
# Jobs run concurrently and steps run sequentially within a job.
# jobs: linter and cpu_tests. Add more jobs/steps as required.

jobs:
linter:
name: Linters
Expand All @@ -22,69 +17,67 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: pip
cache-dependency-path: pyproject.toml
- name: Pre-Commit
- name: Install dependencies and run pre-commit
env:
SKIP: "no-commit-to-branch,mypy"
run: |
uv pip install pre-commit
pre-commit run --all-files
uses: pre-commit/[email protected]
# # mypy turned off for now
# - name: Lint with mypy
# run: mypy . --ignore-missing-imports --check-untyped-defs --explicit-package-bases --warn-unreachable
# Job 2
testcpu:
name: CPU Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12" ]
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
env:
UV_SYSTEM_PYTHON: 1
run: |
python -m pip install --upgrade pip
pip install -e '.[dev,sentencepiece,api]' --extra-index-url https://download.pytorch.org/whl/cpu
# Install optional git dependencies
# pip install bleurt@https://github.com/google-research/bleurt/archive/b610120347ef22b494b6d69b4316e303f5932516.zip#egg=bleurt
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
uv pip install -e '.[dev,sentencepiece,api]' --extra-index-url https://download.pytorch.org/whl/cpu
- name: Test with pytest
run: python -m pytest --showlocals -s -vv -n=auto --ignore=tests/models/test_neuralmagic.py --ignore=tests/models/test_openvino.py
run: uv run pytest --showlocals -s -vv -n=auto --ignore=tests/models/test_neuralmagic.py --ignore=tests/models/test_openvino.py
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: output_testcpu${{ matrix.python-version }}
path: |
test_logs/*
testmodels:
name: External LM Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: 3.9
cache: pip
cache-dependency-path: pyproject.toml
python-version: "3.9"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install dependencies
env:
UV_SYSTEM_PYTHON: 1
run: |
python -m pip install --upgrade pip
pip install -e '.[dev,optimum,deepsparse,sparseml,api]' --extra-index-url https://download.pytorch.org/whl/cpu
pip install -U transformers peft
uv pip install -e '.[dev,optimum,deepsparse,sparseml,api]' --extra-index-url https://download.pytorch.org/whl/cpu
uv pip install -U transformers peft
- name: Test with pytest
run: python -m pytest tests/models --showlocals -s -vv
run: uv run pytest tests/models --showlocals -s -vv

0 comments on commit 51bc400

Please sign in to comment.