Skip to content

Commit

Permalink
Add SOLAR-10.7b Instruct Model (lm-sys#2826)
Browse files Browse the repository at this point in the history
  • Loading branch information
BabyChouSr authored and zhanghao.smooth committed Jan 26, 2024
1 parent 2463fac commit ae7e7f7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fastchat/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,19 @@ def get_conv_template(name: str) -> Conversation:
)
)

# Solar-10.7B Chat Template
# Reference: https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0/blob/main/tokenizer_config.json
register_conv_template(
Conversation(
name="solar",
system_message="",
roles=("### User", "### Assistant"),
sep_style=SeparatorStyle.ADD_NEW_LINE_SINGLE,
sep="\n\n",
stop_str="</s>",
)
)


if __name__ == "__main__":
from fastchat.conversation import get_conv_template
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 @@ -2034,6 +2034,16 @@ def get_default_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("metamath")


class SolarAdapter(BaseModelAdapter):
"""The model adapter for upstage/SOLAR-10.7B-Instruct-v1.0"""

def match(self, model_path: str):
return "solar-" in model_path.lower() and "instruct" in model_path.lower()

def get_default_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("solar")


# Note: the registration order matters.
# The one registered earlier has a higher matching priority.
register_model_adapter(RerankAdapter)
Expand Down Expand Up @@ -2112,6 +2122,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:
register_model_adapter(DeepseekCoderAdapter)
register_model_adapter(DeepseekChatAdapter)
register_model_adapter(MetaMathAdapter)
register_model_adapter(SolarAdapter)

# After all adapters, try the default base adapter.
register_model_adapter(BaseModelAdapter)
7 changes: 7 additions & 0 deletions fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,10 @@ def get_model_info(name: str) -> ModelInfo:
"https://huggingface.co/meta-math",
"MetaMath is a finetune of Llama2 on [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) that specializes in mathematical reasoning.",
)

register_model_info(
["upstage/SOLAR-10.7B-Instruct-v1.0"],
"SOLAR-10.7B-Instruct",
"https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0",
"A Llama2 fine-tune developed by upstage.ai that incorporates depth up-scaling.",
)

0 comments on commit ae7e7f7

Please sign in to comment.