add configs
Browse files
configs/__pycache__/model_config.cpython-39.pyc
ADDED
Binary file (4.7 kB). View file
|
|
configs/model_config.py
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch.cuda
|
2 |
+
import torch.backends
|
3 |
+
import os
|
4 |
+
import logging
|
5 |
+
import uuid
|
6 |
+
|
7 |
+
LOG_FORMAT = "%(levelname) -5s %(asctime)s" "-1d: %(message)s"
|
8 |
+
logger = logging.getLogger()
|
9 |
+
logger.setLevel(logging.INFO)
|
10 |
+
logging.basicConfig(format=LOG_FORMAT)
|
11 |
+
|
12 |
+
# 在以下字典中修改属性值,以指定本地embedding模型存储位置
|
13 |
+
# 如将 "text2vec": "GanymedeNil/text2vec-large-chinese" 修改为 "text2vec": "User/Downloads/text2vec-large-chinese"
|
14 |
+
# 此处请写绝对路径
|
15 |
+
embedding_model_dict = {
|
16 |
+
"ernie-tiny": "nghuyong/ernie-3.0-nano-zh",
|
17 |
+
"ernie-base": "nghuyong/ernie-3.0-base-zh",
|
18 |
+
"text2vec-base": "shibing624/text2vec-base-chinese",
|
19 |
+
"text2vec": "/home/wsy/Langchain-chat/embedding/text2vec-large-chinese",
|
20 |
+
"text2vec-base-multilingual": "shibing624/text2vec-base-multilingual",
|
21 |
+
"text2vec-base-chinese-sentence": "shibing624/text2vec-base-chinese-sentence",
|
22 |
+
"text2vec-base-chinese-paraphrase": "shibing624/text2vec-base-chinese-paraphrase",
|
23 |
+
"m3e-small": "moka-ai/m3e-small",
|
24 |
+
"m3e-base": "moka-ai/m3e-base",
|
25 |
+
}
|
26 |
+
|
27 |
+
# Embedding model name
|
28 |
+
EMBEDDING_MODEL = "text2vec"
|
29 |
+
|
30 |
+
# Embedding running device
|
31 |
+
EMBEDDING_DEVICE = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
|
32 |
+
|
33 |
+
# supported LLM models
|
34 |
+
# llm_model_dict 处理了loader的一些预设行为,如加载位置,模型名称,模型处理器实例
|
35 |
+
# 在以下字典中修改属性值,以指定本地 LLM 模型存储位置
|
36 |
+
# 如将 "chatglm-6b" 的 "local_model_path" 由 None 修改为 "User/Downloads/chatglm-6b"
|
37 |
+
# 此处请写绝对路径,且路径中必须包含repo-id的模型名称,因为FastChat是以模型名匹配的
|
38 |
+
llm_model_dict = {
|
39 |
+
"chatglm-6b-int4-qe": {
|
40 |
+
"name": "chatglm-6b-int4-qe",
|
41 |
+
"pretrained_model_name": "THUDM/chatglm-6b-int4-qe",
|
42 |
+
"local_model_path": None,
|
43 |
+
"provides": "ChatGLMLLMChain"
|
44 |
+
},
|
45 |
+
"chatglm-6b-int4": {
|
46 |
+
"name": "chatglm-6b-int4",
|
47 |
+
"pretrained_model_name": "THUDM/chatglm-6b-int4",
|
48 |
+
"local_model_path": None,
|
49 |
+
"provides": "ChatGLMLLMChain"
|
50 |
+
},
|
51 |
+
"chatglm-6b-int8": {
|
52 |
+
"name": "chatglm-6b-int8",
|
53 |
+
"pretrained_model_name": "THUDM/chatglm-6b-int8",
|
54 |
+
"local_model_path": None,
|
55 |
+
"provides": "ChatGLMLLMChain"
|
56 |
+
},
|
57 |
+
"chatglm-6b": {
|
58 |
+
"name": "chatglm-6b",
|
59 |
+
"pretrained_model_name": "THUDM/chatglm-6b",
|
60 |
+
"local_model_path": None,
|
61 |
+
"provides": "ChatGLMLLMChain"
|
62 |
+
},
|
63 |
+
# langchain-ChatGLM 用户“帛凡” @BoFan-tunning 基于ChatGLM-6B 训练并提供的权重合并模型和 lora 权重文件 chatglm-fitness-RLHF
|
64 |
+
# 详细信息见 HuggingFace 模型介绍页 https://huggingface.co/fb700/chatglm-fitness-RLHF
|
65 |
+
# 使用该模型或者lora权重文件,对比chatglm-6b、chatglm2-6b、百川7b,甚至其它未经过微调的更高参数的模型,在本项目中,总结能力可获得显著提升。
|
66 |
+
"chatglm-fitness-RLHF": {
|
67 |
+
"name": "chatglm-fitness-RLHF",
|
68 |
+
"pretrained_model_name": "/home/wsy/chatglm-fitness-RLHF",
|
69 |
+
"local_model_path": None,
|
70 |
+
"provides": "ChatGLMLLMChain"
|
71 |
+
},
|
72 |
+
"chatglm2-6b": {
|
73 |
+
"name": "chatglm2-6b",
|
74 |
+
"pretrained_model_name": "/home/xwy/chatglm2-6b",
|
75 |
+
"local_model_path": None,
|
76 |
+
"provides": "ChatGLMLLMChain"
|
77 |
+
},
|
78 |
+
"chatglm2-6b-32k": {
|
79 |
+
"name": "chatglm2-6b-32k",
|
80 |
+
"pretrained_model_name": "THUDM/chatglm2-6b-32k",
|
81 |
+
"local_model_path": None,
|
82 |
+
"provides": "ChatGLMLLMChain"
|
83 |
+
},
|
84 |
+
# 注:chatglm2-cpp已在mac上测试通过,其他系统暂不支持
|
85 |
+
"chatglm2-cpp": {
|
86 |
+
"name": "chatglm2-cpp",
|
87 |
+
"pretrained_model_name": "cylee0909/chatglm2cpp",
|
88 |
+
"local_model_path": None,
|
89 |
+
"provides": "ChatGLMCppLLMChain"
|
90 |
+
},
|
91 |
+
"chatglm2-6b-int4": {
|
92 |
+
"name": "chatglm2-6b-int4",
|
93 |
+
"pretrained_model_name": "THUDM/chatglm2-6b-int4",
|
94 |
+
"local_model_path": None,
|
95 |
+
"provides": "ChatGLMLLMChain"
|
96 |
+
},
|
97 |
+
"chatglm2-6b-int8": {
|
98 |
+
"name": "chatglm2-6b-int8",
|
99 |
+
"pretrained_model_name": "THUDM/chatglm2-6b-int8",
|
100 |
+
"local_model_path": None,
|
101 |
+
"provides": "ChatGLMLLMChain"
|
102 |
+
},
|
103 |
+
"chatyuan": {
|
104 |
+
"name": "chatyuan",
|
105 |
+
"pretrained_model_name": "ClueAI/ChatYuan-large-v2",
|
106 |
+
"local_model_path": None,
|
107 |
+
"provides": "MOSSLLMChain"
|
108 |
+
},
|
109 |
+
"moss": {
|
110 |
+
"name": "moss",
|
111 |
+
"pretrained_model_name": "fnlp/moss-moon-003-sft",
|
112 |
+
"local_model_path": None,
|
113 |
+
"provides": "MOSSLLMChain"
|
114 |
+
},
|
115 |
+
"moss-int4": {
|
116 |
+
"name": "moss",
|
117 |
+
"pretrained_model_name": "fnlp/moss-moon-003-sft-int4",
|
118 |
+
"local_model_path": None,
|
119 |
+
"provides": "MOSSLLM"
|
120 |
+
},
|
121 |
+
"vicuna-13b-hf": {
|
122 |
+
"name": "vicuna-13b-hf",
|
123 |
+
"pretrained_model_name": "vicuna-13b-hf",
|
124 |
+
"local_model_path": None,
|
125 |
+
"provides": "LLamaLLMChain"
|
126 |
+
},
|
127 |
+
"vicuna-7b-hf": {
|
128 |
+
"name": "vicuna-13b-hf",
|
129 |
+
"pretrained_model_name": "vicuna-13b-hf",
|
130 |
+
"local_model_path": None,
|
131 |
+
"provides": "LLamaLLMChain"
|
132 |
+
},
|
133 |
+
# 直接调用返回requests.exceptions.ConnectionError错误,需要通过huggingface_hub包里的snapshot_download函数
|
134 |
+
# 下载模型,如果snapshot_download还是返回网络错误,多试几次,一般是可以的,
|
135 |
+
# 如果仍然不行,则应该是网络加了防火墙(在服务器上这种情况比较常见),基本只能从别的设备上下载,
|
136 |
+
# 然后转移到目标设备了.
|
137 |
+
"bloomz-7b1": {
|
138 |
+
"name": "bloomz-7b1",
|
139 |
+
"pretrained_model_name": "bigscience/bloomz-7b1",
|
140 |
+
"local_model_path": None,
|
141 |
+
"provides": "MOSSLLMChain"
|
142 |
+
|
143 |
+
},
|
144 |
+
# 实测加载bigscience/bloom-3b需要170秒左右,暂不清楚为什么这么慢
|
145 |
+
# 应与它要加载专有token有关
|
146 |
+
"bloom-3b": {
|
147 |
+
"name": "bloom-3b",
|
148 |
+
"pretrained_model_name": "bigscience/bloom-3b",
|
149 |
+
"local_model_path": None,
|
150 |
+
"provides": "MOSSLLMChain"
|
151 |
+
|
152 |
+
},
|
153 |
+
"baichuan-7b": {
|
154 |
+
"name": "baichuan-7b",
|
155 |
+
"pretrained_model_name": "/home/wsy/baichuan7b-chat",
|
156 |
+
"local_model_path": None,
|
157 |
+
"provides": "MOSSLLMChain"
|
158 |
+
},
|
159 |
+
"Baichuan-13b-Chat": {
|
160 |
+
"name": "Baichuan-13b-Chat",
|
161 |
+
"pretrained_model_name": "baichuan-inc/Baichuan-13b-Chat",
|
162 |
+
"local_model_path": None,
|
163 |
+
"provides": "BaichuanLLMChain"
|
164 |
+
},
|
165 |
+
# llama-cpp模型的兼容性问题参考https://github.com/abetlen/llama-cpp-python/issues/204
|
166 |
+
"ggml-vicuna-13b-1.1-q5": {
|
167 |
+
"name": "ggml-vicuna-13b-1.1-q5",
|
168 |
+
"pretrained_model_name": "lmsys/vicuna-13b-delta-v1.1",
|
169 |
+
# 这里需要下载好模型的路径,如果下载模型是默认路径则它会下载到用户工作区的
|
170 |
+
# /.cache/huggingface/hub/models--vicuna--ggml-vicuna-13b-1.1/
|
171 |
+
# 还有就是由于本项目加载模型的方式设置的比较严格,下载完成后仍需手动修改模型的文件名
|
172 |
+
# 将其设置为与Huggface Hub一致的文件名
|
173 |
+
# 此外不同时期的ggml格式并不兼容,因此不同时期的ggml需要安装不同的llama-cpp-python库,且实测pip install 不好使
|
174 |
+
# 需要手动从https://github.com/abetlen/llama-cpp-python/releases/tag/下载对应的wheel安装
|
175 |
+
# 实测v0.1.63与本模型的vicuna/ggml-vicuna-13b-1.1/ggml-vic13b-q5_1.bin可以兼容
|
176 |
+
"local_model_path": f'''{"/".join(os.path.abspath(__file__).split("/")[:3])}/.cache/huggingface/hub/models--vicuna--ggml-vicuna-13b-1.1/blobs/''',
|
177 |
+
"provides": "LLamaLLMChain"
|
178 |
+
},
|
179 |
+
|
180 |
+
# 通过 fastchat 调用的模型请参考如下格式
|
181 |
+
"fastchat-chatglm-6b": {
|
182 |
+
"name": "chatglm-6b", # "name"修改为fastchat服务中的"model_name"
|
183 |
+
"pretrained_model_name": "chatglm-6b",
|
184 |
+
"local_model_path": None,
|
185 |
+
"provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain"
|
186 |
+
"api_base_url": "http://localhost:8000/v1", # "name"修改为fastchat服务中的"api_base_url"
|
187 |
+
"api_key": "EMPTY"
|
188 |
+
},
|
189 |
+
# 通过 fastchat 调用的模型请参考如下格式
|
190 |
+
"fastchat-chatglm-6b-int4": {
|
191 |
+
"name": "chatglm-6b-int4", # "name"修改为fastchat服务中的"model_name"
|
192 |
+
"pretrained_model_name": "chatglm-6b-int4",
|
193 |
+
"local_model_path": None,
|
194 |
+
"provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain"
|
195 |
+
"api_base_url": "http://localhost:8001/v1", # "name"修改为fastchat服务中的"api_base_url"
|
196 |
+
"api_key": "EMPTY"
|
197 |
+
},
|
198 |
+
"fastchat-chatglm2-6b": {
|
199 |
+
"name": "chatglm2-6b", # "name"修改为fastchat服务中的"model_name"
|
200 |
+
"pretrained_model_name": "chatglm2-6b",
|
201 |
+
"local_model_path": None,
|
202 |
+
"provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain"
|
203 |
+
"api_base_url": "http://localhost:8000/v1" # "name"修改为fastchat服务中的"api_base_url"
|
204 |
+
},
|
205 |
+
|
206 |
+
# 通过 fastchat 调用的模型请参考如下格式
|
207 |
+
"fastchat-vicuna-13b-hf": {
|
208 |
+
"name": "vicuna-13b-hf", # "name"修改为fastchat服务中的"model_name"
|
209 |
+
"pretrained_model_name": "vicuna-13b-hf",
|
210 |
+
"local_model_path": None,
|
211 |
+
"provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain"
|
212 |
+
"api_base_url": "http://localhost:8000/v1", # "name"修改为fastchat服务中的"api_base_url"
|
213 |
+
"api_key": "EMPTY"
|
214 |
+
},
|
215 |
+
|
216 |
+
"fastchat-baichuan2-7b-chat": {
|
217 |
+
"name": "Baichuan2-7B-chat", # "name"修改为fastchat服务中的"model_name"
|
218 |
+
"pretrained_model_name": "Baichuan2-7B-chat",
|
219 |
+
"local_model_path": None,
|
220 |
+
"provides": "FastChatOpenAILLMChain", # 使用fastchat api时,需保证"provides"为"FastChatOpenAILLMChain"
|
221 |
+
"api_base_url": "http://localhost:8000/v1", # "name"修改为fastchat服务中的"api_base_url"
|
222 |
+
"api_key": "EMPTY"
|
223 |
+
},
|
224 |
+
# 调用chatgpt时如果报出: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.openai.com', port=443):
|
225 |
+
# Max retries exceeded with url: /v1/chat/completions
|
226 |
+
# 则需要将urllib3版本修改为1.25.11
|
227 |
+
# 如果依然报urllib3.exceptions.MaxRetryError: HTTPSConnectionPool,则将https改为http
|
228 |
+
# 参考https://zhuanlan.zhihu.com/p/350015032
|
229 |
+
|
230 |
+
# 如果报出:raise NewConnectionError(
|
231 |
+
# urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001FE4BDB85E0>:
|
232 |
+
# Failed to establish a new connection: [WinError 10060]
|
233 |
+
# 则是因为内地和香港的IP都被OPENAI封了,需要切换为日本、新加坡等地
|
234 |
+
"openai-chatgpt-3.5": {
|
235 |
+
"name": "gpt-3.5-turbo",
|
236 |
+
"pretrained_model_name": "gpt-3.5-turbo",
|
237 |
+
"provides": "FastChatOpenAILLMChain",
|
238 |
+
"local_model_path": None,
|
239 |
+
"api_base_url": "https://openai.api2d.net/v1",
|
240 |
+
"api_key": "fk216618-f39L8P2msSmhydRuG51oDh1aDG0CklUV"
|
241 |
+
},
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
# LLM 名称
|
246 |
+
LLM_MODEL = "openai-chatgpt-3.5"
|
247 |
+
# 量化加载8bit 模型
|
248 |
+
LOAD_IN_8BIT = False
|
249 |
+
# Load the model with bfloat16 precision. Requires NVIDIA Ampere GPU.
|
250 |
+
BF16 = False
|
251 |
+
# 本地lora存放的位置
|
252 |
+
LORA_DIR = "loras/"
|
253 |
+
|
254 |
+
# LORA的名称,如有请指定为列表
|
255 |
+
|
256 |
+
LORA_NAME = ""
|
257 |
+
USE_LORA = True if LORA_NAME else False
|
258 |
+
|
259 |
+
# LLM streaming reponse
|
260 |
+
STREAMING = True
|
261 |
+
|
262 |
+
# 直接定义baichuan的lora完整路径即可
|
263 |
+
LORA_MODEL_PATH_BAICHUAN=""
|
264 |
+
|
265 |
+
# Use p-tuning-v2 PrefixEncoder
|
266 |
+
USE_PTUNING_V2 = False
|
267 |
+
PTUNING_DIR='./ptuning-v2'
|
268 |
+
# LLM running device
|
269 |
+
LLM_DEVICE = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
|
270 |
+
|
271 |
+
# 知识库默认存储路径
|
272 |
+
KB_ROOT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "knowledge_base")
|
273 |
+
|
274 |
+
# 基于上下文的prompt模版,请务必保留"{question}"和"{context}"
|
275 |
+
PROMPT_TEMPLATE = """已知信息:
|
276 |
+
{context}
|
277 |
+
|
278 |
+
你将作为一个python助教, 服务于大学一年级的python基础课堂, 请你根据上述已知信息,简洁和专业的来回答学生们的问题。如果无法从中得到答案,请说 “根据已知信息无法回答该问题” 或 “没有提供足够的相关信息”,不允许在答案中添加编造成分,答案请使用中文,如果不清晰的可以使用带注释的代码解释。 问题是:{question}"""
|
279 |
+
|
280 |
+
# 缓存知识库数量,如果是ChatGLM2,ChatGLM2-int4,ChatGLM2-int8模型若检索效果不好可以调成’10’
|
281 |
+
CACHED_VS_NUM = 2
|
282 |
+
|
283 |
+
# 文本分句长度
|
284 |
+
SENTENCE_SIZE = 130
|
285 |
+
|
286 |
+
# 匹配后单段上下文长度s
|
287 |
+
CHUNK_SIZE = 350
|
288 |
+
|
289 |
+
# 传入LLM的历史记录长度
|
290 |
+
LLM_HISTORY_LEN = 3
|
291 |
+
|
292 |
+
# 知识库检索时返回的匹配内容条数
|
293 |
+
VECTOR_SEARCH_TOP_K = 2
|
294 |
+
|
295 |
+
# 知识检索内容相关度 Score, 数值范围约为0-1100,如果为0,则不生效,建议设置为500左右,经测试设置为小于500时,匹配结果更精准
|
296 |
+
VECTOR_SEARCH_SCORE_THRESHOLD = 500
|
297 |
+
|
298 |
+
NLTK_DATA_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "nltk_data")
|
299 |
+
|
300 |
+
# FLAG_USER_NAME = uuid.uuid4().hex
|
301 |
+
FLAG_USER_NAME = "王思源"
|
302 |
+
|
303 |
+
logger.info(f"""
|
304 |
+
loading model config
|
305 |
+
llm device: {LLM_DEVICE}
|
306 |
+
embedding device: {EMBEDDING_DEVICE}
|
307 |
+
dir: {os.path.dirname(os.path.dirname(__file__))}
|
308 |
+
flagging username: {FLAG_USER_NAME}
|
309 |
+
""")
|
310 |
+
|
311 |
+
# 是否开启跨域,默认为False,如果需要开启,请设置为True
|
312 |
+
# is open cross domain
|
313 |
+
OPEN_CROSS_DOMAIN = False
|
314 |
+
|
315 |
+
# Bing 搜索必备变量
|
316 |
+
# 使用 Bing 搜索需要使用 Bing Subscription Key,需要在azure port中申请试用bing search
|
317 |
+
# 具体申请方式请见
|
318 |
+
# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource
|
319 |
+
# 使用python创建bing api 搜索实例详见:
|
320 |
+
# https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/quickstarts/rest/python
|
321 |
+
BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"
|
322 |
+
# 注意不是bing Webmaster Tools的api key,
|
323 |
+
|
324 |
+
# 此外,如果是在服务器上,报Failed to establish a new connection: [Errno 110] Connection timed out
|
325 |
+
# 是因为服务器加了防火墙,需要联系管理员加白名单,如果公司的服务器的话,就别想了GG
|
326 |
+
BING_SUBSCRIPTION_KEY = ""
|
327 |
+
|
328 |
+
# 是否开启中文标题加强,以及标题增强的相关配置
|
329 |
+
# 通过增加标题判断,判断哪些文本为标题,并在metadata中进行标记;
|
330 |
+
# 然后将文本与往上一级的标题进行拼合,实现文本信息的增强。
|
331 |
+
ZH_TITLE_ENHANCE = True
|