Skip to content

[suggest] please refactor data module #688

Open

Description

@tpoisonooo

Is your feature request related to a problem? Please describe.

After sending this PR #677, I think the data module should be refactor, which is hard to use for user-defined dataset.

Decouple data_type and data_path

In

data_cls = data_config["dataset_name"]
, dataset_name is actually data_type, then load data from HF.

Actually, user's data would not open-source. We have to manually change source code here.

Support multiple data path

In

train_original_dataset = load_dataset("json", data_files=train_ds_path)["train"]
,

OpenAIFormatDataset.__init__ only supports single path, not list of data path. It does not match real scenario: training data comes from difference domains or teams.

llamafactory style (https://github.com/hiyouga/LLaMA-Factory/blob/main/data/dataset_info.json) may be better.

Dataset constructor definition

In

data_config["chat_key"],
, the key-list in dataset diffs.

If you do not set system_key for OpenAIFormatDataset, it crashes. So I have to change the code:

        data = hf_datasets.OpenAIFormatDataset(
            data_config["train_data_path"],
            data_config["val_data_path"],
            **{k: data_config[k] for k in ("chat_key", "system_key", "system_prompt") if k in data_config}
        )

Activity

  1. tpoisonooo commented on Jul 18, 2025

    @tpoisonooo
    ContributorAuthor

    Take advantage of the fact that this repo is new — refactoring early is more beneficial.

  2. snowmanwwg commented on Jul 20, 2025

    @snowmanwwg
    Contributor

    Also relating to #127

  3. yuki-97 commented on Aug 13, 2025

    @yuki-97
    Contributor

    Hi @tpoisonooo , thanks for the suggestion!
    Have a design for this at #909, please let me know if you have any suggestions or concerns.

  4. snowmanwwg commented on Aug 26, 2025

    @snowmanwwg
    Contributor

    @tpoisonooo Hi there, thanks again. We have some preliminary designs and would like to go through with you to get some feedback. Are you open to meet virtually? We can also chat on wechat wenwengao2014. Looking forward to hearing from you!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions