From 2a37e9361199d0fe04af9d209b0b13b6f9561d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E5=AD=A6?= Date: Fri, 24 Nov 2023 09:58:51 +0800 Subject: [PATCH 1/3] Fix YiAdapter --- fastchat/model/model_adapter.py | 3 ++- fastchat/model/model_registry.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index ee4fe573d..a75929819 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1916,7 +1916,8 @@ class YiAdapter(BaseModelAdapter): """The model adapter for Yi models""" def match(self, model_path: str): - return "yi-34b-chat" in model_path.lower() + # use "yi-" instead of "yi" to support Yi Series Models, because "yi" is usually a sub-string of certain words. + return "yi-" in model_path.lower() def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("Yi-34b-chat") diff --git a/fastchat/model/model_registry.py b/fastchat/model/model_registry.py index a8e603c72..ed1e3337c 100644 --- a/fastchat/model/model_registry.py +++ b/fastchat/model/model_registry.py @@ -399,7 +399,7 @@ def get_model_info(name: str) -> ModelInfo: ) register_model_info( - ["Yi-34B-Chat"], + ["Yi-34B-Chat", "Yi-6B-Chat"], "Yi-Chat", "https://huggingface.co/01-ai", "A large language model by 01.AI.", From c51fc1e41631204b7f9b89073ab8df5a2b269552 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sun, 26 Nov 2023 00:03:53 -0800 Subject: [PATCH 2/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 a75929819..7b5a2f903 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1917,7 +1917,7 @@ class YiAdapter(BaseModelAdapter): def match(self, model_path: str): # use "yi-" instead of "yi" to support Yi Series Models, because "yi" is usually a sub-string of certain words. - return "yi-" in model_path.lower() + return "yi-" in model_path.lower() and "chat" in model_path.lower() def get_default_conv_template(self, model_path: str) -> Conversation: return get_conv_template("Yi-34b-chat") From 695f5988118ccbcaf12d1c013c28ea9d8e96d7e4 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sun, 26 Nov 2023 00:04:10 -0800 Subject: [PATCH 3/3] Apply suggestions from code review --- fastchat/model/model_adapter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fastchat/model/model_adapter.py b/fastchat/model/model_adapter.py index 7b5a2f903..ed9fd5b13 100644 --- a/fastchat/model/model_adapter.py +++ b/fastchat/model/model_adapter.py @@ -1916,7 +1916,6 @@ class YiAdapter(BaseModelAdapter): """The model adapter for Yi models""" def match(self, model_path: str): - # use "yi-" instead of "yi" to support Yi Series Models, because "yi" is usually a sub-string of certain words. return "yi-" in model_path.lower() and "chat" in model_path.lower() def get_default_conv_template(self, model_path: str) -> Conversation: