Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastchat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.34"
__version__ = "0.2.35"
7 changes: 3 additions & 4 deletions fastchat/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,9 @@ def get_conv_template(name: str) -> Conversation:
)


#yuan 2.0 template
#reference:https://github.com/IEIT-Yuan/Yuan-2.0
#reference:https://huggingface.co/IEITYuan
# yuan 2.0 template
# reference:https://github.com/IEIT-Yuan/Yuan-2.0
# reference:https://huggingface.co/IEITYuan
register_conv_template(
Conversation(
name="yuan",
Expand All @@ -1445,7 +1445,6 @@ def get_conv_template(name: str) -> Conversation:
sep_style=SeparatorStyle.NO_COLON_SINGLE,
sep="<sep>",
stop_str="<eod>",

)
)

Expand Down
26 changes: 22 additions & 4 deletions fastchat/model/model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,23 +2130,41 @@ def match(self, model_path: str):
def get_default_conv_template(self, model_path: str) -> Conversation:
return get_conv_template("solar")


class Yuan2Adapter(BaseModelAdapter):
"""The model adapter for Yuan """
"""The model adapter for Yuan"""

def match(self, model_path: str):
return "yuan" in model_path.lower()

def load_model(self, model_path: str, from_pretrained_kwargs: dict):
model, tokenizer = super().load_model(model_path, from_pretrained_kwargs)
tokenizer.add_tokens(
['<sep>', '<pad>', '<mask>', '<predict>', '<FIM_SUFFIX>', '<FIM_PREFIX>', '<FIM_MIDDLE>', '<commit_before>',
'<commit_msg>', '<commit_after>', '<jupyter_start>', '<jupyter_text>', '<jupyter_code>',
'<jupyter_output>', '<empty_output>'], special_tokens=True)
[
"<sep>",
"<pad>",
"<mask>",
"<predict>",
"<FIM_SUFFIX>",
"<FIM_PREFIX>",
"<FIM_MIDDLE>",
"<commit_before>",
"<commit_msg>",
"<commit_after>",
"<jupyter_start>",
"<jupyter_text>",
"<jupyter_code>",
"<jupyter_output>",
"<empty_output>",
],
special_tokens=True,
)
return model, tokenizer

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


# Note: the registration order matters.
# The one registered earlier has a higher matching priority.
register_model_adapter(PeftModelAdapter)
Expand Down
2 changes: 1 addition & 1 deletion fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def get_model_info(name: str) -> ModelInfo:
)

register_model_info(
["Yuan2-2B-hf","Yuan2-51B-hf","Yuan2-102B-hf"],
["Yuan2-2B-hf", "Yuan2-51B-hf", "Yuan2-102B-hf"],
"IEIYuan",
"https://huggingface.co/IEITYuan",
"Yuan2 is a Basemodel developed by IEI.",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "fschat"
version = "0.2.34"
version = "0.2.35"
description = "An open platform for training, serving, and evaluating large language model based chatbots."
readme = "README.md"
requires-python = ">=3.8"
Expand Down