From e9c3a2aec07e59e2d87c8c85f0bc47b4dac45910 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Tue, 19 Nov 2024 12:43:30 -0500 Subject: [PATCH] add missing dunder-init for monkeypatches and add tests for install from sdist (#2085) * add missing dunder-init for monkeypatches and add tests for install from sdist * fix gha name * reduce matrix for sdist test --- .github/workflows/tests.yml | 46 ++++++++++++++++++- src/axolotl/monkeypatch/__init__.py | 0 src/axolotl/monkeypatch/attention/__init__.py | 0 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/axolotl/monkeypatch/__init__.py create mode 100644 src/axolotl/monkeypatch/attention/__init__.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ae37f9882..b5c336246b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,12 +77,56 @@ jobs: run: | find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \; + pytest-sdist: + name: PyTest from Source Dist + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python_version: ["3.11"] + pytorch_version: ["2.4.1", "2.5.1"] + timeout-minutes: 20 + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + cache: 'pip' # caching pip dependencies + + - name: upgrade pip + run: | + pip3 install --upgrade pip + pip3 install --upgrade packaging setuptools wheel + + - name: Install PyTorch + run: | + pip3 install torch==${{ matrix.pytorch_version }} + + - name: Install dependencies + run: | + pip3 show torch + python3 setup.py sdist + pip3 install dist/axolotl*.tar.gz + pip3 install -r requirements-dev.txt -r requirements-tests.txt + + - name: Run tests + run: | + pytest -n8 --ignore=tests/e2e/ tests/ + + - name: cleanup pip cache + run: | + find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \; + docker-e2e-tests-1st: if: ${{ ! contains(github.event.commits[0].message, '[skip e2e]') && github.repository_owner == 'axolotl-ai-cloud' }} # this job needs to be run on self-hosted GPU runners... runs-on: [self-hosted, modal] timeout-minutes: 90 - needs: [pre-commit, pytest] + needs: [pre-commit, pytest, pytest-sdist] strategy: fail-fast: false diff --git a/src/axolotl/monkeypatch/__init__.py b/src/axolotl/monkeypatch/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/axolotl/monkeypatch/attention/__init__.py b/src/axolotl/monkeypatch/attention/__init__.py new file mode 100644 index 0000000000..e69de29bb2