Skip to content

Commit

Permalink
Support xDAN-L1-Chat Model (#2732)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiechengmude authored Dec 9, 2023
1 parent ea90cf0 commit 2988943
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
12 changes: 12 additions & 0 deletions fastchat/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="</s>",
)
)

# Zephyr template
# reference: https://huggingface.co/spaces/HuggingFaceH4/zephyr-playground/blob/main/dialogues.py
Expand Down
11 changes: 11 additions & 0 deletions fastchat/model/model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"""

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 2988943

Please sign in to comment.