Skip to content

Commit

Permalink
tests to reproduce issue 820
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Lapp committed May 15, 2024
1 parent 78852b0 commit 784e65b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/generate/test_integration_llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,19 @@ def test_llamacpp_cfg(model):
prompt = "<|im_start|>user\nOutput a short and valid JSON object with two keys.<|im_end|>\n><|im_start|>assistant\n"
result = generate.cfg(model, grammars.arithmetic)(prompt, seed=11)
assert isinstance(result, str)


@pytest.mark.parametrize(
"repo",
[
("Qwen/Qwen1.5-0.5B-Chat-GGUF", "*q2*.gguf"),
("QuantFactory/Meta-Llama-3-8B-Instruct-GGUF", "*Q2*.gguf"),
("TheBloke/phi-2-GGUF", "*Q2*.gguf"),
("QuantFactory/Phi-3-mini-4k-instruct-GGUF-v2", "*Q2*.gguf"),
],
)
def test_byte_tokenizer_regression(repo, model_path):
"""Reproduce https://github.com/outlines-dev/outlines/issues/820"""
model = models.llamacpp(repo, model_path)
generator = generate.choice(model, ["skirt", "dress", "pen", "jacket"])
generator("Pick the odd word out: skirt, dress, pen, jacket")

0 comments on commit 784e65b

Please sign in to comment.