From 6e6b10363f3ac65926881f2c6a6113b6cefc06cd Mon Sep 17 00:00:00 2001 From: Ilyas Moutawwakil <57442720+IlyasMoutawwakil@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:40:06 +0100 Subject: [PATCH] Fix misc test (#300) --- .github/workflows/test_api_misc.yaml | 11 +++++++---- .github/workflows/test_cli_misc.yaml | 11 +++++++---- tests/test_api.py | 9 ++++++++- tests/test_cli.py | 9 +++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_api_misc.yaml b/.github/workflows/test_api_misc.yaml index 29339eab..2da1e7ec 100644 --- a/.github/workflows/test_api_misc.yaml +++ b/.github/workflows/test_api_misc.yaml @@ -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 }} @@ -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: diff --git a/.github/workflows/test_cli_misc.yaml b/.github/workflows/test_cli_misc.yaml index fb699a88..165e147a 100644 --- a/.github/workflows/test_cli_misc.yaml +++ b/.github/workflows/test_cli_misc.yaml @@ -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 }} @@ -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: | diff --git a/tests/test_api.py b/tests/test_api.py index 01851c34..34598a02 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -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, diff --git a/tests/test_cli.py b/tests/test_cli.py index 3a510806..518b02a9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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) @@ -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) @@ -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)