mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-16 22:51:24 +00:00
feat(model): Support Qwen2 models (#1612)
This commit is contained in:
@@ -54,6 +54,7 @@ LLM_MODEL_CONFIG = {
|
||||
"chatglm3-6b": os.path.join(MODEL_PATH, "chatglm3-6b"),
|
||||
# https://huggingface.co/THUDM/glm-4-9b-chat
|
||||
"glm-4-9b-chat": os.path.join(MODEL_PATH, "glm-4-9b-chat"),
|
||||
"glm-4-9b-chat-1m": os.path.join(MODEL_PATH, "glm-4-9b-chat-1m"),
|
||||
"guanaco-33b-merged": os.path.join(MODEL_PATH, "guanaco-33b-merged"),
|
||||
"falcon-40b": os.path.join(MODEL_PATH, "falcon-40b"),
|
||||
"gorilla-7b": os.path.join(MODEL_PATH, "gorilla-7b"),
|
||||
@@ -124,6 +125,42 @@ LLM_MODEL_CONFIG = {
|
||||
"codeqwen1.5-7b-chat": os.path.join(MODEL_PATH, "CodeQwen1.5-7B-Chat"),
|
||||
# https://huggingface.co/Qwen/Qwen1.5-MoE-A2.7B-Chat
|
||||
"qwen1.5-moe-a2.7b-chat": os.path.join(MODEL_PATH, "Qwen1.5-MoE-A2.7B-Chat"),
|
||||
"qwen2-57b-a14b-instruct": os.path.join(MODEL_PATH, "Qwen2-57B-A14B-Instruct"),
|
||||
"qwen2-57b-a14b-instruct-gptq-int4": os.path.join(
|
||||
MODEL_PATH, "Qwen2-57B-A14B-Instruct-GPTQ-Int4"
|
||||
),
|
||||
"qwen2-72b-instruct": os.path.join(MODEL_PATH, "Qwen2-72B-Instruct"),
|
||||
"qwen2-72b-instruct-awq": os.path.join(MODEL_PATH, "Qwen2-72B-Instruct-AWQ"),
|
||||
"qwen2-72b-instruct-gptq-int8": os.path.join(
|
||||
MODEL_PATH, "Qwen2-72B-Instruct-GPTQ-Int8"
|
||||
),
|
||||
"qwen2-72b-instruct-gptq-int4": os.path.join(
|
||||
MODEL_PATH, "Qwen2-72B-Instruct-GPTQ-Int4"
|
||||
),
|
||||
"qwen2-7b-instruct": os.path.join(MODEL_PATH, "Qwen2-7B-Instruct"),
|
||||
"qwen2-7b-instruct-awq": os.path.join(MODEL_PATH, "Qwen2-7B-Instruct-AWQ"),
|
||||
"qwen2-7b-instruct-gptq-int8": os.path.join(
|
||||
MODEL_PATH, "Qwen2-7B-Instruct-GPTQ-Int8"
|
||||
),
|
||||
"qwen2-7b-instruct-gptq-int4": os.path.join(
|
||||
MODEL_PATH, "Qwen2-7B-Instruct-GPTQ-Int4"
|
||||
),
|
||||
"qwen2-1.5b-instruct": os.path.join(MODEL_PATH, "Qwen2-1.5B-Instruct"),
|
||||
"qwen2-1.5b-instruct-awq": os.path.join(MODEL_PATH, "Qwen2-1.5B-Instruct-AWQ"),
|
||||
"qwen2-1.5b-instruct-gptq-int8": os.path.join(
|
||||
MODEL_PATH, "Qwen2-1.5B-Instruct-GPTQ-Int8"
|
||||
),
|
||||
"qwen2-1.5b-instruct-gptq-int4": os.path.join(
|
||||
MODEL_PATH, "Qwen2-1.5B-Instruct-GPTQ-Int4"
|
||||
),
|
||||
"qwen2-0.5b-instruct": os.path.join(MODEL_PATH, "Qwen2-0.5B-Instruct"),
|
||||
"qwen2-0.5b-instruct-awq": os.path.join(MODEL_PATH, "Qwen2-0.5B-Instruct-AWQ"),
|
||||
"qwen2-0.5b-instruct-gptq-int8": os.path.join(
|
||||
MODEL_PATH, "Qwen2-0.5B-Instruct-GPTQ-Int8"
|
||||
),
|
||||
"qwen2-0.5b-instruct-gptq-int4": os.path.join(
|
||||
MODEL_PATH, "Qwen2-0.5B-Instruct-GPTQ-Int4"
|
||||
),
|
||||
# (Llama2 based) We only support WizardLM-13B-V1.2 for now, which is trained from Llama-2 13b, see https://huggingface.co/WizardLM/WizardLM-13B-V1.2
|
||||
"wizardlm-13b": os.path.join(MODEL_PATH, "WizardLM-13B-V1.2"),
|
||||
# wget https://huggingface.co/TheBloke/vicuna-13B-v1.5-GGUF/resolve/main/vicuna-13b-v1.5.Q4_K_M.gguf -O models/ggml-model-q4_0.gguf
|
||||
|
@@ -310,6 +310,20 @@ class QwenAdapter(NewHFChatModelAdapter):
|
||||
and "qwen" in lower_model_name_or_path
|
||||
and "1.5" in lower_model_name_or_path
|
||||
and "moe" not in lower_model_name_or_path
|
||||
and "qwen2" not in lower_model_name_or_path
|
||||
)
|
||||
|
||||
|
||||
class Qwen2Adapter(QwenAdapter):
|
||||
|
||||
support_4bit: bool = True
|
||||
support_8bit: bool = True
|
||||
|
||||
def do_match(self, lower_model_name_or_path: Optional[str] = None):
|
||||
return (
|
||||
lower_model_name_or_path
|
||||
and "qwen2" in lower_model_name_or_path
|
||||
and "instruct" in lower_model_name_or_path
|
||||
)
|
||||
|
||||
|
||||
@@ -517,3 +531,4 @@ register_model_adapter(PhiAdapter)
|
||||
register_model_adapter(SQLCoderAdapter)
|
||||
register_model_adapter(OpenChatAdapter)
|
||||
register_model_adapter(GLM4Aapter)
|
||||
register_model_adapter(Qwen2Adapter)
|
||||
|
Reference in New Issue
Block a user