mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-18 16:27:31 +00:00
feat(model): Support Starling-LM-7B-beta (#1350)
This commit is contained in:
parent
e0ab852a60
commit
a272d1b8f3
@ -158,6 +158,7 @@ At present, we have introduced several key features to showcase our current capa
|
||||
We offer extensive model support, including dozens of large language models (LLMs) from both open-source and API agents, such as LLaMA/LLaMA2, Baichuan, ChatGLM, Wenxin, Tongyi, Zhipu, and many more.
|
||||
|
||||
- News
|
||||
- 🔥🔥🔥 [Starling-LM-7B-beta](https://huggingface.co/Nexusflow/Starling-LM-7B-beta)
|
||||
- 🔥🔥🔥 [gemma-7b-it](https://huggingface.co/google/gemma-7b-it)
|
||||
- 🔥🔥🔥 [gemma-2b-it](https://huggingface.co/google/gemma-2b-it)
|
||||
- 🔥🔥🔥 [SOLAR-10.7B](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0)
|
||||
|
@ -152,6 +152,7 @@
|
||||
海量模型支持,包括开源、API代理等几十种大语言模型。如LLaMA/LLaMA2、Baichuan、ChatGLM、文心、通义、智谱等。当前已支持如下模型:
|
||||
|
||||
- 新增支持模型
|
||||
- 🔥🔥🔥 [Starling-LM-7B-beta](https://huggingface.co/Nexusflow/Starling-LM-7B-beta)
|
||||
- 🔥🔥🔥 [gemma-7b-it](https://huggingface.co/google/gemma-7b-it)
|
||||
- 🔥🔥🔥 [gemma-2b-it](https://huggingface.co/google/gemma-2b-it)
|
||||
- 🔥🔥🔥 [SOLAR-10.7B](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0)
|
||||
@ -161,6 +162,7 @@
|
||||
- [更多开源模型](https://www.yuque.com/eosphoros/dbgpt-docs/iqaaqwriwhp6zslc#qQktR)
|
||||
|
||||
- 支持在线代理模型
|
||||
- [x] [零一万物.Yi](https://platform.lingyiwanwu.com/docs)
|
||||
- [x] [OpenAI·ChatGPT](https://api.openai.com/)
|
||||
- [x] [百川·Baichuan](https://platform.baichuan-ai.com/)
|
||||
- [x] [阿里·通义](https://www.aliyun.com/product/dashscope)
|
||||
|
@ -156,6 +156,7 @@ LLM_MODEL_CONFIG = {
|
||||
"gemma-7b-it": os.path.join(MODEL_PATH, "gemma-7b-it"),
|
||||
# https://huggingface.co/google/gemma-2b-it
|
||||
"gemma-2b-it": os.path.join(MODEL_PATH, "gemma-2b-it"),
|
||||
"starling-lm-7b-beta": os.path.join(MODEL_PATH, "Starling-LM-7B-beta"),
|
||||
}
|
||||
|
||||
EMBEDDING_MODEL_CONFIG = {
|
||||
|
@ -193,7 +193,61 @@ class GemmaAdapter(NewHFChatModelAdapter):
|
||||
)
|
||||
|
||||
|
||||
class StarlingLMAdapter(NewHFChatModelAdapter):
|
||||
"""
|
||||
https://huggingface.co/Nexusflow/Starling-LM-7B-beta
|
||||
"""
|
||||
|
||||
support_4bit: bool = True
|
||||
support_8bit: bool = True
|
||||
support_system_message: bool = False
|
||||
|
||||
def do_match(self, lower_model_name_or_path: Optional[str] = None):
|
||||
return (
|
||||
lower_model_name_or_path
|
||||
and "starling-" in lower_model_name_or_path
|
||||
and "lm" in lower_model_name_or_path
|
||||
)
|
||||
|
||||
def get_str_prompt(
|
||||
self,
|
||||
params: Dict,
|
||||
messages: List[ModelMessage],
|
||||
tokenizer: Any,
|
||||
prompt_template: str = None,
|
||||
convert_to_compatible_format: bool = False,
|
||||
) -> Optional[str]:
|
||||
str_prompt = super().get_str_prompt(
|
||||
params,
|
||||
messages,
|
||||
tokenizer,
|
||||
prompt_template,
|
||||
convert_to_compatible_format,
|
||||
)
|
||||
chat_mode = None
|
||||
if params and "context" in params and "chat_mode" in params["context"]:
|
||||
chat_mode = params["context"].get("chat_mode")
|
||||
if chat_mode in [
|
||||
"chat_dashboard",
|
||||
"chat_with_db_execute",
|
||||
"excel_learning",
|
||||
"chat_excel",
|
||||
]:
|
||||
# Coding conversation, use code prompt
|
||||
# This is a temporary solution, we should use a better way to distinguish the conversation type
|
||||
# https://huggingface.co/Nexusflow/Starling-LM-7B-beta#code-examples
|
||||
str_prompt = str_prompt.replace("GPT4 Correct User:", "Code User:").replace(
|
||||
"GPT4 Correct Assistant:", "Code Assistant:"
|
||||
)
|
||||
logger.info(
|
||||
f"Use code prompt for chat_mode: {chat_mode}, transform 'GPT4 Correct User:' to 'Code User:' "
|
||||
"and 'GPT4 Correct Assistant:' to 'Code Assistant:'"
|
||||
)
|
||||
return str_prompt
|
||||
|
||||
|
||||
register_model_adapter(YiAdapter)
|
||||
register_model_adapter(Mixtral8x7BAdapter)
|
||||
register_model_adapter(SOLARAdapter)
|
||||
register_model_adapter(GemmaAdapter)
|
||||
register_model_adapter(StarlingLMAdapter)
|
||||
|
Loading…
Reference in New Issue
Block a user