Skip to content

Commit

Permalink
feat(model): Support Qwen1.5-32B (#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc authored Apr 8, 2024
1 parent d4da503 commit df36b94
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 🔥🔥🔥 [Qwen1.5-32B-Chat](https://huggingface.co/Qwen/Qwen1.5-32B-Chat)
- 🔥🔥🔥 [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)
Expand Down
1 change: 1 addition & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
海量模型支持,包括开源、API代理等几十种大语言模型。如LLaMA/LLaMA2、Baichuan、ChatGLM、文心、通义、智谱等。当前已支持如下模型:

- 新增支持模型
- 🔥🔥🔥 [Qwen1.5-32B-Chat](https://huggingface.co/Qwen/Qwen1.5-32B-Chat)
- 🔥🔥🔥 [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)
Expand Down
7 changes: 7 additions & 0 deletions dbgpt/configs/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ def get_device() -> str:
"qwen-1.8b-chat-int8": os.path.join(MODEL_PATH, "wen-1_8B-Chat-Int8"),
# https://huggingface.co/Qwen/Qwen-1_8B-Chat-Int4
"qwen-1.8b-chat-int4": os.path.join(MODEL_PATH, "Qwen-1_8B-Chat-Int4"),
# https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat
"qwen1.5-1.8b-chat": os.path.join(MODEL_PATH, "Qwen1.5-1.8B-Chat"),
"qwen1.5-7b-chat": os.path.join(MODEL_PATH, "Qwen1.5-7B-Chat"),
"qwen1.5-14b-chat": os.path.join(MODEL_PATH, "Qwen1.5-14B-Chat"),
# https://huggingface.co/Qwen/Qwen1.5-32B-Chat
"qwen1.5-32b-chat": os.path.join(MODEL_PATH, "Qwen1.5-32B-Chat"),
"qwen1.5-72b-chat": os.path.join(MODEL_PATH, "Qwen1.5-72B-Chat"),
# (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
Expand Down
25 changes: 25 additions & 0 deletions dbgpt/model/adapter/hf_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,33 @@ def get_str_prompt(
return str_prompt


class QwenAdapter(NewHFChatModelAdapter):
"""
https://huggingface.co/Qwen/Qwen1.5-32B-Chat
TODO: There are problems with quantization.
"""

support_4bit: bool = True
support_8bit: bool = False # TODO: Support 8bit quantization

def check_transformer_version(self, current_version: str) -> None:
if not current_version >= "4.37.0":
raise ValueError(
"Qwen 1.5 require transformers.__version__>=4.37.0, please upgrade your transformers package."
)

def do_match(self, lower_model_name_or_path: Optional[str] = None):
return (
lower_model_name_or_path
and "qwen" in lower_model_name_or_path
and "1.5" in lower_model_name_or_path
)


register_model_adapter(YiAdapter)
register_model_adapter(Mixtral8x7BAdapter)
register_model_adapter(SOLARAdapter)
register_model_adapter(GemmaAdapter)
register_model_adapter(StarlingLMAdapter)
register_model_adapter(QwenAdapter)
7 changes: 4 additions & 3 deletions dbgpt/util/date_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def is_datetime(value):


def convert_datetime_in_row(row):
return [value.strftime('%Y-%m-%d %H:%M:%S') if is_datetime(value)
else value for value in row]

return [
value.strftime("%Y-%m-%d %H:%M:%S") if is_datetime(value) else value
for value in row
]
3 changes: 2 additions & 1 deletion requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ aioresponses
# for git hooks
pre-commit
# Type checking
mypy==1.7.0
mypy==1.7.0
httpx==0.26.0

0 comments on commit df36b94

Please sign in to comment.