From 650b94d182ed0c9f312ab49672b6ec5ec1b2c5d5 Mon Sep 17 00:00:00 2001 From: AllentDan Date: Wed, 15 Jan 2025 15:18:29 +0800 Subject: [PATCH] update the unit test --- tests/test_lmdeploy/test_model.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_lmdeploy/test_model.py b/tests/test_lmdeploy/test_model.py index 0e53283a87..17e5dbd9bb 100644 --- a/tests/test_lmdeploy/test_model.py +++ b/tests/test_lmdeploy/test_model.py @@ -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 = [{