Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip some benchmark tests #208

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import numpy as np
import os
import unittest
import oneflow as flow


Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_alexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,50 @@
from flowvision.models.alexnet import alexnet


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_alexnet_batch_size1(benchmark, net=alexnet, input_shape=[1, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_alexnet_batch_size2(benchmark, net=alexnet, input_shape=[2, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_alexnet_batch_size4(benchmark, net=alexnet, input_shape=[4, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_alexnet_batch_size8(benchmark, net=alexnet, input_shape=[8, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_alexnet_batch_size16(benchmark, net=alexnet, input_shape=[16, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_convnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.convnext import convnext_tiny_224


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_convnext_tiny_224_batch_size1(
benchmark, net=convnext_tiny_224, input_shape=[1, 3, 224, 224]
Expand All @@ -11,6 +15,10 @@ def test_convnext_tiny_224_batch_size1(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_convnext_tiny_224_batch_size2(
benchmark, net=convnext_tiny_224, input_shape=[2, 3, 224, 224]
Expand All @@ -19,6 +27,10 @@ def test_convnext_tiny_224_batch_size2(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_convnext_tiny_224_batch_size4(
benchmark, net=convnext_tiny_224, input_shape=[4, 3, 224, 224]
Expand All @@ -27,6 +39,10 @@ def test_convnext_tiny_224_batch_size4(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_convnext_tiny_224_batch_size8(
benchmark, net=convnext_tiny_224, input_shape=[8, 3, 224, 224]
Expand All @@ -35,6 +51,10 @@ def test_convnext_tiny_224_batch_size8(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_convnext_tiny_224_batch_size16(
benchmark, net=convnext_tiny_224, input_shape=[16, 3, 224, 224]
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_crossformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.crossformer import crossformer_tiny_patch4_group7_224


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_crossformer_tiny_patch4_group7_224_batch_size1(
benchmark, net=crossformer_tiny_patch4_group7_224, input_shape=[1, 3, 224, 224]
Expand All @@ -11,6 +15,10 @@ def test_crossformer_tiny_patch4_group7_224_batch_size1(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_crossformer_tiny_patch4_group7_224_batch_size2(
benchmark, net=crossformer_tiny_patch4_group7_224, input_shape=[2, 3, 224, 224]
Expand All @@ -19,6 +27,10 @@ def test_crossformer_tiny_patch4_group7_224_batch_size2(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_crossformer_tiny_patch4_group7_224_batch_size4(
benchmark, net=crossformer_tiny_patch4_group7_224, input_shape=[4, 3, 224, 224]
Expand All @@ -27,6 +39,10 @@ def test_crossformer_tiny_patch4_group7_224_batch_size4(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_crossformer_tiny_patch4_group7_224_batch_size8(
benchmark, net=crossformer_tiny_patch4_group7_224, input_shape=[8, 3, 224, 224]
Expand All @@ -35,6 +51,10 @@ def test_crossformer_tiny_patch4_group7_224_batch_size8(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_crossformer_tiny_patch4_group7_224_batch_size16(
benchmark, net=crossformer_tiny_patch4_group7_224, input_shape=[16, 3, 224, 224]
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_cswin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.cswin import cswin_tiny_224


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_cswin_tiny_224_batch_size1(
benchmark, net=cswin_tiny_224, input_shape=[1, 3, 224, 224]
Expand All @@ -11,6 +15,10 @@ def test_cswin_tiny_224_batch_size1(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_cswin_tiny_224_batch_size2(
benchmark, net=cswin_tiny_224, input_shape=[2, 3, 224, 224]
Expand All @@ -19,6 +27,10 @@ def test_cswin_tiny_224_batch_size2(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_cswin_tiny_224_batch_size4(
benchmark, net=cswin_tiny_224, input_shape=[4, 3, 224, 224]
Expand All @@ -27,6 +39,10 @@ def test_cswin_tiny_224_batch_size4(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_cswin_tiny_224_batch_size8(
benchmark, net=cswin_tiny_224, input_shape=[8, 3, 224, 224]
Expand All @@ -35,6 +51,10 @@ def test_cswin_tiny_224_batch_size8(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_cswin_tiny_224_batch_size16(
benchmark, net=cswin_tiny_224, input_shape=[16, 3, 224, 224]
Expand Down
4 changes: 4 additions & 0 deletions benchmark/test_densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.densenet import densenet121


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_densenet121_batch_size1(
benchmark, net=densenet121, input_shape=[1, 3, 224, 224]
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_ghostnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,50 @@
from flowvision.models.ghostnet import ghostnet


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_ghostnet_batch_size1(benchmark, net=ghostnet, input_shape=[1, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_ghostnet_batch_size2(benchmark, net=ghostnet, input_shape=[2, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_ghostnet_batch_size4(benchmark, net=ghostnet, input_shape=[4, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_ghostnet_batch_size8(benchmark, net=ghostnet, input_shape=[8, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_ghostnet_batch_size16(benchmark, net=ghostnet, input_shape=[16, 3, 224, 224]):
model, x, optimizer = fetch_args(net, input_shape)
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_mlp_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.mlp_mixer import mlp_mixer_b16_224


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mlp_mixer_b16_224_batch_size1(
benchmark, net=mlp_mixer_b16_224, input_shape=[1, 3, 224, 224]
Expand All @@ -11,6 +15,10 @@ def test_mlp_mixer_b16_224_batch_size1(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mlp_mixer_b16_224_batch_size2(
benchmark, net=mlp_mixer_b16_224, input_shape=[2, 3, 224, 224]
Expand All @@ -19,6 +27,10 @@ def test_mlp_mixer_b16_224_batch_size2(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mlp_mixer_b16_224_batch_size4(
benchmark, net=mlp_mixer_b16_224, input_shape=[4, 3, 224, 224]
Expand All @@ -27,6 +39,10 @@ def test_mlp_mixer_b16_224_batch_size4(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mlp_mixer_b16_224_batch_size8(
benchmark, net=mlp_mixer_b16_224, input_shape=[8, 3, 224, 224]
Expand All @@ -35,6 +51,10 @@ def test_mlp_mixer_b16_224_batch_size8(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mlp_mixer_b16_224_batch_size16(
benchmark, net=mlp_mixer_b16_224, input_shape=[16, 3, 224, 224]
Expand Down
20 changes: 20 additions & 0 deletions benchmark/test_mnasnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
from flowvision.models.mnasnet import mnasnet0_5


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mnasnet0_5_batch_size1(
benchmark, net=mnasnet0_5, input_shape=[1, 3, 224, 224]
Expand All @@ -11,6 +15,10 @@ def test_mnasnet0_5_batch_size1(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mnasnet0_5_batch_size2(
benchmark, net=mnasnet0_5, input_shape=[2, 3, 224, 224]
Expand All @@ -19,6 +27,10 @@ def test_mnasnet0_5_batch_size2(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mnasnet0_5_batch_size4(
benchmark, net=mnasnet0_5, input_shape=[4, 3, 224, 224]
Expand All @@ -27,6 +39,10 @@ def test_mnasnet0_5_batch_size4(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mnasnet0_5_batch_size8(
benchmark, net=mnasnet0_5, input_shape=[8, 3, 224, 224]
Expand All @@ -35,6 +51,10 @@ def test_mnasnet0_5_batch_size8(
benchmark(run, model, x, optimizer)


@unittest.skipUnless(
os.getenv("ONEFLOW_BENCHMARK_ALL") == "1",
"set ONEFLOW_BENCHMARK_ALL=1 to run this test",
)
@oneflow_benchmark.ci_settings(compare={"median": "5%"})
def test_mnasnet0_5_batch_size16(
benchmark, net=mnasnet0_5, input_shape=[16, 3, 224, 224]
Expand Down
Loading