Skip to content

Commit 7db8c3e

Browse files
authored
Benchmarking workflow fix (#8389)
* fix * fixes * add back the deadsnakes * better messaging * disable IP adapter tests for the moment. * style * up * empty
1 parent 9b7acc7 commit 7db8c3e

File tree

4 files changed

+84
-9
lines changed

4 files changed

+84
-9
lines changed

.github/workflows/benchmark.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ env:
1313

1414
jobs:
1515
torch_pipelines_cuda_benchmark_tests:
16+
env:
17+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_BENCHMARK }}
1618
name: Torch Core Pipelines CUDA Benchmarking Tests
1719
strategy:
1820
fail-fast: false
1921
max-parallel: 1
2022
runs-on: [single-gpu, nvidia-gpu, a10, ci]
2123
container:
22-
image: diffusers/diffusers-pytorch-cuda
23-
options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/ --gpus 0
24+
image: diffusers/diffusers-pytorch-compile-cuda
25+
options: --shm-size "16gb" --ipc host -v /mnt/cache/.cache/huggingface/diffusers:/mnt/cache/ --gpus 0
2426
steps:
2527
- name: Checkout diffusers
2628
uses: actions/checkout@v3
@@ -50,4 +52,14 @@ jobs:
5052
uses: actions/upload-artifact@v2
5153
with:
5254
name: benchmark_test_reports
53-
path: benchmarks/benchmark_outputs
55+
path: benchmarks/benchmark_outputs
56+
57+
- name: Report success status
58+
if: ${{ success() }}
59+
run: |
60+
pip install requests && python utils/notify_benchmarking_status.py --status=success
61+
62+
- name: Report failure status
63+
if: ${{ failure() }}
64+
run: |
65+
pip install requests && python utils/notify_benchmarking_status.py --status=failure

benchmarks/run_all.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def main():
3939
for file in python_files:
4040
print(f"****** Running file: {file} ******")
4141

42+
if "ip_adapters" in file:
43+
continue
44+
4245
# Run with canonical settings.
4346
if file != "benchmark_text_to_image.py":
4447
command = f"python {file}"
@@ -49,6 +52,9 @@ def main():
4952

5053
# Run variants.
5154
for file in python_files:
55+
if "ip_adapters" in file:
56+
continue
57+
5258
if file == "benchmark_text_to_image.py":
5359
for ckpt in ALL_T2I_CKPTS:
5460
command = f"python {file} --ckpt {ckpt}"

docker/diffusers-pytorch-compile-cuda/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@ RUN apt install -y bash \
1616
ca-certificates \
1717
libsndfile1-dev \
1818
libgl1 \
19-
python3.10 \
19+
python3.9 \
20+
python3.9-dev \
2021
python3-pip \
21-
python3.10-venv && \
22+
python3.9-venv && \
2223
rm -rf /var/lib/apt/lists
2324

2425
# make sure to use venv
25-
RUN python3.10 -m venv /opt/venv
26+
RUN python3.9 -m venv /opt/venv
2627
ENV PATH="/opt/venv/bin:$PATH"
2728

2829
# pre-install the heavy dependencies (these can later be overridden by the deps from setup.py)
29-
RUN python3.10 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
30-
python3.10 -m uv pip install --no-cache-dir \
30+
RUN python3.9 -m pip install --no-cache-dir --upgrade pip uv==0.1.11 && \
31+
python3.9 -m uv pip install --no-cache-dir \
3132
torch \
3233
torchvision \
3334
torchaudio \
3435
invisible_watermark && \
35-
python3.10 -m pip install --no-cache-dir \
36+
python3.9 -m pip install --no-cache-dir \
3637
accelerate \
3738
datasets \
3839
hf-doc-builder \

utils/notify_benchmarking_status.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding=utf-8
2+
# Copyright 2024 The HuggingFace Team. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import argparse
17+
import os
18+
19+
import requests
20+
21+
22+
# Configuration
23+
GITHUB_REPO = "huggingface/diffusers"
24+
GITHUB_RUN_ID = os.getenv("GITHUB_RUN_ID")
25+
SLACK_WEBHOOK_URL = os.getenv("SLACK_WEBHOOK_URL")
26+
27+
28+
def main(args):
29+
action_url = f"https://github.com/{GITHUB_REPO}/actions/runs/{GITHUB_RUN_ID}"
30+
if args.status == "success":
31+
hub_path = "https://huggingface.co/datasets/diffusers/benchmarks/blob/main/collated_results.csv"
32+
message = (
33+
"✅ New benchmark workflow successfully run.\n"
34+
f"🕸️ GitHub Action URL: {action_url}.\n"
35+
f"🤗 Check out the benchmarks here: {hub_path}."
36+
)
37+
else:
38+
message = (
39+
"❌ Something wrong happened in the benchmarking workflow.\n"
40+
f"Check out the GitHub Action to know more: {action_url}."
41+
)
42+
43+
payload = {"text": message}
44+
response = requests.post(SLACK_WEBHOOK_URL, json=payload)
45+
46+
if response.status_code == 200:
47+
print("Notification sent to Slack successfully.")
48+
else:
49+
print("Failed to send notification to Slack.")
50+
51+
52+
if __name__ == "__main__":
53+
parser = argparse.ArgumentParser()
54+
parser.add_argument("--status", type=str, default="success", choices=["success", "failure"])
55+
args = parser.parse_args()
56+
main(args)

0 commit comments

Comments
 (0)