mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-31 08:33:36 +00:00
feat(model): Support DeepSeek v2 lite model (#1537)
This commit is contained in:
@@ -184,6 +184,7 @@ LLM_MODEL_CONFIG = {
|
||||
# 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"),
|
||||
"deepseek-v2-lite-chat": os.path.join(MODEL_PATH, "DeepSeek-V2-Lite-Chat"),
|
||||
}
|
||||
|
||||
EMBEDDING_MODEL_CONFIG = {
|
||||
|
@@ -370,6 +370,32 @@ class Llama3Adapter(NewHFChatModelAdapter):
|
||||
return str_prompt
|
||||
|
||||
|
||||
class DeepseekV2Adapter(NewHFChatModelAdapter):
|
||||
support_4bit: bool = False
|
||||
support_8bit: bool = False
|
||||
|
||||
def do_match(self, lower_model_name_or_path: Optional[str] = None):
|
||||
return (
|
||||
lower_model_name_or_path
|
||||
and "deepseek" in lower_model_name_or_path
|
||||
and "v2" in lower_model_name_or_path
|
||||
and "chat" in lower_model_name_or_path
|
||||
)
|
||||
|
||||
def load(self, model_path: str, from_pretrained_kwargs: dict):
|
||||
if not from_pretrained_kwargs:
|
||||
from_pretrained_kwargs = {}
|
||||
if "trust_remote_code" not in from_pretrained_kwargs:
|
||||
from_pretrained_kwargs["trust_remote_code"] = True
|
||||
model, tokenizer = super().load(model_path, from_pretrained_kwargs)
|
||||
|
||||
from transformers import GenerationConfig
|
||||
|
||||
model.generation_config = GenerationConfig.from_pretrained(model_path)
|
||||
model.generation_config.pad_token_id = model.generation_config.eos_token_id
|
||||
return model, tokenizer
|
||||
|
||||
|
||||
# The following code is used to register the model adapter
|
||||
# The last registered model adapter is matched first
|
||||
register_model_adapter(YiAdapter)
|
||||
@@ -381,3 +407,4 @@ register_model_adapter(StarlingLMAdapter)
|
||||
register_model_adapter(QwenAdapter)
|
||||
register_model_adapter(QwenMoeAdapter)
|
||||
register_model_adapter(Llama3Adapter)
|
||||
register_model_adapter(DeepseekV2Adapter)
|
||||
|
@@ -41,7 +41,7 @@ clone_repositories() {
|
||||
}
|
||||
|
||||
install_dbgpt_packages() {
|
||||
conda activate dbgpt && cd /root/DB-GPT && pip install -e ".[default]"
|
||||
conda activate dbgpt && cd /root/DB-GPT && pip install -e ".[default]" && pip install transformers_stream_generator einops
|
||||
cp .env.template .env && sed -i 's/LLM_MODEL=vicuna-13b-v1.5/LLM_MODEL=qwen-1.8b-chat/' .env
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user