-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for eager mode performance (#1539)
* Add support for eager mode performance Summary: Added "compile" filed to "extra_info" that allows us to record eager mode performance as well context is eager, eager + compile, eager + compile + autoquant can all have performance improvements/changes over time, so we want to track: (1) eager perf on some previous date (configurable by user) (2) current eager perf (3) current compile perf (4) current autoqunat + compile perf Test Plan: tested locally: https://gist.github.com/jerryzh168/2a15322b0c8f40f35e52956837c67fec Reviewers: Subscribers: Tasks: Tags: * move min_sqnr * format * remove redundant headers * add upload_to_s3 script * format
- Loading branch information
1 parent
24a78fe
commit 6d6aa01
Showing
5 changed files
with
116 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import io | ||
import json | ||
import os | ||
from functools import lru_cache | ||
from typing import Any | ||
|
||
import boto3 | ||
|
||
|
||
@lru_cache | ||
def get_s3_resource() -> Any: | ||
return boto3.resource("s3") | ||
|
||
|
||
def upload_to_s3( | ||
bucket_name: str, | ||
key: str, | ||
json_path: str, | ||
) -> None: | ||
print(f"Writing {json_path} documents to S3") | ||
data = [] | ||
with open(f"{os.path.splitext(json_path)[0]}.json", "r") as f: | ||
for l in f.readlines(): | ||
data.append(json.loads(l)) | ||
|
||
body = io.StringIO() | ||
for benchmark_entry in data: | ||
json.dump(benchmark_entry, body) | ||
body.write("\n") | ||
|
||
try: | ||
get_s3_resource().Object( | ||
f"{bucket_name}", | ||
f"{key}", | ||
).put( | ||
Body=body.getvalue(), | ||
ContentType="application/json", | ||
) | ||
except Exception as e: | ||
print("fail to upload to s3:", e) | ||
return | ||
print("Done!") | ||
|
||
|
||
if __name__ == "__main__": | ||
import argparse | ||
import datetime | ||
|
||
parser = argparse.ArgumentParser( | ||
description="Upload benchmark result json file to clickhouse" | ||
) | ||
parser.add_argument( | ||
"--json-path", | ||
type=str, | ||
help="json file path to upload to click house", | ||
required=True, | ||
) | ||
args = parser.parse_args() | ||
today = datetime.date.today() | ||
today = datetime.datetime.combine(today, datetime.time.min) | ||
today_timestamp = str(int(today.timestamp())) | ||
print("Today timestamp:", today_timestamp) | ||
import subprocess | ||
|
||
# Execute the command and capture the output | ||
output = subprocess.check_output(["hostname", "-s"]) | ||
# Decode the output from bytes to string | ||
hostname = output.decode("utf-8").strip() | ||
upload_to_s3( | ||
"ossci-benchmarks", | ||
f"v3/pytorch/ao/{hostname}/torchao-models-" + today_timestamp + ".json", | ||
args.json_path, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters