test(sft): capture warnings before prefetch (#358) #959
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── Pre-commit checks (ruff check/format, copyright, gitleaks, trailing-whitespace etc.) ── | |
| pre-commit: | |
| name: Pre-commit Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.10" | |
| - name: Run prek | |
| uses: j178/prek-action@v3.0.0 | |
| # ── Unit tests (matrix: Python 3.10 / 3.11 / 3.12) ──────────────────────── | |
| test: | |
| name: Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| - name: Install system deps | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y libsndfile1 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install PyTorch CPU-only build | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install pybase64 | |
| pip install tensordict | |
| # Install project in editable mode (--no-deps to avoid re-installing | |
| # torch from PyPI and to tolerate packages that may fail to compile) | |
| pip install --no-deps -e . | |
| # Install requirements, skipping packages that need GPU or are unavailable in CI | |
| pip install -r requirements.txt || true | |
| # Create a stub for transfer_queue (internal package, not on PyPI) | |
| python -c " | |
| import os, site | |
| sp = site.getsitepackages()[0] | |
| os.makedirs(sp, exist_ok=True) | |
| with open(os.path.join(sp, 'transfer_queue.py'), 'w') as f: | |
| f.write('# CI stub for transfer_queue (internal package)\n') | |
| f.write('class StreamingTokenBudgetSampler:\n') | |
| f.write(' def __init__(self, *a, **k): self._states = {}\n') | |
| f.write('class SeqlenBalancedSampler(StreamingTokenBudgetSampler): pass\n') | |
| f.write('class _Stub:\n') | |
| f.write(' def __getattr__(self, name): return self\n') | |
| f.write(' def __call__(self, *a, **k): return self\n') | |
| f.write('_s = _Stub()\n') | |
| f.write('def __getattr__(name): return _s\n') | |
| " | |
| - name: Run tests | |
| run: | | |
| pytest tests/ \ | |
| -v \ | |
| --tb=short \ | |
| -x \ | |
| --ignore=tests/autoscale |