Skip to content

Commit

Permalink
update the unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Jan 15, 2025
1 parent 3e44d37 commit 650b94d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_lmdeploy/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,29 @@ def test_codellama_others():
assert model is None


def test_deepseek():
model = MODELS.get('deepseek')()
messages = [{
'role': 'system',
'content': 'you are a helpful assistant'
}, {
'role': 'user',
'content': 'who are you'
}, {
'role': 'assistant',
'content': 'I am an AI'
}, {
'role': 'user',
'content': 'hi'
}]
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('deepseek-ai/DeepSeek-V2-Lite',
trust_remote_code=True)
ref = tokenizer.apply_chat_template(messages, tokenize=False)
res = '<|begin▁of▁sentence|>' + model.messages2prompt(messages)
assert res.startswith(ref)


def test_deepseek_coder():
model = MODELS.get('deepseek-coder')()
messages = [{
Expand Down

0 comments on commit 650b94d

Please sign in to comment.