Skip to content

Commit

Permalink
fix notebook workflow tests (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbkoch authored Feb 7, 2025
1 parent d0044a6 commit 8217ab3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
57 changes: 18 additions & 39 deletions .github/workflows/notebook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,68 +16,48 @@ on:
# Run at 10:00 UTC every day
- cron: '00 10 * * *'

permissions:
id-token: write
contents: read

jobs:
build:

runs-on: gpu-runner
notebook_tests:
runs-on: "Large_Linux"
environment: test
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

permissions:
id-token: write # for Azure CLI login
steps:
- name: Checkout repo at ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }}
- name: Install Rust
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- 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.6/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .[all,test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: GPU pip installs
- name: Install Rust
shell: bash
run: |
pip install accelerate
CMAKE_ARGS="-DGGML_CUDA=on" pip install "llama-cpp-python!=0.2.58,!=0.2.75,!=0.2.84,!=0.3.6"
- name: Check GPU available
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install guidance
shell: bash
run: |
python -c "import torch; assert torch.cuda.is_available()"
- name: 'Az CLI login'
pip install --upgrade pip
pip install -e .[all,llamacpp,test]
- name: Azure login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Run Azure CLI commands'
shell: bash
run: |
az account show
az group list
- name: Test with pytest
- name: Notebook tests
shell: bash
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# Configure endpoints for Azure OpenAI
Expand All @@ -96,8 +76,7 @@ jobs:
AZURE_AI_STUDIO_LLAMA3_CHAT_DEPLOYMENT: ${{ vars.AZURE_AI_STUDIO_LLAMA3_CHAT_DEPLOYMENT }}
AZURE_AI_STUDIO_LLAMA3_CHAT_KEY: ${{ secrets.AZURE_AI_STUDIO_LLAMA3_CHAT_KEY }}
run: |
pytest --cov=guidance --cov-report=xml --cov-report=term-missing \
-vv \
pytest -vv --cov=guidance --cov-report=xml --cov-report=term-missing \
./tests/notebooks
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 2 additions & 0 deletions tests/notebooks/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def run_notebook(notebook_path: pathlib.Path, params: Optional[Dict[str, Any]] =
class TestTutorials:
BASE_TUTORIAL_PATH = BASE_NB_PATH / "tutorials"

@pytest.mark.skip(reason="resource has been temporarily blocked")
def test_chat(self, rate_limiter):
azureai_endpoint = env_or_skip("AZUREAI_CHAT_ENDPOINT")

Expand Down Expand Up @@ -55,6 +56,7 @@ def test_token_healing(self):
class TestModels:
BASE_MODEL_PATH = BASE_NB_PATH / "api_examples" / "models"

@pytest.mark.skip(reason="resource has been temporarily blocked")
def test_azure_openai(self, rate_limiter):
azureai_endpoint = env_or_skip("AZUREAI_CHAT_ENDPOINT")

Expand Down

0 comments on commit 8217ab3

Please sign in to comment.