""" The regression detector of TorchBench Userbenchmark. """ import argparse import importlib import json import os import re import time from dataclasses import asdict from datetime import datetime from pathlib import Path from typing import Any, Dict, List, Optional, Tuple import yaml from userbenchmark.utils import ( get_date_from_metrics, get_date_from_metrics_s3_key, get_latest_files_in_s3_from_last_n_days, get_ub_name, PLATFORMS, REPO_PATH, TorchBenchABTestResult, USERBENCHMARK_OUTPUT_PREFIX, ) from utils.s3_utils import S3Client, USERBENCHMARK_S3_BUCKET, USERBENCHMARK_S3_OBJECT GITHUB_ISSUE_TEMPLATE = """ TorchBench CI has detected a performance signal or runtime regression. Control PyTorch commit: {control_commit} Control PyTorch version: {control_version} Treatment PyTorch commit: {treatment_commit} Treatment PyTorch version: {treatment_version} Affected Tests: {test_details} Tests that were no longer run on treatment commit: {control_only_tests} Tests that were newly added on treatment commit: {treatment_only_tests} Runtime regressions found? {runtime_regressions_msg} GitHub workflow that triggered this issue: {github_run_url} cc {owner} """ DEFAULT_GH_ISSUE_OWNER = "@xuzhao9" def get_default_output_path(bm_name: str) -> str: # By default, write result to $REPO_DIR/.userbenchmark//regression-