Skip to content

Commit 7f5d109

Browse files
authored
Merge branch 'main' into requirements_fixed
2 parents 1046576 + c19f824 commit 7f5d109

File tree

9 files changed

+167
-130
lines changed

9 files changed

+167
-130
lines changed

.github/workflows/userbenchmark-a100.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,47 @@ jobs:
2121
TORCHBENCH_USERBENCHMARK_SCRIBE_GRAPHQL_ACCESS_TOKEN: ${{ secrets.TORCHBENCH_USERBENCHMARK_SCRIBE_GRAPHQL_ACCESS_TOKEN }}
2222
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2323
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
24-
SETUP_SCRIPT: "/workspace/setup_instance.sh"
2524
steps:
2625
- name: Checkout TorchBench
2726
uses: actions/checkout@v3
28-
with:
29-
path: benchmark
30-
- name: Clone and setup conda env
27+
- name: Install Conda
3128
run: |
32-
CONDA_ENV=${BASE_CONDA_ENV} . "${SETUP_SCRIPT}"
33-
conda create --name "${CONDA_ENV}" --clone "${BASE_CONDA_ENV}"
29+
bash ./.ci/torchbench/install-conda.sh
3430
- name: Install TorchBench
3531
run: |
36-
set -x
37-
. "${SETUP_SCRIPT}"
38-
pushd benchmark
39-
python install.py
32+
bash ./.ci/torchbench/install.sh
4033
- name: Run user benchmark
4134
run: |
4235
set -x
43-
. "${SETUP_SCRIPT}"
36+
. ${HOME}/miniconda3/etc/profile.d/conda.sh
37+
conda activate "${CONDA_ENV}"
38+
4439
# remove old results
4540
if [ -d benchmark-output ]; then rm -Rf benchmark-output; fi
46-
pushd benchmark
41+
4742
if [ -d .userbenchmark ]; then rm -Rf .userbenchmark; fi
4843
MANUAL_WORKFLOW="${{ github.event.inputs.userbenchmark_name }}"
4944
if [ -z "${MANUAL_WORKFLOW}" ]; then
5045
# Figure out what userbenchmarks we should run, and run it
5146
python ./.github/scripts/userbenchmark/schedule-benchmarks.py --platform ${PLATFORM_NAME}
5247
if [ -d ./.userbenchmark ]; then
53-
cp -r ./.userbenchmark ../benchmark-output
48+
cp -r ./.userbenchmark benchmark-output
5449
else
55-
mkdir ../benchmark-output
50+
mkdir benchmark-output
5651
fi
5752
else
5853
python run_benchmark.py "${{ github.event.inputs.userbenchmark_name }}" ${{ github.event.inputs.userbenchmark_options }}
59-
cp -r ./.userbenchmark/"${{ github.event.inputs.userbenchmark_name }}" ../benchmark-output
54+
cp -r ./.userbenchmark/"${{ github.event.inputs.userbenchmark_name }}" benchmark-output
55+
ls -las benchmark-output
56+
pwd
6057
fi
6158
- name: Upload artifact
6259
uses: actions/upload-artifact@v4
6360
with:
6461
name: TorchBench result
65-
path: benchmark-output/
62+
path: benchmark-output
6663
- name: Upload result jsons to Scribe and S3
6764
run: |
68-
. "${SETUP_SCRIPT}"
69-
pushd benchmark
7065
RESULTS=($(find ${PWD}/../benchmark-output -name "metrics-*.json" -maxdepth 2 | sort -r))
7166
echo "Uploading result jsons: ${RESULTS}"
7267
for r in ${RESULTS[@]}; do
@@ -76,6 +71,5 @@ jobs:
7671
- name: Clean up Conda env
7772
if: always()
7873
run: |
79-
. "${SETUP_SCRIPT}"
80-
conda deactivate && conda deactivate
74+
. ${HOME}/miniconda3/etc/profile.d/conda.sh
8175
conda remove -n "${CONDA_ENV}" --all

userbenchmark/dynamo/dynamobench/_dynamo/testing.py

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,8 @@
88
import sys
99
import types
1010
import unittest
11-
from typing import (
12-
Any,
13-
Callable,
14-
Dict,
15-
List,
16-
Optional,
17-
overload,
18-
Sequence,
19-
TypeVar,
20-
Union,
21-
)
11+
from collections.abc import Sequence
12+
from typing import Any, Callable, Optional, overload, TypeVar, Union
2213
from typing_extensions import ParamSpec
2314
from unittest.mock import patch
2415

@@ -83,7 +74,7 @@ def extract_graph_backend(_gm, *args, **kwargs): # type: ignore[no-untyped-def]
8374

8475
def collect_results(
8576
model: torch.nn.Module, prediction: Any, loss: Any, example_inputs: Any
86-
) -> List[Any]:
77+
) -> list[Any]:
8778
results = []
8879
results.append(prediction)
8980
results.append(loss)
@@ -140,7 +131,7 @@ def reduce_to_scalar_loss(out: torch.Tensor) -> torch.Tensor:
140131

141132
@overload
142133
def reduce_to_scalar_loss(
143-
out: Union[List[Any], tuple[Any, ...], Dict[Any, Any]]
134+
out: Union[list[Any], tuple[Any, ...], dict[Any, Any]]
144135
) -> float:
145136
...
146137

@@ -186,7 +177,7 @@ def debug_insert_nops(
186177
) -> Optional[GuardedCode]:
187178
"""used to debug jump updates"""
188179

189-
def insert_nops(instructions: List[Any], code_options: Any) -> None:
180+
def insert_nops(instructions: list[Any], code_options: Any) -> None:
190181
instructions.insert(0, create_instruction("NOP"))
191182
instructions.insert(0, create_instruction("NOP"))
192183

@@ -222,7 +213,7 @@ def __init__(self) -> None:
222213
self.op_count = 0
223214

224215
def __call__(
225-
self, gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
216+
self, gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
226217
) -> Callable[..., Any]:
227218
self.frame_count += 1
228219
for node in gm.graph.nodes:
@@ -240,10 +231,10 @@ def __init__(self, backend: str) -> None:
240231
self.frame_count = 0
241232
self.op_count = 0
242233
self.backend = backend
243-
self.graphs: List[torch.fx.GraphModule] = []
234+
self.graphs: list[torch.fx.GraphModule] = []
244235

245236
def __call__(
246-
self, gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
237+
self, gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
247238
) -> Callable[..., Any]:
248239
from .backends.registry import lookup_backend
249240

@@ -264,34 +255,34 @@ def clear(self) -> None:
264255
# we can assert on
265256
class EagerAndRecordGraphs:
266257
def __init__(self) -> None:
267-
self.graphs: List[torch.fx.GraphModule] = []
258+
self.graphs: list[torch.fx.GraphModule] = []
268259

269260
def __call__(
270-
self, gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
261+
self, gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
271262
) -> Callable[..., Any]:
272263
self.graphs.append(gm)
273264
return gm.forward
274265

275266

276267
class AotEagerAndRecordGraphs:
277268
def __init__(self) -> None:
278-
self.graphs: List[torch.fx.GraphModule] = []
279-
self.fw_graphs: List[torch.fx.GraphModule] = []
280-
self.bw_graphs: List[torch.fx.GraphModule] = []
269+
self.graphs: list[torch.fx.GraphModule] = []
270+
self.fw_graphs: list[torch.fx.GraphModule] = []
271+
self.bw_graphs: list[torch.fx.GraphModule] = []
281272

282273
def __call__(
283-
self, gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
274+
self, gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
284275
) -> Callable[..., Any]:
285276
self.graphs.append(gm)
286277

287278
def fw_compiler(
288-
gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
279+
gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
289280
) -> Callable[..., Any]:
290281
self.fw_graphs.append(gm)
291282
return gm.forward
292283

293284
def bw_compiler(
294-
gm: torch.fx.GraphModule, example_inputs: List[torch.Tensor]
285+
gm: torch.fx.GraphModule, example_inputs: list[torch.Tensor]
295286
) -> Callable[..., Any]:
296287
self.bw_graphs.append(gm)
297288
return gm.forward
@@ -360,7 +351,7 @@ def standard_test(
360351

361352

362353
def dummy_fx_compile(
363-
gm: fx.GraphModule, example_inputs: List[torch.Tensor]
354+
gm: fx.GraphModule, example_inputs: list[torch.Tensor]
364355
) -> Callable[..., Any]:
365356
return gm.forward
366357

0 commit comments

Comments
 (0)