From 0a3f0be119a94daf08e7efdb0e6a725b81792c1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E5=9F=B9=E6=96=87=20=28Yang=20Peiwen=29?=
<915505626@qq.com>
Date: Sun, 23 Apr 2023 17:44:11 +0800
Subject: [PATCH] Offline (#28)
* Update download_model.py
* Update download_model.py
* Update base.py
* api
---
download_model.py | 26 ++++++++++++++++----------
predictors/base.py | 2 +-
start_api.bat | 8 ++++++++
start_offline_api.bat | 6 ++++++
4 files changed, 31 insertions(+), 11 deletions(-)
create mode 100644 start_api.bat
create mode 100644 start_offline_api.bat
diff --git a/download_model.py b/download_model.py
index 6a994b5..ef0dae5 100644
--- a/download_model.py
+++ b/download_model.py
@@ -2,19 +2,25 @@
from huggingface_hub import snapshot_download
model_name_list = [
- 'THUDM/chatglm-6b-int4-qe',
+ # 'THUDM/chatglm-6b-int4-qe',
'THUDM/chatglm-6b-int4',
+ 'THUDM/chatglm-6b',
+ # 'THUDM/glm-10b-chinese',
- 'silver/chatglm-6b-int4-qe-slim',
- 'BelleGroup/BELLE-LLAMA-7B-2M-gptq',
- 'BelleGroup/BELLE-7B-gptq',
+ # 'BelleGroup/BELLE-LLAMA-7B-2M-gptq',
+ # 'BelleGroup/BELLE-7B-gptq',
+ # 'BelleGroup/BELLE-LLAMA-7B-2M',
+ # 'BelleGroup/BELLE-7B-2M',
- 'THUDM/chatglm-6b',
- 'THUDM/glm-10b-chinese',
- 'BelleGroup/BELLE-LLAMA-7B-2M',
- 'BelleGroup/BELLE-7B-2M',
- 'silver/chatglm-6b-slim',
- 'silver/chatglm-6b-int4-slim',
+ # 'silver/chatglm-6b-slim',
+ # 'silver/chatglm-6b-int4-slim',
+ # 'silver/chatglm-6b-int4-qe-slim',
+
+ 'fnlp/moss-moon-003-base',
+ 'fnlp/moss-moon-003-sft',
+ 'fnlp/moss-moon-003-sft-plugin',
+ 'fnlp/moss-moon-003-sft-int4',
+ 'fnlp/moss-moon-003-sft-plugin-int4'
]
for model_name in model_name_list:
diff --git a/predictors/base.py b/predictors/base.py
index 49f025a..760e0d8 100644
--- a/predictors/base.py
+++ b/predictors/base.py
@@ -47,7 +47,7 @@ def predict_continue(self, query, latest_message, max_length, top_p,
temperature=temperature):
history[-1] = (history[-1][0], response)
history_colorful = copy.deepcopy(history)
- colorful_response = f'{latest_message}{response[len(latest_message):]}'
+ colorful_response = f'{latest_message}{response[len(latest_message):]}'
history_colorful[-1] = (history_colorful[-1][0], colorful_response)
yield history_colorful, '', ''
if not allow_generate[0]:
diff --git a/start_api.bat b/start_api.bat
new file mode 100644
index 0000000..ea086bb
--- /dev/null
+++ b/start_api.bat
@@ -0,0 +1,8 @@
+@echo off
+
+cd /D "%~dp0"
+
+echo Start app.py
+python app_fastapi.py %*
+
+pause
diff --git a/start_offline_api.bat b/start_offline_api.bat
new file mode 100644
index 0000000..d70c8ee
--- /dev/null
+++ b/start_offline_api.bat
@@ -0,0 +1,6 @@
+@echo off
+
+cd /D "%~dp0"
+
+call env_offline.bat
+call start_api.bat