-
Notifications
You must be signed in to change notification settings - Fork 631
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
Showing
6 changed files
with
163 additions
and
49 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 |
---|---|---|
|
@@ -191,3 +191,4 @@ | |
TRANSFORM_CHUNK_CACHE_SIZE = 64 * MB | ||
|
||
DEFAULT_DEEPLAKE_PATH = "./deeplake_vector_store" | ||
MAX_RETRY_ATTEMPTS = 5 |
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
39 changes: 39 additions & 0 deletions
39
deeplake/core/vectorstore/vector_search/ingestion/ingest_data.py
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,39 @@ | ||
from typing import Dict, List, Any, Callable | ||
|
||
from deeplake.core.dataset import Dataset as DeepLakeDataset | ||
from deeplake.core.vectorstore.vector_search.ingestion.data_ingestion import ( | ||
DataIngestion, | ||
) | ||
|
||
|
||
def run_data_ingestion( | ||
elements: List[Dict[str, Any]], | ||
dataset: DeepLakeDataset, | ||
embedding_function: Callable, | ||
ingestion_batch_size: int, | ||
num_workers: int, | ||
retry_attempt: int = 0, | ||
total_samples_processed=None, | ||
): | ||
"""Running data ingestion into deeplake dataset. | ||
Args: | ||
elements (List[Dict[str, Any]]): List of dictionaries. Each dictionary contains mapping of | ||
names of 4 tensors (i.e. "embedding", "metadata", "ids", "text") to their corresponding values. | ||
dataset (DeepLakeDataset): deeplake dataset object. | ||
embedding_function (Callable): function used to convert query into an embedding. | ||
ingestion_batch_size (int): The batch size to use during ingestion. | ||
num_workers (int): The number of workers to use for ingesting data in parallel. | ||
""" | ||
|
||
data_ingestion = DataIngestion( | ||
elements=elements, | ||
dataset=dataset, | ||
embedding_function=embedding_function, | ||
ingestion_batch_size=ingestion_batch_size, | ||
num_workers=num_workers, | ||
retry_attempt=retry_attempt, | ||
total_samples_processed=total_samples_processed, | ||
) | ||
|
||
data_ingestion.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