Skip to content

Commit

Permalink
Update phi-3 prompt template (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt authored Jul 2, 2024
1 parent c22e5df commit 2da3dd2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion litgpt/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def apply(self, prompt: str, **kwargs: str) -> str:

class Phi3(PromptStyle):
def apply(self, prompt: str, **kwargs: str) -> str:
return f'<s><|user|>\n{prompt}<|end|>\n<|assistant|>\n'
return f'<|system|>\nYou are a helpful assistant.<|end|>\n<|user|>\n{prompt}<|end|>\n<|assistant|>\n'



Expand Down
3 changes: 0 additions & 3 deletions tests/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ def test_tokenizer_against_hf(config):
# TODO: there's a encoding difference with this model. why? note that the decoding is equal
# "Hello": 10994, "▁Hello": 15043
assert [15043 if t == 10994 else t for t in actual.tolist()] == expected
elif config.name.startswith("Phi-3"):
# Phi-3 tokenizer adds `bos` twice
assert [ours.bos_id] + actual.tolist() == expected
else:
assert actual.tolist() == expected
assert ours.decode(actual) == theirs.decode(expected, skip_special_tokens=True)
Expand Down

0 comments on commit 2da3dd2

Please sign in to comment.