Skip to content

Commit 0cdf175

Browse files
authored
Merge pull request #24 from codefuse-ai/modelcache_dev_fh
Fix remove truncate issue
2 parents 3660a25 + 2cec9ba commit 0cdf175

File tree

7 files changed

+13
-25
lines changed

7 files changed

+13
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ dmypy.json
137137
*.bin
138138
*ini
139139
*.ini
140+
**/modelcache_serving.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Codefuse-ModelCache
2525
- [Acknowledgements](#Acknowledgements)
2626
- [Contributing](#Contributing)
2727
## news
28-
- 🔥🔥[2024.04.09] Added the ability of Redis Search to store and retrieve embeddings in multi-tenant scene, this can reduce the interaction time between Cache and vector databases to 10ms.
28+
- 🔥🔥[2024.04.09] Add Redis Search to store and retrieve embeddings in multi-tenant scene, this can reduce the interaction time between Cache and vector databases to 10ms.
2929
- 🔥🔥[2023.12.10] we integrate LLM embedding frameworks such as 'llmEmb', 'ONNX', 'PaddleNLP', 'FastText', alone with the image embedding framework 'timm', to bolster embedding functionality.
3030
- 🔥🔥[2023.11.20] codefuse-ModelCache has integrated local storage, such as sqlite and faiss, providing users with the convenience of quickly initiating tests.
3131
- [2023.08.26] codefuse-ModelCache...

flask4modelcache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def response_hitquery(cache_resp):
5757
insert_pre_embedding_func=insert_multi_splicing,
5858
)
5959

60-
# cache.set_openai_key()
6160
global executor
6261
executor = ThreadPoolExecutor(max_workers=6)
6362

modelcache/config/milvus_config.ini

Lines changed: 0 additions & 5 deletions
This file was deleted.

modelcache/config/mysql_config.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

modelcache/manager/data_manager.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,21 @@ def create_index(self, model, **kwargs):
260260
return self.v.create(model)
261261

262262
def truncate(self, model_name):
263-
# model = kwargs.pop("model", None)
264-
# drop milvus data
263+
# drop vector base data
265264
try:
266-
resp = self.v.rebuild_col(model_name)
265+
vector_resp = self.v.rebuild_col(model_name)
267266
except Exception as e:
268-
return {'status': 'failed', 'milvus': 'truncate milvus data failed, please check! e: {}'.format(e),
269-
'mysql': 'unexecuted'}
270-
if resp:
271-
return {'status': 'failed', 'milvus': resp, 'mysql': 'unexecuted'}
267+
return {'status': 'failed', 'VectorDB': 'truncate VectorDB data failed, please check! e: {}'.format(e),
268+
'ScalarDB': 'unexecuted'}
269+
if vector_resp:
270+
return {'status': 'failed', 'VectorDB': vector_resp, 'ScalarDB': 'unexecuted'}
271+
# drop scalar base data
272272
try:
273273
delete_count = self.s.model_deleted(model_name)
274274
except Exception as e:
275-
# return 'truncate milvus data failed, please check!'
276-
return {'status': 'failed', 'milvus': 'rebuild',
277-
'mysql': 'truncate mysql data failed, please check! e: {}'.format(e)}
278-
return {'status': 'success', 'milvus': 'rebuild', 'mysql': 'delete_count: ' + str(delete_count)}
275+
return {'status': 'failed', 'VectorDB': 'rebuild',
276+
'ScalarDB': 'truncate scalar data failed, please check! e: {}'.format(e)}
277+
return {'status': 'success', 'VectorDB': 'rebuild', 'ScalarDB': 'delete_count: ' + str(delete_count)}
279278

280279
def flush(self):
281280
self.s.flush()

modelcache/manager/vector_data/redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def rebuild_col(self, model):
124124
self.create_index(index_name_model, index_prefix)
125125
except Exception as e:
126126
raise ValueError(str(e))
127-
return 'rebuild success'
127+
# return 'rebuild success'
128128

129129
def delete(self, ids) -> None:
130130
pipe = self._client.pipeline()

0 commit comments

Comments
 (0)