Skip to content

Commit

Permalink
[Models] Add Phi3 to tests (#776)
Browse files Browse the repository at this point in the history
Phi3 is now out, so start adding it into our testing frameworks
  • Loading branch information
riedgar-ms authored May 3, 2024
1 parent acb38d1 commit 07aa1bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/action_gpu_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
pip install pytest
pip install -e .[schemas,test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Other dependencies
run: |
pip install sentencepiece
- name: GPU pip installs
run: |
pip install accelerate
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/action_plain_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
# - "transformers_mistral_7b" See Issue 713
- "hfllama7b"
- "hfllama_mistral_7b"
- "phi3cpu-mini-4k-instruct"

runs-on: ${{ inputs.os }}
steps:
Expand All @@ -44,6 +45,7 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install model-specific dependencies
run: |
pip install sentencepiece
pip install "llama-cpp-python!=0.2.58"
- name: Run tests (except server)
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"phi2cpu": dict(
name="transformers:microsoft/phi-2", kwargs={"trust_remote_code": True}
),
"phi3cpu-mini-4k-instruct": dict(
name="transformers:microsoft/Phi-3-mini-4k-instruct",
kwargs={"trust_remote_code": True},
),
"hfllama7b": dict(
name="huggingface_hubllama:TheBloke/Llama-2-7B-GGUF:llama-2-7b.Q5_K_M.gguf",
kwargs={"verbose": True, "n_ctx": 4096},
Expand Down
6 changes: 2 additions & 4 deletions tests/models/test_transformers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from guidance import gen, select
from guidance import gen, select, models, assistant, system, user

from ..utils import get_model

Expand Down Expand Up @@ -59,7 +59,6 @@ def test_transformer_smoke_select(model_name, model_kwargs):

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

lm = models.Transformers(
r"microsoft/Phi-3-mini-4k-instruct", trust_remote_code=True
Expand All @@ -70,8 +69,7 @@ def test_phi3_loading():

@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
# TODO: Double check chat format: https://huggingface.co/microsoft/Phi-3-mini-4k-instruct

lm = models.TransformersChat(
r"microsoft/Phi-3-mini-4k-instruct", trust_remote_code=True
Expand Down

0 comments on commit 07aa1bb

Please sign in to comment.