From 01584c786e75852d66b1d7880c23d5336a556c43 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Tue, 28 Nov 2023 10:03:17 +0530 Subject: [PATCH] add utility to push to hf dataset --- benchmarks/push_results.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 benchmarks/push_results.py diff --git a/benchmarks/push_results.py b/benchmarks/push_results.py new file mode 100644 index 000000000000..98af01fb1fe8 --- /dev/null +++ b/benchmarks/push_results.py @@ -0,0 +1,26 @@ +import glob +import os +import sys + +from huggingface_hub import upload_file + + +sys.path.append(".") +from benchmark_utils import BASE_PATH, collate_csv # noqa: E402 + + +FINAL_CSV_FILE = "collated_results.csv" +REPO_ID = "diffusers/benchmarks" +GITHUB_SHA = os.getenv("GITHUB_SHA", None) + + +def push_to_hf_dataset(): + all_csvs = sorted(glob.glob(f"{BASE_PATH}/*.csv")) + collate_csv(all_csvs, FINAL_CSV_FILE) + + commit_message = f"upload from sha: {GITHUB_SHA}" if GITHUB_SHA is not None else "upload benchmark results" + upload_file(repo_id=REPO_ID, path_or_fileobj=FINAL_CSV_FILE, repo_type="dataset", commit_message=commit_message) + + +if __name__ == "__main__": + push_to_hf_dataset()