Skip to content

Commit 33b6fd8

Browse files
committed
update
1 parent 9953398 commit 33b6fd8

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

.ci/benchmark.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
from src.benchmark.utils import read_metrics, to_html_table
3+
4+
if __name__ == "__main__":
5+
# Generate statistics report
6+
metrics = read_metrics(sys.argv[1], metric="accuracy")
7+
html_table = to_html_table(metrics)
8+
print(html_table)

.ci/benchmark.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/_ascend_npu_benchmark.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,10 @@ jobs:
7070
run: |
7171
pip install ${{ inputs.artifact_name }}
7272
73-
- name: Checkout
73+
- name: Checkout benchmark
7474
uses: actions/checkout@v4
7575
with:
76-
# TODO(shink): Use pytorch/benchmark once following PRs merged:
77-
# https://github.com/pytorch/benchmark/pull/2545
78-
# https://github.com/pytorch/benchmark/pull/2546
79-
# repository: pytorch/benchmark
80-
repository: shink/benchmark
81-
ref: test
76+
repository: pytorch/benchmark
8277
path: benchmark
8378

8479
- name: Install benchmark dependencies
@@ -99,12 +94,20 @@ jobs:
9994
uses: actions/upload-artifact@v4
10095
with:
10196
name: ascend_npu_benchmark.json
102-
path: ascend_npu_benchmark.json
97+
path: benchmark/ascend_npu_benchmark.json
10398
if-no-files-found: error
10499
retention-days: 1
105100
overwrite: true
106101

102+
- name: Generate statistics report
103+
id: report
104+
run: |
105+
output_path=$(realpath benchmark/ascend_npu_benchmark.json)
106+
table=$(python .ci/benchmark.py)
107+
echo "table=${table}" >> $GITHUB_OUTPUT
108+
107109
- name: Write to workflow job summary
110+
if: ${{ steps.report.outputs.table }}
108111
run: |
109112
echo "## Torchbenchmark statistics report" >> $GITHUB_STEP_SUMMARY
110-
echo "TODO" >> $GITHUB_STEP_SUMMARY
113+
echo "${{ steps.report.outputs.table }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/_ascend_npu_test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ jobs:
6767
# repository: Ascend/pytorch
6868
repository: shink/torchnpu
6969
ref: feat/autoload
70-
submodules: recursive
7170
path: torch_npu
7271

7372
- name: Download distribution artifact

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ across various devices by running comprehensive GitHub workflows.
77

88
## Accelerator Integration Test Results
99

10+
<!-- Start -->
11+
1012
| [torch_npu][1] |
1113
|----------------------------------|
1214
| [![Ascend NPU Test Suite][2]][3] |
@@ -17,6 +19,8 @@ across various devices by running comprehensive GitHub workflows.
1719

1820
[3]: https://github.com/cosdt/pytorch-integration-tests/actions/workflows/ascend_npu_test.yml
1921

22+
<!-- End -->
23+
2024
## Overview
2125

2226
This repository contains workflows and scripts that automate the testing

src/benchmark/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ def read_metrics(path: str, *, metric=None) -> List[TorchBenchModelMetric]:
7272
return metrics
7373

7474

75-
def filter_result(metrics: List[TorchBenchModelMetric], *, model, device):
76-
for metric in metrics:
77-
if metric.key.name == model and metric.key.device == device:
78-
return metric
79-
80-
8175
def generate_table(data):
8276
template = Template("""
8377
<table border="1">
@@ -96,6 +90,12 @@ def generate_table(data):
9690
def to_html_table(metrics: List[TorchBenchModelMetric]):
9791
models = list({metric.key.name for metric in metrics})
9892
devices = list({metric.key.device for metric in metrics})
93+
94+
def filter_result(metrics: List[TorchBenchModelMetric], *, model, device):
95+
for metric in metrics:
96+
if metric.key.name == model and metric.key.device == device:
97+
return metric
98+
9999
rows = []
100100
for model in models:
101101
row = [model]

0 commit comments

Comments
 (0)