Skip to content

Commit ad3e877

Browse files
authored
Merge branch 'huggingface:main' into add_autoencoder_vidtok
2 parents 3506971 + 76af013 commit ad3e877

File tree

1,670 files changed

+207081
-36122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,670 files changed

+207081
-36122
lines changed

.github/workflows/benchmark.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,75 @@ on:
77

88
env:
99
DIFFUSERS_IS_CI: yes
10-
HF_HUB_ENABLE_HF_TRANSFER: 1
10+
HF_XET_HIGH_PERFORMANCE: 1
1111
HF_HOME: /mnt/cache
1212
OMP_NUM_THREADS: 8
1313
MKL_NUM_THREADS: 8
14+
BASE_PATH: benchmark_outputs
1415

1516
jobs:
16-
torch_pipelines_cuda_benchmark_tests:
17+
torch_models_cuda_benchmark_tests:
1718
env:
1819
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_BENCHMARK }}
19-
name: Torch Core Pipelines CUDA Benchmarking Tests
20+
name: Torch Core Models CUDA Benchmarking Tests
2021
strategy:
2122
fail-fast: false
2223
max-parallel: 1
2324
runs-on:
24-
group: aws-g6-4xlarge-plus
25+
group: aws-g6e-4xlarge
2526
container:
2627
image: diffusers/diffusers-pytorch-cuda
27-
options: --shm-size "16gb" --ipc host --gpus 0
28+
options: --shm-size "16gb" --ipc host --gpus all
2829
steps:
2930
- name: Checkout diffusers
30-
uses: actions/checkout@v3
31+
uses: actions/checkout@v6
3132
with:
3233
fetch-depth: 2
3334
- name: NVIDIA-SMI
3435
run: |
3536
nvidia-smi
3637
- name: Install dependencies
3738
run: |
38-
python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH"
39-
python -m uv pip install -e [quality,test]
40-
python -m uv pip install pandas peft
41-
python -m uv pip uninstall transformers && python -m uv pip install transformers==4.48.0
39+
apt update
40+
apt install -y libpq-dev postgresql-client
41+
uv pip install -e ".[quality]"
42+
uv pip install -r benchmarks/requirements.txt
4243
- name: Environment
4344
run: |
4445
python utils/print_env.py
4546
- name: Diffusers Benchmarking
4647
env:
47-
HF_TOKEN: ${{ secrets.DIFFUSERS_BOT_TOKEN }}
48-
BASE_PATH: benchmark_outputs
48+
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
4949
run: |
50-
export TOTAL_GPU_MEMORY=$(python -c "import torch; print(torch.cuda.get_device_properties(0).total_memory / (1024**3))")
51-
cd benchmarks && mkdir ${BASE_PATH} && python run_all.py && python push_results.py
50+
cd benchmarks && python run_all.py
51+
52+
- name: Push results to the Hub
53+
env:
54+
HF_TOKEN: ${{ secrets.DIFFUSERS_BOT_TOKEN }}
55+
run: |
56+
cd benchmarks && python push_results.py
57+
mkdir $BASE_PATH && cp *.csv $BASE_PATH
5258
5359
- name: Test suite reports artifacts
5460
if: ${{ always() }}
55-
uses: actions/upload-artifact@v4
61+
uses: actions/upload-artifact@v6
5662
with:
5763
name: benchmark_test_reports
58-
path: benchmarks/benchmark_outputs
64+
path: benchmarks/${{ env.BASE_PATH }}
65+
66+
# TODO: enable this once the connection problem has been resolved.
67+
- name: Update benchmarking results to DB
68+
env:
69+
PGDATABASE: metrics
70+
PGHOST: ${{ secrets.DIFFUSERS_BENCHMARKS_PGHOST }}
71+
PGUSER: transformers_benchmarks
72+
PGPASSWORD: ${{ secrets.DIFFUSERS_BENCHMARKS_PGPASSWORD }}
73+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
74+
run: |
75+
git config --global --add safe.directory /__w/diffusers/diffusers
76+
commit_id=$GITHUB_SHA
77+
commit_msg=$(git show -s --format=%s "$commit_id" | cut -c1-70)
78+
cd benchmarks && python populate_into_db.py "$BRANCH_NAME" "$commit_id" "$commit_msg"
5979
6080
- name: Report success status
6181
if: ${{ success() }}

.github/workflows/build_docker_images.yml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
if: github.event_name == 'pull_request'
2626
steps:
2727
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v1
28+
uses: docker/setup-buildx-action@v3
2929

3030
- name: Check out code
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v6
3232

3333
- name: Find Changed Dockerfiles
3434
id: file_changes
@@ -42,18 +42,39 @@ jobs:
4242
CHANGED_FILES: ${{ steps.file_changes.outputs.all }}
4343
run: |
4444
echo "$CHANGED_FILES"
45-
for FILE in $CHANGED_FILES; do
45+
ALLOWED_IMAGES=(
46+
diffusers-pytorch-cpu
47+
diffusers-pytorch-cuda
48+
diffusers-pytorch-xformers-cuda
49+
diffusers-pytorch-minimum-cuda
50+
diffusers-doc-builder
51+
)
52+
53+
declare -A IMAGES_TO_BUILD=()
54+
55+
for FILE in $CHANGED_FILES; do
4656
# skip anything that isn't still on disk
47-
if [[ ! -f "$FILE" ]]; then
57+
if [[ ! -e "$FILE" ]]; then
4858
echo "Skipping removed file $FILE"
4959
continue
50-
fi
51-
if [[ "$FILE" == docker/*Dockerfile ]]; then
52-
DOCKER_PATH="${FILE%/Dockerfile}"
53-
DOCKER_TAG=$(basename "$DOCKER_PATH")
54-
echo "Building Docker image for $DOCKER_TAG"
55-
docker build -t "$DOCKER_TAG" "$DOCKER_PATH"
5660
fi
61+
62+
for IMAGE in "${ALLOWED_IMAGES[@]}"; do
63+
if [[ "$FILE" == docker/${IMAGE}/* ]]; then
64+
IMAGES_TO_BUILD["$IMAGE"]=1
65+
fi
66+
done
67+
done
68+
69+
if [[ ${#IMAGES_TO_BUILD[@]} -eq 0 ]]; then
70+
echo "No relevant Docker changes detected."
71+
exit 0
72+
fi
73+
74+
for IMAGE in "${!IMAGES_TO_BUILD[@]}"; do
75+
DOCKER_PATH="docker/${IMAGE}"
76+
echo "Building Docker image for $IMAGE"
77+
docker build -t "$IMAGE" "$DOCKER_PATH"
5778
done
5879
if: steps.file_changes.outputs.all != ''
5980

@@ -72,23 +93,22 @@ jobs:
7293
image-name:
7394
- diffusers-pytorch-cpu
7495
- diffusers-pytorch-cuda
75-
- diffusers-pytorch-cuda
7696
- diffusers-pytorch-xformers-cuda
7797
- diffusers-pytorch-minimum-cuda
7898
- diffusers-doc-builder
7999

80100
steps:
81101
- name: Checkout repository
82-
uses: actions/checkout@v3
102+
uses: actions/checkout@v6
83103
- name: Set up Docker Buildx
84-
uses: docker/setup-buildx-action@v1
104+
uses: docker/setup-buildx-action@v3
85105
- name: Login to Docker Hub
86-
uses: docker/login-action@v2
106+
uses: docker/login-action@v3
87107
with:
88108
username: ${{ env.REGISTRY }}
89109
password: ${{ secrets.DOCKERHUB_TOKEN }}
90110
- name: Build and push
91-
uses: docker/build-push-action@v3
111+
uses: docker/build-push-action@v6
92112
with:
93113
no-cache: true
94114
context: ./docker/${{ matrix.image-name }}

.github/workflows/build_pr_documentation.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,33 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
check-links:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v6
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: '3.10'
26+
27+
- name: Install uv
28+
run: |
29+
curl -LsSf https://astral.sh/uv/install.sh | sh
30+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
31+
32+
- name: Install doc-builder
33+
run: |
34+
uv pip install --system git+https://github.com/huggingface/doc-builder.git@main
35+
36+
- name: Check documentation links
37+
run: |
38+
uv run doc-builder check-links docs/source/en
39+
1540
build:
41+
needs: check-links
1642
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
1743
with:
1844
commit_sha: ${{ github.event.pull_request.head.sha }}

.github/workflows/codeql.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: CodeQL Security Analysis For Github Actions
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
workflow_dispatch:
8+
# pull_request:
9+
10+
jobs:
11+
codeql:
12+
name: CodeQL Analysis
13+
uses: huggingface/security-workflows/.github/workflows/codeql-reusable.yml@v1
14+
permissions:
15+
security-events: write
16+
packages: read
17+
actions: read
18+
contents: read
19+
with:
20+
languages: '["actions","python"]'
21+
queries: 'security-extended,security-and-quality'
22+
runner: 'ubuntu-latest' #optional if need custom runner

.github/workflows/mirror_community_pipeline.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
mirror_community_pipeline:
2525
env:
2626
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_COMMUNITY_MIRROR }}
27-
2827
runs-on: ubuntu-22.04
2928
steps:
3029
# Checkout to correct ref
@@ -39,54 +38,58 @@ jobs:
3938
# If ref is 'refs/heads/main' => set 'main'
4039
# Else it must be a tag => set {tag}
4140
- name: Set checkout_ref and path_in_repo
41+
env:
42+
EVENT_NAME: ${{ github.event_name }}
43+
EVENT_INPUT_REF: ${{ github.event.inputs.ref }}
44+
GITHUB_REF: ${{ github.ref }}
4245
run: |
43-
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
44-
if [ -z "${{ github.event.inputs.ref }}" ]; then
46+
if [ "$EVENT_NAME" == "workflow_dispatch" ]; then
47+
if [ -z "$EVENT_INPUT_REF" ]; then
4548
echo "Error: Missing ref input"
4649
exit 1
47-
elif [ "${{ github.event.inputs.ref }}" == "main" ]; then
50+
elif [ "$EVENT_INPUT_REF" == "main" ]; then
4851
echo "CHECKOUT_REF=refs/heads/main" >> $GITHUB_ENV
4952
echo "PATH_IN_REPO=main" >> $GITHUB_ENV
5053
else
51-
echo "CHECKOUT_REF=refs/tags/${{ github.event.inputs.ref }}" >> $GITHUB_ENV
52-
echo "PATH_IN_REPO=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
54+
echo "CHECKOUT_REF=refs/tags/$EVENT_INPUT_REF" >> $GITHUB_ENV
55+
echo "PATH_IN_REPO=$EVENT_INPUT_REF" >> $GITHUB_ENV
5356
fi
54-
elif [ "${{ github.ref }}" == "refs/heads/main" ]; then
55-
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
57+
elif [ "$GITHUB_REF" == "refs/heads/main" ]; then
58+
echo "CHECKOUT_REF=$GITHUB_REF" >> $GITHUB_ENV
5659
echo "PATH_IN_REPO=main" >> $GITHUB_ENV
5760
else
5861
# e.g. refs/tags/v0.28.1 -> v0.28.1
59-
echo "CHECKOUT_REF=${{ github.ref }}" >> $GITHUB_ENV
60-
echo "PATH_IN_REPO=$(echo ${{ github.ref }} | sed 's/^refs\/tags\///')" >> $GITHUB_ENV
62+
echo "CHECKOUT_REF=$GITHUB_REF" >> $GITHUB_ENV
63+
echo "PATH_IN_REPO=$(echo $GITHUB_REF | sed 's/^refs\/tags\///')" >> $GITHUB_ENV
6164
fi
6265
- name: Print env vars
6366
run: |
6467
echo "CHECKOUT_REF: ${{ env.CHECKOUT_REF }}"
6568
echo "PATH_IN_REPO: ${{ env.PATH_IN_REPO }}"
66-
- uses: actions/checkout@v3
69+
- uses: actions/checkout@v6
6770
with:
6871
ref: ${{ env.CHECKOUT_REF }}
6972

7073
# Setup + install dependencies
7174
- name: Set up Python
72-
uses: actions/setup-python@v4
75+
uses: actions/setup-python@v6
7376
with:
7477
python-version: "3.10"
7578
- name: Install dependencies
7679
run: |
77-
python -m pip install --upgrade pip
80+
pip install --upgrade pip
7881
pip install --upgrade huggingface_hub
7982
8083
# Check secret is set
8184
- name: whoami
82-
run: huggingface-cli whoami
85+
run: hf auth whoami
8386
env:
8487
HF_TOKEN: ${{ secrets.HF_TOKEN_MIRROR_COMMUNITY_PIPELINES }}
8588

8689
# Push to HF! (under subfolder based on checkout ref)
8790
# https://huggingface.co/datasets/diffusers/community-pipelines-mirror
8891
- name: Mirror community pipeline to HF
89-
run: huggingface-cli upload diffusers/community-pipelines-mirror ./examples/community ${PATH_IN_REPO} --repo-type dataset
92+
run: hf upload diffusers/community-pipelines-mirror ./examples/community ${PATH_IN_REPO} --repo-type dataset
9093
env:
9194
PATH_IN_REPO: ${{ env.PATH_IN_REPO }}
9295
HF_TOKEN: ${{ secrets.HF_TOKEN_MIRROR_COMMUNITY_PIPELINES }}
@@ -99,4 +102,4 @@ jobs:
99102
- name: Report failure status
100103
if: ${{ failure() }}
101104
run: |
102-
pip install requests && python utils/notify_community_pipelines_mirror.py --status=failure
105+
pip install requests && python utils/notify_community_pipelines_mirror.py --status=failure

0 commit comments

Comments
 (0)