diff --git a/.gitignore b/.gitignore index 7d4090f..bb9ceec 100644 --- a/.gitignore +++ b/.gitignore @@ -27,9 +27,6 @@ share/python-wheels/ *.egg MANIFEST *.DS_Store -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec @@ -85,14 +82,6 @@ ipython_config.py # pyenv .python-version -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff diff --git a/README.md b/README.md index 71740bb..1db2475 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ res = requests.post(url, headers=headers, json=json.dumps(data)) ## Articles https://mp.weixin.qq.com/s/ExIRu2o7yvXa6nNLZcCfhQ ## modules -![modelcache modules](docs/modelcache_modules_20231114.png) +![modelcache modules](docs/modelcache_modules_20240409.png) ## Function-Comparison In terms of functionality, we have made several changes to the git repository. Firstly, we have addressed the network issues with huggingface and enhanced the inference speed by introducing local inference capabilities for embeddings. Additionally, considering the limitations of the SqlAlchemy framework, we have completely revamped the module responsible for interacting with relational databases, enabling more flexible database operations. In practical scenarios, LLM products often require integration with multiple users and multiple models. Hence, we have added support for multi-tenancy in the ModelCache, while also making preliminary compatibility adjustments for system commands and multi-turn dialogue. diff --git a/README_CN.md b/README_CN.md index 18d3ea5..f552270 100644 --- a/README_CN.md +++ b/README_CN.md @@ -100,7 +100,7 @@ res = requests.post(url, headers=headers, json=json.dumps(data)) ## 文章 https://mp.weixin.qq.com/s/ExIRu2o7yvXa6nNLZcCfhQ ## 架构大图 -![modelcache modules](docs/modelcache_modules_20231114.png) +![modelcache modules](docs/modelcache_modules_20240409.png) ## 功能对比 功能方面,为了解决huggingface网络问题并提升推理速度,增加了embedding本地推理能力。鉴于SqlAlchemy框架存在一些限制,我们对关系数据库交互模块进行了重写,以更灵活地实现数据库操作。在实践中,大型模型产品需要与多个用户和多个模型对接,因此在ModelCache中增加了对多租户的支持,同时也初步兼容了系统指令和多轮会话。 diff --git a/docs/modelcache_modules_20240409.png b/docs/modelcache_modules_20240409.png new file mode 100644 index 0000000..e7c4442 Binary files /dev/null and b/docs/modelcache_modules_20240409.png differ diff --git a/flask4modelcache_demo.py b/flask4modelcache_demo.py index 66ce8b0..dc163b5 100644 --- a/flask4modelcache_demo.py +++ b/flask4modelcache_demo.py @@ -166,4 +166,5 @@ def user_backend(): if __name__ == '__main__': - app.run(host='0.0.0.0', port=5000, debug=True) + # app.run(host='0.0.0.0', port=5000, debug=True) + app.run(host='0.0.0.0', port=5000) diff --git a/model/text2vec-base-chinese/logs.txt b/model/text2vec-base-chinese/logs.txt index 1f2f0a8..8b13789 100644 --- a/model/text2vec-base-chinese/logs.txt +++ b/model/text2vec-base-chinese/logs.txt @@ -1,19 +1 @@ -Epoch:0 Valid| corr: 0.794410 -Epoch:0 Valid| corr: 0.691819 -Epoch:1 Valid| corr: 0.722749 -Epoch:2 Valid| corr: 0.735054 -Epoch:3 Valid| corr: 0.738295 -Epoch:4 Valid| corr: 0.739411 -Test | corr: 0.679971 -Epoch:0 Valid| corr: 0.817416 -Epoch:1 Valid| corr: 0.832376 -Epoch:2 Valid| corr: 0.842308 -Epoch:3 Valid| corr: 0.843520 -Epoch:4 Valid| corr: 0.841837 -Test | corr: 0.793495 -Epoch:0 Valid| corr: 0.814648 -Epoch:1 Valid| corr: 0.831609 -Epoch:2 Valid| corr: 0.841678 -Epoch:3 Valid| corr: 0.842387 -Epoch:4 Valid| corr: 0.841435 -Test | corr: 0.794840 + diff --git a/reference_doc/create_table.sql b/reference_doc/create_table.sql index 727d52f..7c00be9 100644 --- a/reference_doc/create_table.sql +++ b/reference_doc/create_table.sql @@ -11,6 +11,7 @@ CREATE TABLE `modelcache_llm_answer` ( PRIMARY KEY(`id`) ) AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = 'modelcache_llm_answer'; + CREATE TABLE `modelcache_query_log` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT comment '主键', `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment '创建时间',