Skip to content

Commit 00fac9a

Browse files
authored
Merge pull request #28 from codefuse-ai/modelcache_dev_mm
removed print statements and standardized formatting
2 parents 02c450c + 215b215 commit 00fac9a

30 files changed

+10
-400
lines changed

examples/flask/data_insert.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def run():
1313
headers = {"Content-Type": "application/json"}
1414
res = requests.post(url, headers=headers, json=json.dumps(data))
1515
res_text = res.text
16-
print('res_text: {}'.format(res_text))
1716

1817

1918
if __name__ == '__main__':

examples/flask/data_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def run():
1313
headers = {"Content-Type": "application/json"}
1414
res = requests.post(url, headers=headers, json=json.dumps(data))
1515
res_text = res.text
16-
print('res_text: {}'.format(res_text))
1716

1817

1918
if __name__ == '__main__':

examples/flask/data_query_long.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def run():
1818
headers = {"Content-Type": "application/json"}
1919
res = requests.post(url, headers=headers, json=json.dumps(data))
2020
res_text = res.text
21-
print('res_text: {}'.format(res_text))
2221

2322

2423
if __name__ == '__main__':

examples/flask/register.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def run():
1414
headers = {"Content-Type": "application/json"}
1515
res = requests.post(url, headers=headers, json=json.dumps(data))
1616
res_text = res.text
17-
print('res_text: {}'.format(res_text))
1817

1918

2019
if __name__ == '__main__':

model/clip_zh/__init__.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Alipay.com Inc.
4-
Copyright (c) 2004-2023 All Rights Reserved.
5-
------------------------------------------------------
6-
File Name : __init__.py.py
7-
Author : fuhui.phe
8-
Create Time : 2024/5/7 14:05
9-
Description : description what the main function of this file
10-
Change Activity:
11-
version0 : 2024/5/7 14:05 by fuhui.phe init
12-
"""

modelcache/adapter/adapter_query.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ def adapt_query(cache_data_convert, *args, **kwargs):
3030
report_func=chat_cache.report.embedding,
3131
)(pre_embedding_data)
3232

33-
# print('embedding_data: {}'.format(embedding_data))
34-
3533
if cache_enable:
3634
cache_data_list = time_cal(
3735
chat_cache.data_manager.search,
@@ -43,7 +41,6 @@ def adapt_query(cache_data_convert, *args, **kwargs):
4341
top_k=kwargs.pop("top_k", -1),
4442
model=model
4543
)
46-
print('cache_data_list: {}'.format(cache_data_list))
4744
cache_answers = []
4845
cache_questions = []
4946
cache_ids = []
@@ -81,7 +78,6 @@ def adapt_query(cache_data_convert, *args, **kwargs):
8178
return
8279

8380
for cache_data in cache_data_list:
84-
print('cache_data: {}'.format(cache_data))
8581
primary_id = cache_data[1]
8682
ret = chat_cache.data_manager.get_scalar_data(
8783
cache_data, extra_param=context.get("get_scalar_data", None)

modelcache/adapter/adapter_register.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ def adapt_register(*args, **kwargs):
99
return ValueError('')
1010

1111
register_resp = chat_cache.data_manager.create_index(model)
12-
print('register_resp: {}'.format(register_resp))
1312
return register_resp

modelcache/manager/data_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ def import_data(
212212
cache_datas.append([ans, question, embedding_data, model])
213213

214214
ids = self.s.batch_insert(cache_datas)
215-
print('ids: {}'.format(ids))
216-
logging.info('ids: {}'.format(ids))
217215
self.v.mul_add(
218216
[
219217
VectorData(id=ids[i], data=embedding_data)

modelcache/manager/scalar_data/sql_storage_sqlite.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,10 @@
11
# -*- coding: utf-8 -*-
2-
import os
3-
import time
4-
5-
import pymysql
62
import json
7-
import base64
83
from typing import List
94
from modelcache.manager.scalar_data.base import CacheStorage, CacheData
105
import sqlite3
116

127

13-
# def insert_single_data(conn, sql, data_tuple):
14-
# cur = conn.cursor()
15-
# try:
16-
# cur.execute(sql, data_tuple)
17-
# conn.commit()
18-
# id = cur.lastrowid
19-
# # print('id: {}'.format(id))
20-
# return id
21-
# except Exception as e:
22-
# print(e)
23-
# conn.rollback()
24-
# if cur:
25-
# cur.close()
26-
#
27-
#
28-
# def excute_sql(conn, sql):
29-
# cur = conn.cursor()
30-
# try:
31-
# cur.execute(sql)
32-
# conn.commit()
33-
# except Exception as e:
34-
# print(e)
35-
# conn.rollback()
36-
# if cur:
37-
# cur.close()
38-
#
39-
#
40-
# def excute_delete_sql(conn, sql):
41-
# cur = conn.cursor()
42-
# try:
43-
# cur.execute(sql)
44-
# row_count = cur.rowcount
45-
# conn.commit()
46-
# except Exception as e:
47-
# print(e)
48-
# conn.rollback()
49-
# if cur:
50-
# cur.close()
51-
# return row_count
52-
#
53-
#
54-
# def query_fetch_one_data(conn, sql):
55-
# cursor = conn.cursor()
56-
# try:
57-
# cursor.execute(sql)
58-
# except Exception as e:
59-
# print(e)
60-
# conn.rollback()
61-
# rows = cursor.fetchone()
62-
# if cursor:
63-
# cursor.close()
64-
# return rows
65-
#
66-
#
67-
# def close(conn):
68-
# if conn:
69-
# conn.close()
70-
71-
728
class SQLStorage(CacheStorage):
739
def __init__(
7410
self,

modelcache/manager/vector_data/milvus.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def _get_collection(self, collection_name):
136136

137137
def mul_add(self, datas: List[VectorData], model=None):
138138
collection_name_model = self.collection_name + '_' + model
139-
print('collection_name_model: {}'.format(collection_name_model))
140139
self._create_collection(collection_name_model)
141140

142141
data_array, id_array = map(list, zip(*((data.data, data.id) for data in datas)))
@@ -148,7 +147,6 @@ def search(self, data: np.ndarray, top_k: int = -1, model=None):
148147
if top_k == -1:
149148
top_k = self.top_k
150149
collection_name_model = self.collection_name + '_' + model
151-
print('collection_name_model: {}'.format(collection_name_model))
152150
self._create_collection(collection_name_model)
153151
search_result = self.col.search(
154152
data=data.reshape(1, -1).tolist(),

0 commit comments

Comments
 (0)