chore: import upstream snapshot with attribution
Build documentation / build (push) Failing after 0s
Deploy "method_comparison" Gradio to Spaces / deploy (push) Has been cancelled
Deploy "PEFT shop" Gradio app to Spaces / deploy (push) Has been cancelled
tests on transformers main / tests (push) Has been cancelled
tests / check_code_quality (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.11) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.12) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.11) (push) Has been cancelled
tests / tests (windows-latest, 3.12) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
CI security linting / zizmor latest via Cargo (push) Has been cancelled
Build documentation / build (push) Failing after 0s
Deploy "method_comparison" Gradio to Spaces / deploy (push) Has been cancelled
Deploy "PEFT shop" Gradio app to Spaces / deploy (push) Has been cancelled
tests on transformers main / tests (push) Has been cancelled
tests / check_code_quality (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.11) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.12) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.11) (push) Has been cancelled
tests / tests (windows-latest, 3.12) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
CI security linting / zizmor latest via Cargo (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
name: Build Docker images (scheduled)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
schedule:
|
||||
- cron: "0 1 * * *"
|
||||
|
||||
concurrency:
|
||||
group: docker-image-builds
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
CI_SLACK_CHANNEL: ${{ secrets.CI_DOCKER_CHANNEL }}
|
||||
|
||||
jobs:
|
||||
latest-cpu:
|
||||
name: "Latest Peft CPU [dev]"
|
||||
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
|
||||
environment: branch-protection-main
|
||||
runs-on:
|
||||
group: aws-general-8-plus
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||
- name: Check out code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Build and Push CPU
|
||||
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||
with:
|
||||
context: ./docker/peft-cpu
|
||||
push: true
|
||||
tags: huggingface/peft-cpu
|
||||
|
||||
- name: Post to Slack
|
||||
if: always()
|
||||
uses: huggingface/hf-workflows/.github/actions/post-slack@3f88d63d3761558a32e8e46fc2a8536e04bb2aea # main from Feb 2025-02-24
|
||||
with:
|
||||
slack_channel: ${{ env.CI_SLACK_CHANNEL }}
|
||||
title: 🤗 Results of the PEFT-CPU docker build
|
||||
status: ${{ job.status }}
|
||||
slack_token: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
|
||||
|
||||
latest-cuda:
|
||||
name: "Latest Peft GPU [dev]"
|
||||
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
|
||||
environment: branch-protection-main
|
||||
runs-on:
|
||||
group: aws-general-8-plus
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||
- name: Check out code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Build and Push GPU
|
||||
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||
with:
|
||||
context: ./docker/peft-gpu
|
||||
push: true
|
||||
tags: huggingface/peft-gpu
|
||||
|
||||
- name: Post to Slack
|
||||
if: always()
|
||||
uses: huggingface/hf-workflows/.github/actions/post-slack@3f88d63d3761558a32e8e46fc2a8536e04bb2aea # main from Feb 2025-02-24
|
||||
with:
|
||||
slack_channel: ${{ env.CI_SLACK_CHANNEL }}
|
||||
title: 🤗 Results of the PEFT-GPU docker build
|
||||
status: ${{ job.status }}
|
||||
slack_token: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Build documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- doc-builder*
|
||||
- v*-release
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@e60a538eea9817ab312196d0d233604b01697265 # main
|
||||
with:
|
||||
commit_sha: ${{ github.sha }}
|
||||
package: peft
|
||||
notebook_folder: peft_docs
|
||||
secrets:
|
||||
token: ${{ secrets.HUGGINGFACE_PUSH }}
|
||||
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Build PR Documentation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@e60a538eea9817ab312196d0d233604b01697265 # main
|
||||
with:
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
pr_number: ${{ github.event.number }}
|
||||
package: peft
|
||||
@@ -0,0 +1,61 @@
|
||||
name: Deploy "method_comparison" Gradio to Spaces
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- "method_comparison/**"
|
||||
# the method explorer (PEFT shop) app has its own Space and deploy workflow
|
||||
- "!method_comparison/peft-shop/**"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
|
||||
environment: branch-protection-main
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
fetch-depth: 0 # full history needed for subtree
|
||||
persist-credentials: false
|
||||
|
||||
- name: Authenticate via ~/.netrc
|
||||
env:
|
||||
HF_TOKEN: ${{ secrets.PEFT_INTERNAL_REPO_READ_WRITE }}
|
||||
run: |
|
||||
# netrc needs BOTH login and password entries
|
||||
printf "machine huggingface.co\nlogin hf\npassword ${HF_TOKEN}\n" >> ~/.netrc
|
||||
chmod 600 ~/.netrc
|
||||
|
||||
- name: Deploy method_comparison app to HF Spaces
|
||||
run: |
|
||||
cd method_comparison
|
||||
# the method explorer (PEFT shop) app is deployed to its own Space by its own workflow
|
||||
rm -rf peft-shop
|
||||
git init
|
||||
# Spaces expect requirements.txt
|
||||
mv requirements-app.txt requirements.txt
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git remote add gradio-app https://huggingface.co/spaces/peft-internal-testing/PEFT-method-comparison
|
||||
git add .
|
||||
git commit -m "🚀 Deploy method comparison app from GH action"
|
||||
git push -f gradio-app HEAD:main
|
||||
|
||||
- name: Deploy embeddable method_comparison app to HF Spaces (for docs)
|
||||
run: |
|
||||
cd method_comparison
|
||||
rm -rf .git
|
||||
git init
|
||||
# requirements.txt is already present from the previous step
|
||||
mv app_embed.py app.py
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git remote add gradio-app https://huggingface.co/spaces/peft-internal-testing/PEFT-method-comparison-embed
|
||||
git add .
|
||||
git commit -m "🚀 Deploy method comparison app from GH action"
|
||||
git push -f gradio-app HEAD:main
|
||||
@@ -0,0 +1,78 @@
|
||||
name: Deploy "PEFT shop" Gradio app to Spaces
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
# the app itself, and the data sources baked into its data.json: benchmark results and the capability script
|
||||
- "method_comparison/peft-shop/**"
|
||||
- "method_comparison/*/results/**"
|
||||
- "scripts/generate_method_capabilities.py"
|
||||
schedule:
|
||||
# monthly refresh so that newly added PEFT methods reach the Space without a manual dispatch
|
||||
- cron: "0 3 1 * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
|
||||
environment: branch-protection-main
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install PEFT and app dependencies
|
||||
run: |
|
||||
# CPU-only torch keeps the install small and fast; the capability probes run on CPU anyway
|
||||
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
||||
pip install -e . gradio tqdm
|
||||
|
||||
- name: Build the app data
|
||||
run: |
|
||||
# data.json is generated at deploy time so that it always matches the deployed PEFT commit (see
|
||||
# method_comparison/peft-shop/README.md); the app reads method_capabilities.json from the CWD and
|
||||
# writes data.json into its own directory, where the deploy step below picks it up
|
||||
python scripts/generate_method_capabilities.py --output method_capabilities.json
|
||||
python method_comparison/peft-shop/app.py --rebuild --build-only
|
||||
|
||||
- name: Ensure Space exists
|
||||
env:
|
||||
HF_TOKEN: ${{ secrets.PEFT_INTERNAL_REPO_READ_WRITE }}
|
||||
run: |
|
||||
# pushing to a non-existent Space would fail, the Hub does not create repositories on git push
|
||||
python -c "
|
||||
from huggingface_hub import create_repo
|
||||
create_repo('peft-internal-testing/PEFT-shop', repo_type='space', space_sdk='gradio', exist_ok=True)
|
||||
"
|
||||
|
||||
- name: Authenticate via ~/.netrc
|
||||
env:
|
||||
HF_TOKEN: ${{ secrets.PEFT_INTERNAL_REPO_READ_WRITE }}
|
||||
run: |
|
||||
# netrc needs BOTH login and password entries
|
||||
printf "machine huggingface.co\nlogin hf\npassword ${HF_TOKEN}\n" >> ~/.netrc
|
||||
chmod 600 ~/.netrc
|
||||
|
||||
- name: Deploy PEFT shop app to HF Spaces
|
||||
run: |
|
||||
cd method_comparison/peft-shop
|
||||
git init
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git remote add gradio-app https://huggingface.co/spaces/peft-internal-testing/PEFT-shop
|
||||
git add .
|
||||
# data.json is gitignored (see .gitignore) so it doesn't get committed into the PEFT repo during local
|
||||
# dev; force-add it here so the self-contained data file actually ships with the Space
|
||||
git add -f data.json
|
||||
git commit -m "🚀 Deploy PEFT shop app from GH action"
|
||||
git push -f gradio-app HEAD:main
|
||||
@@ -0,0 +1,86 @@
|
||||
name: integration tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to test on'
|
||||
required: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
run_transformers_integration_tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
transformers-version: ['main', 'latest']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
persist-credentials: false
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
cache-dependency-path: "setup.py"
|
||||
- name: print environment variables
|
||||
run: |
|
||||
echo "env.CI_BRANCH = ${CI_BRANCH}"
|
||||
echo "env.CI_SHA = ${CI_SHA}"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install .[test]
|
||||
if [ "${{ matrix.transformers-version }}" == "main" ]; then
|
||||
pip install -U git+https://github.com/huggingface/transformers.git
|
||||
else
|
||||
echo "Nothing to do as transformers latest already installed"
|
||||
fi
|
||||
|
||||
- name: Test transformers integration
|
||||
run: |
|
||||
cd .. && git clone https://github.com/huggingface/transformers.git && cd transformers/ && git rev-parse HEAD
|
||||
RUN_SLOW=1 pytest tests/peft_integration/test_peft_integration.py
|
||||
run_diffusers_integration_tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# For now diffusers integration is not on PyPI
|
||||
diffusers-version: ['main']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
persist-credentials: false
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
cache-dependency-path: "setup.py"
|
||||
- name: print environment variables
|
||||
run: |
|
||||
echo "env.CI_BRANCH = ${CI_BRANCH}"
|
||||
echo "env.CI_SHA = ${CI_SHA}"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install .[test]
|
||||
|
||||
if [ "${{ matrix.diffusers-version }}" == "main" ]; then
|
||||
pip install -U git+https://github.com/huggingface/diffusers.git
|
||||
else
|
||||
echo "Nothing to do as diffusers latest already installed"
|
||||
fi
|
||||
|
||||
- name: Test diffusers integration
|
||||
run: |
|
||||
cd .. && git clone https://github.com/huggingface/diffusers.git && cd diffusers/ && git rev-parse HEAD
|
||||
pytest tests/lora/test_lora_layers_peft.py
|
||||
@@ -0,0 +1,152 @@
|
||||
name: Self-hosted runner with slow tests (scheduled)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 2 * * *"
|
||||
|
||||
env:
|
||||
RUN_SLOW: "yes"
|
||||
IS_GITHUB_CI: "1"
|
||||
# To be able to run tests on CUDA 12.2
|
||||
NVIDIA_DISABLE_REQUIRE: "1"
|
||||
SLACK_API_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
run_all_tests_single_gpu:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on:
|
||||
group: aws-g6-4xlarge-plus
|
||||
env:
|
||||
CUDA_VISIBLE_DEVICES: "0"
|
||||
TEST_TYPE: "single_gpu"
|
||||
container:
|
||||
image: huggingface/peft-gpu:latest
|
||||
options: --gpus all --shm-size "16gb" -e NVIDIA_DISABLE_REQUIRE=true
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Pip install
|
||||
run: |
|
||||
source activate peft
|
||||
pip install -e . --no-deps
|
||||
pip install pytest-reportlog
|
||||
|
||||
- name: Run common tests on single GPU
|
||||
id: common_tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_common_gpu
|
||||
|
||||
- name: Run examples on single GPU
|
||||
id: examples
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_examples_single_gpu
|
||||
|
||||
- name: Run core tests on single GPU
|
||||
id: core_tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_core_single_gpu
|
||||
|
||||
- name: Run regression tests on single GPU
|
||||
id: regression
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_regression
|
||||
|
||||
- name: Generate Report
|
||||
if: always()
|
||||
run: |
|
||||
pip install slack_sdk tabulate
|
||||
python scripts/log_reports.py >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Check for test failures
|
||||
if: |
|
||||
steps.common_tests.outcome == 'failure' ||
|
||||
steps.examples.outcome == 'failure' ||
|
||||
steps.core_tests.outcome == 'failure' ||
|
||||
steps.regression.outcome == 'failure'
|
||||
run: |
|
||||
echo "One or more test suites failed. Check the logs above."
|
||||
exit 1
|
||||
|
||||
run_all_tests_multi_gpu:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on:
|
||||
group: aws-g6-12xlarge-plus
|
||||
env:
|
||||
CUDA_VISIBLE_DEVICES: "0,1"
|
||||
TEST_TYPE: "multi_gpu"
|
||||
container:
|
||||
image: huggingface/peft-gpu:latest
|
||||
options: --gpus all --shm-size "16gb" -e NVIDIA_DISABLE_REQUIRE=true
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Pip install
|
||||
run: |
|
||||
source activate peft
|
||||
pip install -e . --no-deps
|
||||
pip install pytest-reportlog
|
||||
|
||||
- name: Run common tests on multi GPU
|
||||
id: common_tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_common_gpu
|
||||
|
||||
- name: Run examples on multi GPU
|
||||
id: examples
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_examples_multi_gpu
|
||||
|
||||
- name: Run core tests on multi GPU
|
||||
id: core_tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_core_multi_gpu
|
||||
|
||||
- name: Run training on multi GPU
|
||||
id: training
|
||||
continue-on-error: true
|
||||
run: |
|
||||
source activate peft
|
||||
make tests_training
|
||||
|
||||
- name: Generate Report
|
||||
if: always()
|
||||
run: |
|
||||
pip install slack_sdk tabulate
|
||||
python scripts/log_reports.py >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Check for test failures
|
||||
if: |
|
||||
steps.common_tests.outcome == 'failure' ||
|
||||
steps.examples.outcome == 'failure' ||
|
||||
steps.core_tests.outcome == 'failure' ||
|
||||
steps.training.outcome == 'failure'
|
||||
run: |
|
||||
echo "One or more test suites failed. Check the logs above."
|
||||
exit 1
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Stale Bot
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 15 * * *"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
close_stale_issues:
|
||||
name: Close Stale Issues
|
||||
if: github.repository == 'huggingface/peft'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: 3.11
|
||||
|
||||
- name: Install requirements
|
||||
run: |
|
||||
pip install PyGithub
|
||||
- name: Close stale issues
|
||||
run: |
|
||||
python scripts/stale.py
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Test Docker images (on PR)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
# Run only when DockerFile files are modified
|
||||
- "docker/*/Dockerfile"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
get_changed_files:
|
||||
name: "Build all modified docker images"
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
|
||||
with:
|
||||
files: docker/*/Dockerfile
|
||||
json: "true"
|
||||
- name: Run step if only the files listed above change
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
id: set-matrix
|
||||
env:
|
||||
CHANGED_FILES: "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
run: |
|
||||
echo "matrix=$(echo ${CHANGED_FILES} | sed -e 's/\\\"/\"/g')" >> $GITHUB_OUTPUT
|
||||
build_modified_files:
|
||||
needs: get_changed_files
|
||||
name: Build Docker images on modified files
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.get_changed_files.outputs.matrix != '[]' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
docker-file: ${{ fromJson(needs.get_changed_files.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Cleanup disk
|
||||
run: |
|
||||
sudo ls -l /usr/local/lib/
|
||||
sudo ls -l /usr/share/
|
||||
sudo du -sh /usr/local/lib/
|
||||
sudo du -sh /usr/share/
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo du -sh /usr/local/lib/
|
||||
sudo du -sh /usr/share/
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||
- name: Check out code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||
with:
|
||||
file: ${{ matrix.docker-file }}
|
||||
context: .
|
||||
push: False
|
||||
@@ -0,0 +1,89 @@
|
||||
name: tests on transformers main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
|
||||
environment: branch-protection-main
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Make space for cache + models
|
||||
# Ubuntu runner have less space free which is problematic since the model
|
||||
# cache + dependencies fill up the disk, leaving no space for execution.
|
||||
# So we remove some of the stuff we don't need (Java, .NET, etc.)
|
||||
#
|
||||
# Idea: https://dev.to/mathio/squeezing-disk-space-from-github-actions-runners-an-engineers-guide-3pjg
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
df -h
|
||||
|
||||
# Remove Java (JDKs)
|
||||
sudo rm -rf /usr/lib/jvm
|
||||
|
||||
# Remove .NET SDKs
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
|
||||
# Remove Swift toolchain
|
||||
sudo rm -rf /usr/share/swift
|
||||
|
||||
# Remove Haskell (GHC)
|
||||
sudo rm -rf /usr/local/.ghcup
|
||||
|
||||
# Remove Julia
|
||||
sudo rm -rf /usr/local/julia*
|
||||
|
||||
# Remove Android SDKs
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
|
||||
# Remove Chromium (optional if not using for browser tests)
|
||||
sudo rm -rf /usr/local/share/chromium
|
||||
|
||||
# Remove Microsoft/Edge and Google Chrome builds
|
||||
sudo rm -rf /opt/microsoft /opt/google
|
||||
|
||||
# Remove Azure CLI
|
||||
sudo rm -rf /opt/az
|
||||
|
||||
# Remove PowerShell
|
||||
sudo rm -rf /usr/local/share/powershell
|
||||
|
||||
# Remove CodeQL and other toolcaches
|
||||
sudo rm -rf /opt/hostedtoolcache
|
||||
|
||||
df -h
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: 3.11
|
||||
cache: "pip"
|
||||
cache-dependency-path: "setup.py"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
# cpu version of pytorch
|
||||
pip install -U git+https://github.com/huggingface/transformers.git
|
||||
pip install -e .[test]
|
||||
- name: Test with pytest
|
||||
env:
|
||||
TRANSFORMERS_IS_CI: 1
|
||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||
run: |
|
||||
make test
|
||||
- name: Post to Slack
|
||||
if: always()
|
||||
uses: huggingface/hf-workflows/.github/actions/post-slack@3f88d63d3761558a32e8e46fc2a8536e04bb2aea # main from Feb 2025-02-24
|
||||
with:
|
||||
slack_channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
||||
title: 🤗 Results of transformers main tests
|
||||
status: ${{ job.status }}
|
||||
slack_token: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
|
||||
@@ -0,0 +1,168 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'method_comparison/**'
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'method_comparison/**'
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
HF_HOME: .cache/huggingface
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check_code_quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: "pip"
|
||||
cache-dependency-path: "setup.py"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .[dev]
|
||||
- name: Check quality
|
||||
run: |
|
||||
make quality
|
||||
|
||||
tests:
|
||||
needs: check_code_quality
|
||||
# dependabot updates (which don't require approval for CI to run) shouldn't trigger unit tests
|
||||
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
os: ["ubuntu-latest", "windows-latest"]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Make space for cache + models
|
||||
# Ubuntu runner have less space free which is problematic since the model
|
||||
# cache + dependencies fill up the disk, leaving no space for execution.
|
||||
# So we remove some of the stuff we don't need (Java, .NET, etc.)
|
||||
#
|
||||
# Idea: https://dev.to/mathio/squeezing-disk-space-from-github-actions-runners-an-engineers-guide-3pjg
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
df -h
|
||||
|
||||
# Remove Java (JDKs)
|
||||
sudo rm -rf /usr/lib/jvm
|
||||
|
||||
# Remove .NET SDKs
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
|
||||
# Remove Swift toolchain
|
||||
sudo rm -rf /usr/share/swift
|
||||
|
||||
# Remove Haskell (GHC)
|
||||
sudo rm -rf /usr/local/.ghcup
|
||||
|
||||
# Remove Julia
|
||||
sudo rm -rf /usr/local/julia*
|
||||
|
||||
# Remove Android SDKs
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
|
||||
# Remove Chromium (optional if not using for browser tests)
|
||||
sudo rm -rf /usr/local/share/chromium
|
||||
|
||||
# Remove Microsoft/Edge and Google Chrome builds
|
||||
sudo rm -rf /opt/microsoft /opt/google
|
||||
|
||||
# Remove Azure CLI
|
||||
sudo rm -rf /opt/az
|
||||
|
||||
# Remove PowerShell
|
||||
sudo rm -rf /usr/local/share/powershell
|
||||
|
||||
# Remove CodeQL and other toolcaches
|
||||
sudo rm -rf /opt/hostedtoolcache
|
||||
|
||||
df -h
|
||||
- name: Model cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
# Avoid caching HF_HOME/modules and Python cache files to prevent interoperability
|
||||
# issues and potential cache poisioning. We also avoid lock files to prevent runs
|
||||
# avoiding re-download because they see a lock file.
|
||||
path: |
|
||||
${{ env.HF_HOME }}/hub/**
|
||||
!${{ env.HF_HOME }}/**/*.pyc
|
||||
key: model-cache-${{ github.run_id }}
|
||||
restore-keys: model-cache-
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Dump cache content
|
||||
# TODO: remove this step after 2025-02-15
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
SHASUM=sha256sum
|
||||
[ -f "$(which shasum)" ] && SHASUM=shasum
|
||||
find "${{ env.HF_HOME }}/hub" -type f -exec "$SHASUM" {} \; > cache_content_initial || true
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: "pip"
|
||||
cache-dependency-path: "setup.py"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools
|
||||
# cpu version of pytorch
|
||||
pip install -e .[test]
|
||||
- name: Test with pytest
|
||||
shell: bash
|
||||
env:
|
||||
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||
TRANSFORMERS_IS_CI: 1
|
||||
CI: 1
|
||||
run: |
|
||||
make test
|
||||
# clean up all pytest temporary directories that are kept due to retention since space
|
||||
# is a scarce resource on the runners and tasks like model cache creation (further below)
|
||||
# fail if there's not enough space available.
|
||||
(rm -r "/tmp/pytest-of-$(id -u -n)" || true)
|
||||
- name: Dump cache content and diff
|
||||
# This is just debug info so that we can monitor if the model cache diverges substantially
|
||||
# over time and what the diverging model is.
|
||||
# TODO: remove after 2025-02-15
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
SHASUM=sha256sum
|
||||
[ -f "$(which shasum)" ] && SHASUM=shasum
|
||||
find "${{ env.HF_HOME }}/hub" -type f -exec "$SHASUM" {} \; > cache_content_after || true
|
||||
diff -udp cache_content_initial cache_content_after || true
|
||||
- name: Delete old model cache entries
|
||||
run: |
|
||||
# make sure that cache cleaning doesn't break the pipeline
|
||||
python scripts/ci_clean_cache.py -d || true
|
||||
- name: Update model cache
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
# Only let one runner (preferably the one that covers most tests) update the model cache
|
||||
# after *every* run. This way we make sure that our cache is never outdated and we don't
|
||||
# have to keep track of hashes.
|
||||
if: always() && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
|
||||
with:
|
||||
path: |
|
||||
${{ env.HF_HOME }}/hub/**
|
||||
!${{ env.HF_HOME }}/**/*.pyc
|
||||
key: model-cache-${{ github.run_id }}
|
||||
@@ -0,0 +1,56 @@
|
||||
name: torch compile tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to test on'
|
||||
required: true
|
||||
pytorch_nightly:
|
||||
description: 'Whether to use PyTorch nightly (true/false)'
|
||||
required: false
|
||||
default: false
|
||||
|
||||
env:
|
||||
RUN_SLOW: "yes"
|
||||
IS_GITHUB_CI: "1"
|
||||
# To be able to run tests on CUDA 12.2
|
||||
NVIDIA_DISABLE_REQUIRE: "1"
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
run_tests_with_compile:
|
||||
runs-on:
|
||||
group: aws-g6-4xlarge-plus
|
||||
env:
|
||||
PEFT_DEBUG_WITH_TORCH_COMPILE: 1
|
||||
CUDA_VISIBLE_DEVICES: "0"
|
||||
TEST_TYPE: "single_gpu_huggingface/peft-gpu:latest"
|
||||
USE_PYTORCH_NIGHTLY: "${{ github.event.inputs.pytorch_nightly }}"
|
||||
container:
|
||||
image: "huggingface/peft-gpu:latest"
|
||||
options: --gpus all --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
persist-credentials: false
|
||||
- name: Pip install
|
||||
run: |
|
||||
source activate peft
|
||||
pip install -e . --no-deps
|
||||
pip install pytest-cov pytest-reportlog parameterized datasets scipy einops
|
||||
pip install "pytest>=7.2.0,<8.0.0" # see: https://github.com/huggingface/transformers/blob/ce4fff0be7f6464d713f7ac3e0bbaafbc6959ae5/setup.py#L148C6-L148C26
|
||||
if [ "${USE_PYTORCH_NIGHTLY}" = "true" ]; then
|
||||
python -m pip install --upgrade --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
fi
|
||||
- name: Test compile with pytest
|
||||
run: |
|
||||
source activate peft
|
||||
echo "PEFT_DEBUG_WITH_TORCH_COMPILE=$PEFT_DEBUG_WITH_TORCH_COMPILE"
|
||||
make tests_torch_compile
|
||||
@@ -0,0 +1,18 @@
|
||||
on:
|
||||
push:
|
||||
|
||||
name: Secret Leaks
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
trufflehog:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Secret Scanning
|
||||
uses: trufflesecurity/trufflehog@37b77001d0174ebec2fcca2bd83ff83a6d45a3ab # v3.95.3
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Upload PR Documentation
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build PR Documentation"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@b0f9a6e3b6aa912656cbda9f74896eb721d29421 # main
|
||||
with:
|
||||
package_name: peft
|
||||
secrets:
|
||||
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
|
||||
comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
|
||||
@@ -0,0 +1,28 @@
|
||||
name: CI security linting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["*"]
|
||||
paths:
|
||||
- '.github/**'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
zizmor:
|
||||
name: zizmor latest via Cargo
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install zizmor
|
||||
run: cargo install --locked zizmor
|
||||
- name: Run zizmor
|
||||
run: zizmor .github/workflows
|
||||
Reference in New Issue
Block a user