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

Vector Srore Memory leak Fix #2570

Merged
merged 3 commits into from
Aug 31, 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
1 change: 0 additions & 1 deletion deeplake/core/vectorstore/vector_search/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ def chunk_by_bytes(data, target_byte_size=TARGET_BYTE_SIZE):
chunks.append(current_chunk)
current_chunk = []
current_chunk_size = 0
continue
current_chunk.append(data[index])
current_chunk_size += sizes[index]
index += 1
Expand Down
12 changes: 12 additions & 0 deletions deeplake/core/vectorstore/vector_search/dataset/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,15 @@ def test_chunk_by_bytest():
assert (
byte_size <= 100000 + list_wieght
), "Chunking by bytes did not work as expected!"


def test_chunk_by_bytes():
data = ["a" * 10000] * 10 # 10 chunks of 10000 bytes

batched_data = dataset_utils.chunk_by_bytes(data, target_byte_size=10)
serialized_data = json.dumps(batched_data)
byte_size = len(serialized_data.encode("utf-8"))
list_wieght = 100
assert (
byte_size <= 100000 + list_wieght
), "Chunking by bytes did not work as expected!"
Loading