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

Fix misc test #300

Merged
merged 3 commits into from
Nov 28, 2024
Merged
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
11 changes: 7 additions & 4 deletions .github/workflows/test_api_misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
os: [ubuntu-latest, "macos-latest", windows-latest]
python: ["3.8", "3.12"]

name: OS ${{ matrix.os }} - Python ${{ matrix.python }}
name: API Misc Tests - OS ${{ matrix.os }} - Python ${{ matrix.python }}

runs-on: ${{ matrix.os }}

Expand All @@ -50,9 +50,12 @@ jobs:

- name: Install requirements
run: |
pip install --upgrade pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -e .[testing,timm,diffusers,codecarbon]
pip install uv
uv pip install --upgrade pip
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
uv pip install -e .[testing,timm,diffusers,codecarbon]
env:
UV_SYSTEM_PYTHON: 1

- name: Run tests
env:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test_cli_misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
os: [ubuntu-latest, "macos-latest", windows-latest]
python: ["3.8", "3.12"]

name: OS ${{ matrix.os }} - Python ${{ matrix.python }}
name: CLI Misc Tests - OS ${{ matrix.os }} - Python ${{ matrix.python }}

runs-on: ${{ matrix.os }}

Expand All @@ -56,9 +56,12 @@ jobs:

- name: Install requirements
run: |
pip install --upgrade pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -e .[testing]
pip install uv
uv pip install --upgrade pip
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
uv pip install -e .[testing,timm,diffusers,codecarbon]
env:
UV_SYSTEM_PYTHON: 1

- name: Run tests
run: |
Expand Down
9 changes: 8 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@ def test_api_launch(device, scenario, library, task, model):
def test_api_push_to_hub_mixin():
benchmark_name = "test_api_push_to_hub_mixin"

scenario_config = InferenceConfig(memory=True, latency=True, duration=1, iterations=1, warmup_runs=1)
backend_config = PyTorchConfig(model="google-bert/bert-base-uncased", device="cpu")
launcher_config = ProcessConfig(device_isolation=False)
scenario_config = InferenceConfig(
duration=1,
iterations=1,
warmup_runs=1,
memory=True,
latency=True,
input_shapes=INPUT_SHAPES,
)
benchmark_config = BenchmarkConfig(
name=benchmark_name,
scenario=scenario_config,
Expand Down
9 changes: 9 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def test_cli_exit_code_0(launcher):
"backend.task=text-classification",
"backend.model=bert-base-uncased",
"backend.device=cpu",
# input shapes
"+scenario.input_shapes.batch_size=1",
"+scenario.input_shapes.sequence_length=16",
]

popen_0 = run_subprocess_and_log_stream_output(LOGGER, args_0)
Expand All @@ -91,6 +94,9 @@ def test_cli_exit_code_1(launcher):
"backend.task=image-classification",
"backend.model=bert-base-uncased",
"backend.device=cpu",
# input shapes
"+scenario.input_shapes.batch_size=1",
"+scenario.input_shapes.sequence_length=16",
]

popen_1 = run_subprocess_and_log_stream_output(LOGGER, args_1)
Expand All @@ -114,6 +120,9 @@ def test_cli_numactl(launcher):
"backend.task=text-classification",
"backend.model=bert-base-uncased",
"backend.device=cpu",
# input shapes
"+scenario.input_shapes.batch_size=1",
"+scenario.input_shapes.sequence_length=16",
]

popen = run_subprocess_and_log_stream_output(LOGGER, args)
Expand Down
Loading