Skip to content

Conversation

@leoromanovich
Copy link
Collaborator

  • I've checked contribution guide.

Copy link
Contributor

@AlekseySh AlekseySh left a 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
Copy link
Contributor

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:
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review in progress

Development

Successfully merging this pull request may close these issues.

3 participants