Skip to content

Commit 7ecc809

Browse files
committed
update
1 parent cc90b27 commit 7ecc809

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

.github/workflows/_ascend_npu_benchmark.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defaults:
2929

3030
jobs:
3131
test:
32-
name: test torch_npu in ${{ inputs.image }} with ${{ inputs.device }}
32+
name: run benchmarks for torch_npu
3333
runs-on: ${{ inputs.runner }}
3434
container:
3535
image: ${{ inputs.image }}
@@ -92,6 +92,10 @@ jobs:
9292
pip install -r benchmark/requirements.txt --constraint ascend_npu/requirements.txt "numpy==1.*"
9393
python benchmark/install.py --userbenchmark test_bench --models BERT_pytorch hf_GPT2
9494
95+
- name: Install project dependencies
96+
run: |
97+
pip install -r requirements.txt
98+
9599
- name: Show environment info
96100
run: |
97101
npu_is_available=$(python -c "import torch; print(torch.npu.is_available())")
@@ -128,8 +132,8 @@ jobs:
128132
output_path=$(realpath benchmark/ascend_npu_benchmark.json)
129133
python .ci/benchmark.py ${output_path}
130134
131-
- name: Modify README.md
132-
if: ${{ always() }}
135+
- name: Update README.md
136+
if: ${{ github.event_name == 'push' }}
133137
run: |
134138
echo "${{ github.event_name }}"
135139
echo "${{ github.event_name == 'push' }}"

.github/workflows/_ascend_npu_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defaults:
2929

3030
jobs:
3131
test:
32-
name: test torch_npu in ${{ inputs.image }} with ${{ inputs.device }}
32+
name: test torch_npu
3333
runs-on: ${{ inputs.runner }}
3434
container:
3535
image: ${{ inputs.image }}

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
unittest
2-
jinja2
2+
tabulate

src/benchmark/utils.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import dataclasses
33
import json
44
import pathlib
5-
from jinja2 import Template
65
from typing import Dict, List, Optional
76

87

@@ -75,21 +74,6 @@ def read_metrics(path: str, *, metric=None) -> List[TorchBenchModelMetric]:
7574
return metrics
7675

7776

78-
def generate_table(data):
79-
template = Template("""
80-
<table border="1">
81-
{% for row in data %}
82-
<tr>
83-
{% for cell in row %}
84-
<td>{{ cell }}</td>
85-
{% endfor %}
86-
</tr>
87-
{% endfor %}
88-
</table>
89-
""")
90-
return template.render(data=data)
91-
92-
9377
def to_html_table(metrics: List[TorchBenchModelMetric]):
9478
models = list({metric.key.name for metric in metrics})
9579
devices = list({metric.key.device for metric in metrics})
@@ -112,7 +96,8 @@ def filter_result(metrics: List[TorchBenchModelMetric], *, model, device):
11296
row.append(cell)
11397
rows.append(row)
11498

115-
header = [""] + devices
116-
data = [header, *rows]
117-
html_table = generate_table(data)
118-
return html_table
99+
from tabulate import tabulate
100+
101+
headers = [""] + devices
102+
markdown_table = tabulate(rows, headers=headers, tablefmt="github")
103+
return markdown_table

0 commit comments

Comments
 (0)