-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59def83
commit 560c862
Showing
10 changed files
with
133 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
register index for redis | ||
""" | ||
import json | ||
import requests | ||
|
||
|
||
def run(): | ||
url = 'http://127.0.0.1:5000/modelcache' | ||
type = 'register' | ||
scope = {"model": "CODEGPT-1117"} | ||
data = {'type': type, 'scope': scope} | ||
headers = {"Content-Type": "application/json"} | ||
res = requests.post(url, headers=headers, json=json.dumps(data)) | ||
res_text = res.text | ||
print('res_text: {}'.format(res_text)) | ||
|
||
|
||
if __name__ == '__main__': | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
from modelcache import cache | ||
|
||
|
||
def adapt_register(*args, **kwargs): | ||
chat_cache = kwargs.pop("cache_obj", cache) | ||
model = kwargs.pop("model", None) | ||
if model is None or len(model) == 0: | ||
return ValueError('') | ||
|
||
register_resp = chat_cache.data_manager.create_index(model) | ||
print('register_resp: {}'.format(register_resp)) | ||
return register_resp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
def get_index_name(model): | ||
return 'modelcache' + '_' + model | ||
|
||
|
||
def get_index_prefix(model): | ||
return 'prefix' + '_' + model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ Requests==2.31.0 | |
torch==2.1.0 | ||
transformers==4.34.1 | ||
faiss-cpu==1.7.4 | ||
redis==5.0.1 | ||
|