Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the benchmark result #129

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,6 @@ similarity evaluation func: pair_evaluation (search distance)

| threshold | average time | positive | negative | fail count |
|-----------|--------------|----------|----------|------------|
| 20 | 0.04s | 455 | 27 | 517 |
| 50 | 0.09s | 871 | 86 | 42 |
| 100 | 0.12s | 905 | 93 | 1 |
| 0.95 | 0.12s | 425 | 25 | 549 |
| 0.9 | 0.23s | 804 | 77 | 118 |
| 0.8 | 0.26s | 904 | 92 | 3 |
8 changes: 6 additions & 2 deletions examples/benchmark/benchmark_sqlite_faiss_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def run():
# if rank1 <= 0.5:
# rank2 = evaluation_onnx.evaluation(src_dict, cache_dict, **kwargs)
# return rank2 if rank2 != 0 else 1
# return 0
#
# def range(self):
# return 0.0, 1.0
Expand All @@ -40,16 +41,19 @@ def evaluation(self, src_dict, cache_dict, **kwargs):
return super().evaluation(src_dict, cache_dict, **kwargs)

def range(self):
return 0.0, 1.0
return super().range()

sqlite_file = 'gptcache.db'
sqlite_file = 'sqlite.db'
faiss_file = 'faiss.index'
has_data = os.path.isfile(sqlite_file) and os.path.isfile(faiss_file)

data_manager = get_data_manager('sqlite', 'faiss', dimension=embedding_onnx.dimension, max_size=100000)
cache.init(embedding_func=embedding_onnx.to_embeddings,
data_manager=data_manager,
similarity_evaluation=WrapEvaluation(),
config=Config(
similarity_threshold=0.95
),
)

i = 0
Expand Down
2 changes: 1 addition & 1 deletion gptcache/manager/scalar_data/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SQLDataBase(CacheStorage):
"""
Using sqlalchemy to manage SQLite, PostgreSQL, MySQL, MariaDB, SQL Server and Oracle.
"""
def __init__(self, db_type: str = 'sqlite', url: str = 'sqlite:///./gptcache.db', table_name: str = 'gptcache'):
def __init__(self, db_type: str = 'sqlite', url: str = 'sqlite:///./sqlite.db', table_name: str = 'gptcache'):
self._url = url
self._model = get_model(table_name, db_type)
self._engine = create_engine(self._url)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/common/common_type.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" Initialized parameters """
sqlite_file = 'gptcache.db'
sqlite_file = 'sqlite.db'
faiss_file = 'faiss.index'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def mock_embeddings(data, **kwargs):


def run():
sqlite_file = 'gptcache.db'
sqlite_file = 'sqlite.db'
faiss_file = 'faiss.index'
has_data = os.path.isfile(sqlite_file) and os.path.isfile(faiss_file)
data_manager = get_data_manager('sqlite', 'faiss',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def run():
onnx = Onnx()

sqlite_file = 'gptcache.db'
sqlite_file = 'sqlite.db'
faiss_file = 'faiss.index'
has_data = os.path.isfile(sqlite_file) and os.path.isfile(faiss_file)
data_manager = get_data_manager('sqlite', 'faiss',
Expand Down