From 132ae20ead032ffd7693408e46a5b90e211df1de Mon Sep 17 00:00:00 2001 From: chang Date: Tue, 3 Oct 2023 19:47:16 +0900 Subject: [PATCH 1/3] add Llama2ChangAdapter --- fastchat/model/model_adapter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index db9da37b7..ee772f239 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1624,6 +1624,14 @@ def match(self, model_path: str): def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("phind") +class Llama2ChangAdapter(Llama2Adapter): + """The model adapter for Llama2-ko-chang""" + + def match(self, model_path: str): + return "llama2-ko-chang" in model_path.lower() + + def get_default_conv_template(self, model_path: str) -> Conversation: + return get_conv_template("polyglot_changgpt") # Note: the registration order matters. # The one registered earlier has a higher matching priority. @@ -1684,6 +1692,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation: register_model_adapter(ReaLMAdapter) register_model_adapter(PhindCodeLlamaAdapter) register_model_adapter(CodeLlamaAdapter) +register_model_adapter(Llama2ChangAdapter) # After all adapters, try the default base adapter. register_model_adapter(BaseModelAdapter) From 62319f7f07ce0e4a2f2069190f720cbc840f4bae Mon Sep 17 00:00:00 2001 From: chang Date: Wed, 4 Oct 2023 09:04:35 +0900 Subject: [PATCH 2/3] format --- fastchat/model/model_adapter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index ee772f239..975ec0ac0 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1624,6 +1624,7 @@ def match(self, model_path: str): def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("phind") + class Llama2ChangAdapter(Llama2Adapter): """The model adapter for Llama2-ko-chang""" @@ -1633,6 +1634,7 @@ def match(self, model_path: str): def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("polyglot_changgpt") + # Note: the registration order matters. # The one registered earlier has a higher matching priority. register_model_adapter(PeftModelAdapter) From 3f2fc41cd3a513aabccbf848762a398162330b41 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Mon, 9 Oct 2023 12:47:16 -0700 Subject: [PATCH 3/3] Update fastchat/model/model_adapter.py --- fastchat/model/model_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index 975ec0ac0..2c520ae8e 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1626,7 +1626,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation: class Llama2ChangAdapter(Llama2Adapter): - """The model adapter for Llama2-ko-chang""" + """The model adapter for Llama2-ko-chang (e.g., lcw99/llama2-ko-chang-instruct-chat)""" def match(self, model_path: str): return "llama2-ko-chang" in model_path.lower()