-
Notifications
You must be signed in to change notification settings - Fork 68
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
[WIP] Add datasets to config api V2 #623
base: main
Are you sure you want to change the base?
Conversation
leoromanovich
commented
Jul 28, 2024
- I've checked contribution guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach. Let's continue with this.
As the next step, I think you need to update pipelines code with usage of a new split
argument
@@ -0,0 +1,9 @@ | |||
name: image_labeled_dataset | |||
args: | |||
dataframe_name: df.csv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use "df" name here? so it's more consistent with argument names, but replace it with read actual df in runtime
} | ||
|
||
|
||
def get_dataset_by_cfg(cfg: TCfg, split: Optional[str] = None) -> IBaseDataset: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to rework this function a bit:
def get_dataset_by_cfg(cfg: TCfg, split: Optional[str] = None) -> IBaseDataset:
if cfg['name'] in DATASETS_REGISTRY:
df = pd.read_csv(Path(cfg["args"]["dataset_root"]) / cfg["args"]["df"], index_col=False)
mapper = {l: i for i, l in enumerate(df.sort_values(by=[SPLIT_COLUMN])[LABELS_COLUMN].unique())}
df[LABELS_COLUMN] = df[LABELS_COLUMN].map(mapper)
if split is not None:
df = df[df[SPLIT_COLUMN] == split].reset_index(drop=True)
cfg["args"]["df"] = df
else:
if split is not None:
raise ValueError("We only support <split> option for built-in datasets.")
if split and "dataframe_name" in cfg["args"].keys():
return dataset_class(**cfg["args"])
I also removed check_retrieval_dataframe_format
because there was no such functionality before
I also hope in my implementation we dont need filtering arguments