Skip to content

Commit

Permalink
[Test] Fix build break (#777)
Browse files Browse the repository at this point in the history
There are actually three current build breaks:

- A mysterious push to `main` broke our tests. Skip the offending items
- `llama-cpp-python` has started segfaulting. Refactoring the workflow files a little appears to have solved this for reasons which are not entirely clear
- The `macos-latest` Runner [has changed](https://github.blog/changelog/2024-04-01-macos-14-sonoma-is-generally-available-and-the-latest-macos-runner-image/) and no longer has Python 3.8 and 3.9
  • Loading branch information
riedgar-ms authored Apr 24, 2024
1 parent d2525a3 commit c23c8b0
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
bare-install:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-12]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/template_unit_tests_on_gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: unit-tests-gpu-template

on:
workflow_call:
inputs:
os:
required: true
type: string
python:
required: true
type: string
model:
required: true
type: string

jobs:
unit-tests-on-gpu:
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Set up Python ${{ inputs.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}
- name: Show GPUs
run: |
nvidia-smi
- name: Update Ubuntu
run: |
sudo apt-get update
sudo apt-get -y upgrade
- name: Ensure NVIDIA SDK available
run: |
sudo apt-get -y install cuda-toolkit
echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .[schemas,test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: GPU pip installs
run: |
pip install accelerate
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install "llama-cpp-python!=0.2.58"
- name: Check GPU available
run: |
python -c "import torch; assert torch.cuda.is_available()"
- name: Run tests (except server) for ${{ inputs.model }}
run: |
pytest -vv --cov=guidance --cov-report=xml --cov-report=term-missing \
--selected_model ${{ inputs.model }} \
-m "not (server or needs_credentials)" \
./tests/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-12]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
model:
- "gpt2cpu"
Expand Down
57 changes: 7 additions & 50 deletions .github/workflows/unit_tests_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,16 @@ on:
workflow_dispatch:

jobs:
unit-tests:
unit-tests-gpu:

strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
os: [gpu-runner]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
model: ["gpt2gpu", "phi2gpu", "hfllama_7b_gpu"]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Show GPUs
run: |
nvidia-smi
- name: Update Ubuntu
run: |
sudo apt-get update
sudo apt-get -y upgrade
- name: Ensure NVIDIA SDK available
run: |
sudo apt-get -y install cuda-toolkit
echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .[schemas,test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: GPU pip installs
run: |
pip install accelerate
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install "llama-cpp-python!=0.2.58"
- name: Check GPU available
run: |
python -c "import torch; assert torch.cuda.is_available()"
- name: Run tests (except server)
run: |
pytest --cov=guidance --cov-report=xml --cov-report=term-missing \
--selected_model ${{ matrix.model }} \
-m "not (server or needs_credentials)" \
./tests/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
uses: ./.github/workflows/template_unit_tests_on_gpu.yml
with:
os: ${{ matrix.os }}
python: ${{ matrix.python-version }}
model: ${{ matrix.model }}
2 changes: 2 additions & 0 deletions tests/models/test_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def test_transformer_smoke_select(model_name, model_kwargs):
assert lm["answer"] in ["p", "t", "w"]


@pytest.mark.skip("Don't overload the build machines")
def test_phi3_loading():
from guidance import models

Expand All @@ -67,6 +68,7 @@ def test_phi3_loading():
assert lm["five"] == "5"


@pytest.mark.skip("Don't overload the build machines")
def test_phi3_chat():
# TODO: we currently use the wrong chat template for this model, need to update to match: https://huggingface.co/microsoft/Phi-3-mini-4k-instruct
from guidance import models, system, user, assistant
Expand Down

0 comments on commit c23c8b0

Please sign in to comment.