diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f7219141..37848158 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: + python: - "3.9" - "3.10" - "3.11" @@ -34,6 +34,10 @@ jobs: runs-on: ${{ matrix.os }} + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + env: HF_TOKEN: ${{ secrets.HF_TOKEN }} OS_NAME: ${{ matrix.os }} @@ -45,7 +49,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python }} cache: "pip" cache-dependency-path: "setup.py" @@ -54,6 +58,12 @@ jobs: python -m pip install --upgrade pip python -m pip install ".[torch,dev]" + - name: Cache files + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/huggingface + key: huggingface-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('tests/version.txt') }} + - name: Check quality run: | make style && make quality @@ -65,3 +75,5 @@ jobs: - name: Test with pytest run: | make test + env: + HF_HOME: ${{ runner.temp }}/huggingface diff --git a/requirements.txt b/requirements.txt index 8b666ce3..61820560 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ -transformers>=4.41.2,<=4.50.0,!=4.46.*,!=4.47.*,!=4.48.*;python_version<'3.10' -transformers>=4.41.2,<=4.50.0,!=4.46.*,!=4.47.*,!=4.48.0;python_version>='3.10' +transformers>=4.41.2,<=4.50.0,!=4.46.*,!=4.47.*,!=4.48.*;python_version<'3.10' and sys_platform != 'darwin' +transformers>=4.41.2,<=4.50.0,!=4.46.*,!=4.47.*,!=4.48.0;python_version>='3.10' and sys_platform != 'darwin' +transformers>=4.41.2,<=4.49.0,!=4.46.*,!=4.47.*,!=4.48.*;sys_platform == 'darwin' datasets>=2.16.0,<=3.3.2 accelerate>=0.34.0,<=1.4.0 peft>=0.11.1,<=0.12.0 diff --git a/tests/check_license.py b/tests/check_license.py index 853d2399..1512347d 100644 --- a/tests/check_license.py +++ b/tests/check_license.py @@ -20,7 +20,7 @@ KEYWORDS = ("Copyright", "2025", "LlamaFactory") def main(): - path_list = [] + path_list: list[Path] = [] for check_dir in sys.argv[1:]: path_list.extend(Path(check_dir).glob("**/*.py")) diff --git a/tests/version.txt b/tests/version.txt new file mode 100644 index 00000000..1f4eec6c --- /dev/null +++ b/tests/version.txt @@ -0,0 +1 @@ +0.9.3.100