From 2988943ef600da29db1307720a38b5e9fa26fbd2 Mon Sep 17 00:00:00 2001 From: xDAN-AI <128944251+xiechengmude@users.noreply.github.com> Date: Sun, 10 Dec 2023 00:07:25 +0800 Subject: [PATCH] Support xDAN-L1-Chat Model (#2732) --- README.md | 2 +- fastchat/conversation.py | 12 ++++++++++++ fastchat/model/model_adapter.py | 11 +++++++++++ fastchat/model/model_registry.py | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1aefdeea..08e0c4b16 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ You can use the commands below to chat with FastChat-T5. It will automatically d #### Supported Models FastChat supports a wide range of models, including -LLama 2, Vicuna, Alpaca, Baize, ChatGLM, Dolly, Falcon, FastChat-T5, GPT4ALL, Guanaco, MTP, OpenAssistant, OpenChat, RedPajama, StableLM, WizardLM, and more. +LLama 2, Vicuna, Alpaca, Baize, ChatGLM, Dolly, Falcon, FastChat-T5, GPT4ALL, Guanaco, MTP, OpenAssistant, OpenChat, RedPajama, StableLM, WizardLM, xDAN-AI and more. See a complete list of supported models and instructions to add a new model [here](docs/model_support.md). diff --git a/fastchat/conversation.py b/fastchat/conversation.py index 43c561bfb..dca87a594 100644 --- a/fastchat/conversation.py +++ b/fastchat/conversation.py @@ -1271,6 +1271,18 @@ def get_conv_template(name: str) -> Conversation: stop_str="<|user|>", ) ) +# xDAN default template +# source: https://huggingface.co/xDAN-AI/xDAN-L1-Chat-v0.1 +register_conv_template( + Conversation( + name="xdan-v1", + system_message="You are a helpful and harmless assistant named xDAN and created by xDAN-AI.Please response and work on questions thinking step by step.", + roles=("### Human", "### Assistant"), + sep_style=SeparatorStyle.NO_COLON_SINGLE, + sep="\n", + stop_str="", + ) +) # Zephyr template # reference: https://huggingface.co/spaces/HuggingFaceH4/zephyr-playground/blob/main/dialogues.py diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index ce56330d4..bb8792288 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1915,6 +1915,16 @@ def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("metharme") +class XdanAdapter(BaseModelAdapter): + """The model adapter for xDAN-AI (e.g. xDAN-AI/xDAN-L1-Chat-v0.1)""" + + def match(self, model_path: str): + return "xdan" in model_path.lower() + + def get_default_conv_template(self, model_path: str) -> Conversation: + return get_conv_template("xdan-v1") + + class MicrosoftOrcaAdapter(BaseModelAdapter): """The model adapter for Microsoft/Orca-2 series of models (e.g. Microsoft/Orca-2-7b, Microsoft/Orca-2-13b)""" @@ -2039,6 +2049,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation: register_model_adapter(LemurAdapter) register_model_adapter(PygmalionAdapter) register_model_adapter(MicrosoftOrcaAdapter) +register_model_adapter(XdanAdapter) register_model_adapter(YiAdapter) register_model_adapter(DeepseekCoderAdapter) register_model_adapter(DeepseekChatAdapter) diff --git a/fastchat/model/model_registry.py b/fastchat/model/model_registry.py index 6e812eb81..0623e113d 100644 --- a/fastchat/model/model_registry.py +++ b/fastchat/model/model_registry.py @@ -421,6 +421,12 @@ def get_model_info(name: str) -> ModelInfo: "https://huggingface.co/BAAI/AquilaChat2-34B", "Chat models developed by BAAI team", ) +register_model_info( + ["xDAN-L1-Chat-v0.1"], + "xDAN-L1-Chat", + "https://huggingface.co/xDAN-AI/xDAN-L1-Chat-v0.1", + "A large language chat model created by xDAN-AI.", +) register_model_info( ["MetaMath-70B-V1.0", "MetaMath-7B-V1.0"],