-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- allow custom details for indexing in yaml format based on ingestion data store config - add accessory flags and functions to map and parse the provided repo approriately - Allow for serving of the index via "WANDB_INDEX_ARTIFACT" env var
- Loading branch information
Showing
7 changed files
with
168 additions
and
7 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
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 |
---|---|---|
@@ -1,22 +1,37 @@ | ||
import argparse | ||
import os | ||
import pathlib | ||
|
||
from wandbot.ingestion import prepare_data, vectorstores | ||
from wandbot.ingestion.report import create_ingestion_report | ||
from wandbot.ingestion.utils import load_custom_dataset_configs_from_yaml | ||
from wandbot.utils import get_logger | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
def main(): | ||
def main(custom: bool, custom_dataset_config_yaml: pathlib.Path): | ||
project = os.environ.get("WANDB_PROJECT", "wandbot-dev") | ||
entity = os.environ.get("WANDB_ENTITY", "wandbot") | ||
|
||
raw_artifact = prepare_data.load(project, entity) | ||
if custom and custom_dataset_config_yaml.is_file(): | ||
configs = load_custom_dataset_configs_from_yaml(custom_dataset_config_yaml) | ||
#TODO: Add the full list of configs as opposed to limiting to one | ||
#TODO: Add the ability to define which dataloader to use in the config yaml itself | ||
config = configs[0] | ||
raw_artifact = prepare_data.load_custom(project, entity, "custom_raw_dataset", config, "docodile") | ||
else: | ||
raw_artifact = prepare_data.load(project, entity) | ||
vectorstore_artifact = vectorstores.load(project, entity, raw_artifact) | ||
# TODO: include ingestion report | ||
create_ingestion_report(project, entity, raw_artifact, vectorstore_artifact) | ||
print(vectorstore_artifact) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
parser = argparse.ArgumentParser(description='Process some integers.') | ||
parser.add_argument('--custom', type=bool, default=True, | ||
help='Flag for ingesting a custom dataset') | ||
parser.add_argument('--custom_dataset_config_yaml', type=pathlib.Path, | ||
default=pathlib.Path(__file__).parent / "custom_dataset.yaml", | ||
help='Path to the custom dataset config yaml file') | ||
args = parser.parse_args() | ||
|
||
main(args.custom, args.custom_dataset_config_yaml) |
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,10 @@ | ||
- CustomConfig: | ||
name: "custom_store" | ||
data_source: | ||
remote_path: "https://docs.wandb.ai/" | ||
repo_path: "https://github.com/wandb/docodile" | ||
base_path: "docs" | ||
file_pattern: "*.md" | ||
is_git_repo: true | ||
language: "en" | ||
docstore_dir: "custom_store_en" |
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,15 @@ | ||
from typing import get_type_hints, Optional, Union, List | ||
from wandbot.ingestion.config import DataSource, DataStoreConfig | ||
|
||
# Get the type hints for DataSource and DataStoreConfig | ||
DataSourceDict = get_type_hints(DataSource) | ||
DataStoreConfigDict = get_type_hints(DataStoreConfig) | ||
|
||
# Replace the types that are not JSON serializable | ||
DataSourceDict["cache_dir"] = str | ||
DataSourceDict["local_path"] = Optional[str] | ||
DataSourceDict["git_id_file"] = Optional[str] | ||
DataSourceDict["file_pattern"] = Union[str, List[str]] | ||
|
||
DataStoreConfigDict["data_source"] = DataSourceDict | ||
DataStoreConfigDict["docstore_dir"] = str |
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