Skip to content

Commit

Permalink
fix and try uv in misc ci
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Nov 28, 2024
1 parent f693c44 commit 6486320
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
13 changes: 9 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 @@ -48,11 +48,16 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- 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]
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
23 changes: 14 additions & 9 deletions .github/workflows/test_cli_misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,35 @@ 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 }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Linux packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y numactl
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- 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]
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
15 changes: 9 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ def test_cli_exit_code_0(launcher):
"name=test",
"launcher=" + launcher,
# compatible task and model
"scenario.input_shapes.batch_size=1",
"scenario.input_shapes.sequence_length=16",
"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 @@ -90,11 +91,12 @@ def test_cli_exit_code_1(launcher):
"name=test",
"launcher=" + launcher,
# incompatible task and model to trigger an error
"scenario.input_shapes.batch_size=1",
"scenario.input_shapes.sequence_length=16",
"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 @@ -115,11 +117,12 @@ def test_cli_numactl(launcher):
"name=test",
"launcher=" + launcher,
"launcher.numactl=True",
"scenario.input_shapes.batch_size=1",
"scenario.input_shapes.sequence_length=16",
"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

0 comments on commit 6486320

Please sign in to comment.