forked from pytorch/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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,18 @@ | ||
import unittest | ||
|
||
from benchmark_model import BenchmarkModel | ||
|
||
|
||
class BenchmarkModelTest(unittest.TestCase): | ||
|
||
def test_to_dict(self): | ||
bm = BenchmarkModel("torchbench or other", "super_deep_model", | ||
"placeholder") | ||
actual = bm.to_dict() | ||
self.assertEqual(2, len(actual)) | ||
self.assertEqual("torchbench or other", actual["suite_name"]) | ||
self.assertEqual("super_deep_model", actual["model_name"]) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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,32 @@ | ||
import unittest | ||
|
||
import subprocess | ||
|
||
import experiment_runner | ||
|
||
EXPERIMENT_RUNNER_PY = experiment_runner.__file__ | ||
|
||
|
||
class ExperimentRunnerTest(unittest.TestCase): | ||
|
||
def test_alexnet_dry_run(self): | ||
child = subprocess.run([ | ||
"python", EXPERIMENT_RUNNER_PY, "--dynamo=openxla", "--dynamo=inductor", | ||
"--xla=PJRT", "--xla=None", "--test=eval", "--test=train", | ||
"--suite-name=torchbench", "--accelerator=cpu", "--filter=^alexnet$", | ||
"--dry-run" | ||
], | ||
capture_output=True, | ||
text=True) | ||
expected_in_stderr = [ | ||
"Number of selected experiment configs: 2", | ||
"Number of selected model configs: 1", | ||
"'--experiment-config={\"accelerator\": \"cpu\", \"xla\": \"PJRT\", \"xla_flags\": null, \"dynamo\": \"openxla\", \"test\": \"eval\"}', '--model-config={\"model_name\": \"alexnet\"}'", | ||
"'--experiment-config={\"accelerator\": \"cpu\", \"xla\": \"PJRT\", \"xla_flags\": null, \"dynamo\": \"openxla\", \"test\": \"train\"}', '--model-config={\"model_name\": \"alexnet\"}'", | ||
] | ||
for expected in expected_in_stderr: | ||
self.assertTrue(expected in child.stderr) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |