Skip to content

Commit

Permalink
Add workflow, fixes for GPU test pipeline (run-llama#103)
Browse files Browse the repository at this point in the history
* Add workflow for triggering BuildKite tests. Fixed test markers. Updated dev requirements.

* Unpin torch.

* Update requirements-dev.txt

Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>

* Rename GPU test workflow.

* Update .github/workflows/test_gpu.yml

Co-authored-by: Basile Dura <bdura@users.noreply.github.com>

---------

Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
Co-authored-by: Basile Dura <bdura@users.noreply.github.com>
  • Loading branch information
3 people committed May 17, 2023
1 parent 760b73c commit 064ab62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test_gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: GPU tests

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
run:
if: github.repository_owner == 'explosion'
runs-on: ubuntu-latest
steps:
- name: Trigger buildkite build
uses: buildkite/trigger-pipeline-action@v1.2.0
env:
PIPELINE: explosion-ai/spacy-llm-gpu-tests
BRANCH: main
MESSAGE: ":github: spacy-llm GPU tests - triggered from a GitHub Action"
BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.BUILDKITE_SECRET }}
5 changes: 4 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ black==22.3.0
types-requests==2.28.11.16
# Prompting libraries needed for testing
langchain>=0.0.144,<0.1; python_version>="3.9"
minichain>=0.3,<0.4; python_version>="3.8" and python_version<"3.11"
minichain>=0.3,<0.4; python_version>="3.8" and python_version<"3.11"
# Necessary for running all local models on GPU.
transformers>=4.0.0,<5.0.0
torch
7 changes: 5 additions & 2 deletions spacy_llm/tests/pipeline/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import registry

from ..compat import has_openai_key


@pytest.fixture
def noop_config() -> Dict[str, Any]:
Expand Down Expand Up @@ -47,7 +49,7 @@ def test_llm_pipe_empty(nlp):

def test_llm_serialize_bytes():
llm = LLMWrapper(
task=NoopTask,
task=NoopTask(),
backend=None, # type: ignore
cache={"path": None, "batch_size": 0, "max_batches_in_mem": 0},
vocab=None, # type: ignore
Expand All @@ -57,7 +59,7 @@ def test_llm_serialize_bytes():

def test_llm_serialize_disk():
llm = LLMWrapper(
task=NoopTask,
task=NoopTask(),
backend=None, # type: ignore
cache={"path": None, "batch_size": 0, "max_batches_in_mem": 0},
vocab=None, # type: ignore
Expand All @@ -68,6 +70,7 @@ def test_llm_serialize_disk():
llm.from_disk(tmp_dir / "llm")


@pytest.mark.skipif(has_openai_key is False, reason="OpenAI API key not available")
@pytest.mark.external
def test_type_checking_valid(noop_config) -> None:
"""Test type checking for consistency between functions."""
Expand Down
4 changes: 3 additions & 1 deletion spacy_llm/tests/tasks/test_ner.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def fewshot_cfg_string():
"""


@pytest.mark.external
@pytest.mark.skipif(has_openai_key is False, reason="OpenAI API key not available")
@pytest.mark.parametrize("cfg_string", ["fewshot_cfg_string", "zeroshot_cfg_string"])
def test_ner_config(cfg_string, request):
Expand All @@ -82,7 +83,8 @@ def test_ner_config(cfg_string, request):
assert nlp.pipe_names == ["llm"]


# @pytest.mark.external
@pytest.mark.external
@pytest.mark.skipif(has_openai_key is False, reason="OpenAI API key not available")
@pytest.mark.parametrize("cfg_string", ["zeroshot_cfg_string", "fewshot_cfg_string"])
def test_ner_predict(cfg_string, request):
"""Use OpenAI to get zero-shot NER results.
Expand Down

0 comments on commit 064ab62

Please sign in to comment.