Test hfh 1.9.0.rc0 #2609
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: Unit tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "*-release" | |
| pull_request: | |
| branches: | |
| - main | |
| - "*-release" | |
| workflow_dispatch: | |
| env: | |
| TRANSFORMERS_IS_CI: 1 | |
| HF_HUB_DISABLE_PROGRESS_BARS: 1 # The Transformers v5 weight loading progress bars heavily expand the logs | |
| jobs: | |
| test_sampling: | |
| name: Run unit tests | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, windows-latest] | |
| transformers-version: ["<5.0.0", ">=5.0.0"] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Remove unnecessary files | |
| run: | | |
| df -h / | |
| # Remove software and language runtimes we're not using | |
| sudo rm -rf \ | |
| "$AGENT_TOOLSDIRECTORY" \ | |
| /opt/google/chrome \ | |
| /opt/microsoft/msedge \ | |
| /opt/microsoft/powershell \ | |
| /opt/pipx \ | |
| /usr/lib/mono \ | |
| /usr/local/julia* \ | |
| /usr/local/lib/android \ | |
| /usr/local/lib/node_modules \ | |
| /usr/local/share/chromium \ | |
| /usr/local/share/powershell \ | |
| /usr/share/dotnet \ | |
| /usr/share/swift | |
| df -h / | |
| if: runner.os == 'Linux' | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Python environment | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6 | |
| - name: Install dependencies (transformers < 5.0.0) | |
| if: ${{ matrix.transformers-version == '<5.0.0' }} | |
| run: uv pip install --prerelease=allow '.[train, onnx, openvino, dev]' 'transformers<5.0.0' 'datasets>=3.3.0' --system | |
| - name: Install dependencies (transformers >= 5.0.0) | |
| if: ${{ matrix.transformers-version == '>=5.0.0' }} | |
| run: uv pip install --prerelease=allow '.[train, dev]' 'transformers>=5.0.0' --system | |
| - name: Install model2vec | |
| run: uv pip install --prerelease=allow model2vec[distill] --system | |
| if: ${{ contains(fromJSON('["3.10", "3.11", "3.12", "3.13"]'), matrix.python-version) }} | |
| - name: Run unit tests | |
| run: | | |
| python -m pytest --durations 20 -sv tests/ |