Skip to content

Fix inference device placement for quantized and dispatched models #771

Fix inference device placement for quantized and dispatched models

Fix inference device placement for quantized and dispatched models #771

Workflow file for this run

name: Minimum version tests
on:
push:
branches:
- main
- "*-release"
pull_request:
branches:
- main
- "*-release"
paths:
- "pyproject.toml"
- "sentence_transformers/**"
- ".github/workflows/min-versions.yml"
workflow_dispatch:
env:
TRANSFORMERS_IS_CI: 1
HF_HUB_DISABLE_PROGRESS_BARS: 1
HF_TOKEN: ${{ secrets.HF_TOKEN }} # Read token to avoid rate limits / gated-repo failures when downloading from the Hub
jobs:
test_min_versions:
name: Test minimum dependency versions
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
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
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Python environment
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install FFmpeg libraries (needed to build av)
run: sudo apt-get update && sudo apt-get install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libswresample-dev
- name: Install with minimum versions
# Runtime deps at lowest resolution & dev tools at normal resolution
# av>=12 because av==9.2.0 (from transformers[video]) fails to compile with modern Cython
# scipy>=1.7.2 because older scipy has no wheels for Python 3.10+ and fails to build from source
# accelerate>=1.13.0 because older accelerate cannot dispatch streaming (IterableDataset) batches
# with string columns, breaking the streaming trainer tests
run: |
uv pip install '.[train]' 'transformers[vision,audio,video]' 'av>=12.0.0' 'scipy>=1.7.2' 'accelerate>=1.13.0' --resolution lowest-direct --system
uv pip install pytest pytest-cov pytest-env pytest-subtests pytest-xdist peft --system
- name: Show installed versions
run: uv pip list --system | grep -iE 'transformers|huggingface|torch|numpy|scikit|scipy|typing.ext|tqdm|accelerate'
- name: Run unit tests
run: python -m pytest --durations 20 -sv tests/