feat(model): Support Qwen1.5-32B (#1385)

This commit is contained in:
Fangyin Cheng 2024-04-08 09:40:24 +08:00 committed by GitHub
parent d4da50330f
commit df36b947d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 4 deletions

View File

@ -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)

View File

@ -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)

View File

@ -99,6 +99,13 @@ LLM_MODEL_CONFIG = {
"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

View File

@ -246,8 +246,33 @@ class StarlingLMAdapter(NewHFChatModelAdapter):
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)

View File

@ -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
]

View File

@ -13,4 +13,5 @@ aioresponses
# for git hooks
pre-commit
# Type checking
mypy==1.7.0
mypy==1.7.0
httpx==0.26.0