Skip to content

Commit

Permalink
Adressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adolkhan committed May 11, 2023
1 parent 9f2c5c7 commit ddec666
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deeplake/core/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ def query(

if return_indices_and_scores:
raise ValueError(
"return_indices_and_scores is not supported. Please add `db_engine=True` if you want to return indices and scores"
"return_indices_and_scores is not supported. Please add `runtime = {'db_engine': True}` if you want to return indices and scores"
)

from deeplake.enterprise import query
Expand Down
4 changes: 2 additions & 2 deletions deeplake/core/vectorstore/deeplake_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def delete(
dataset_utils.delete_and_commit(self.dataset, ids)
return True

@classmethod
def force_delete_by_path(cls, path: str) -> None:
@staticmethod
def force_delete_by_path(path: str) -> None:
"""Force delete dataset by path"""
deeplake.delete(path, large_ok=True, force=True)

Expand Down
3 changes: 1 addition & 2 deletions deeplake/core/vectorstore/test_deeplake_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@


@requires_libdeeplake
# @pytest.mark.parametrize("distance_metric", ["L1", "L2", "COS", "MAX", "DOT"])
@pytest.mark.parametrize("distance_metric", ["L2"])
@pytest.mark.parametrize("distance_metric", ["L1", "L2", "COS", "MAX", "DOT"])
def test_search(distance_metric):
k = 4
query_embedding = np.random.randint(0, 255, (1, embedding_dim))
Expand Down
8 changes: 4 additions & 4 deletions deeplake/core/vectorstore/vector_search/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def dataset_exists(dataset_path, token, creds, **kwargs):
def load_dataset(dataset_path, token, creds, logger, read_only, **kwargs):
if dataset_path == DEFAULT_DEEPLAKE_PATH:
logger.warning(
f"Default deeplake path location is used: {DEFAULT_DEEPLAKE_PATH}"
f"The default deeplake path location is used: {DEFAULT_DEEPLAKE_PATH}"
" and it is not free. All addtionally added data will be added on"
" top of already existing deeplake dataset."
)
Expand Down Expand Up @@ -134,9 +134,9 @@ def get_embedding(embedding, query, embedding_function=None):
"Either embedding array or embedding_function should be specified!"
)

if embedding is not None:
always_warn("both embedding and embedding_function are specified. ")
embedding = embedding_function.embed_query(query) # type: ignore
if embedding is not None and embedding_function is not None:
always_warn("both embedding and embedding_function are specified. ")
embedding = embedding_function.embed_query(query) # type: ignore

if embedding.dtype != "float32":
embedding = np.array(embedding, dtype=np.float32)
Expand Down
4 changes: 2 additions & 2 deletions deeplake/core/vectorstore/vector_search/filter/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def dp_filter(x: dict, filter: Dict[str, str]) -> bool:


def attribute_based_filtering(view, filter, exec_option):
filtering_execption(filter=filter, exec_option=exec_option)
filtering_exception(filter=filter, exec_option=exec_option)
# attribute based filtering
if filter is not None:
if isinstance(filter, dict):
Expand All @@ -29,7 +29,7 @@ def attribute_based_filtering(view, filter, exec_option):
return view


def filtering_execption(filter, exec_option):
def filtering_exception(filter, exec_option):
if exec_option in ("indra", "db_engine") and filter is not None:
case_specific_exception = ""
if "db_engine":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"max": lambda a, b: np.linalg.norm(a - b, axis=1, ord=np.inf),
"cos": lambda a, b: np.dot(a, b.T)
/ (np.linalg.norm(a) * np.linalg.norm(b, axis=1)),
"dot": lambda a, b: np.dot(a, b.T),
}


Expand Down

0 comments on commit ddec666

Please sign in to comment.