Skip to content

Commit

Permalink
fix(service): fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisonooo committed Jan 4, 2024
1 parent 9250816 commit b41c7dc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ frontend/__pycache__/
pk/
badcase.txt
config.bak
config.ini
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ x_api_key = "${YOUR-X-API-KEY}"
# standalone
python3 main.py workdir --standalone
..
ErrorCode.SUCCESS, 要安装 MMDeploy,首先需要准备一个支持 Python 3.6+ 和 PyTorch 1.8+ 的环境。然后,可以通过以下步骤安装 MMDeploy..
ErrorCode.SUCCESS, 请教下视频流检测 跳帧 造成框一闪一闪的 有好的优化办法吗
1. 帧率控制和跳帧策略是优化视频流检测性能的关键,但需要注意跳帧对检测结果的影响。
2. 多线程处理和缓存机制可以提高检测效率,但需要注意检测结果的稳定性。
3. 使用滑动窗口的方式可以减少跳帧和缓存对检测结果的影响。
```

* **docker 用户**。如果你正在使用 docker,`HuixiangDou` 的 Hybrid LLM Service 分离部署
* **docker 用户**。如果你正在使用 docker,`HuixiangDou` 的 Hybrid LLM Service 需要分离部署
```bash
# 启动服务
# 启动 LLM 服务
python3 service/llm_server_hybride.py
```
打开新终端,把 host IP 配置进 `config.ini`,运行
Expand Down
17 changes: 14 additions & 3 deletions service/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def query_source(self, question: str):
docs, _ = self.db_search(question=question.lower())
doc = docs[0]
path = doc['path']
part = doc['data']
part = doc['content']
full = ''
with open(path) as f:
full = f.read()
Expand Down Expand Up @@ -423,7 +423,7 @@ def parse_args():
return args


def test():
def test_reject():
real_questions = [
'请问找不到libmmdeploy.so怎么办', 'SAM 10个T 的训练集,怎么比比较公平呢~?速度上还有缺陷吧?',
'想问下,如果只是推理的话,amp的fp16是不会省显存么,我看parameter仍然是float32,开和不开推理的显存占用都是一样的。能不能直接用把数据和model都 .half() 代替呢,相比之下amp好在哪里',
Expand All @@ -439,7 +439,17 @@ def test():
logger.error(f'reject query: {example}')
else:
logger.warning(f'process query: {example}')
del fs_query

def test_query():
real_questions = [
'视频流检测'
]
fs_query = FeatureStore(config_path=args.config_path)
fs_query.load_feature(work_dir=args.work_dir)
for example in real_questions:
print(fs_query.query_source(example))
del fs_query

if __name__ == '__main__':
args = parse_args()
Expand All @@ -455,4 +465,5 @@ def test():
bad_questions=bad_questions)
del fs_init

test()
test_query()
test_reject()
2 changes: 1 addition & 1 deletion service/sg_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from llm_client import ChatClient
from .llm_client import ChatClient
import os
import ast
import json
Expand Down
2 changes: 1 addition & 1 deletion service/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def generate(self, query, history, groupname):
tracker.log('feature store reject')
return ErrorCode.UNRELATED, response

if self.single_judge(self.SCORING_RELAVANCE_TEMPLATE.format(
if db_context_part is not None and self.single_judge(self.SCORING_RELAVANCE_TEMPLATE.format(
query, db_context_part),
tracker=tracker,
throttle=5,
Expand Down

0 comments on commit b41c7dc

Please sign in to comment.