Skip to content

Fix dataset mixer split validation in combined datasets#1494

Merged
hamishivi merged 4 commits intoallenai:mainfrom
MohdElgaar:fix/dataset-mixer-list
Apr 8, 2026
Merged

Fix dataset mixer split validation in combined datasets#1494
hamishivi merged 4 commits intoallenai:mainfrom
MohdElgaar:fix/dataset-mixer-list

Conversation

@MohdElgaar
Copy link
Copy Markdown
Contributor

Summary

  • Fixes validation logic in dataset_transformation to correctly compare dataset_mixer_list_splits and dataset_mixer_list lengths.
  • Prevents index-column conflicts by dropping an existing index column before adding a new one in combined_dataset.

Why

  • The previous length check only worked when len(dataset_mixer_list_splits) == 1, and failed whenever multiple splits were provided.
  • Adding an index column when one already exists raises an error.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @MohdElgaar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical issues in dataset handling within the open_instruct project. It refines the validation process for dataset splits to ensure correct configuration when mixing multiple datasets and resolves a common problem where adding an 'index' column to an already indexed dataset would cause errors. These changes enhance the robustness and flexibility of dataset transformations.

Highlights

  • Dataset Split Validation: Corrected the validation logic for dataset_mixer_list_splits to properly compare its length against dataset_mixer_list, especially when multiple splits are provided, by accounting for the [dataset, amount] alternating structure.
  • Index Column Handling: Implemented a check to drop any existing 'index' column in combined datasets before adding a new one in both load_or_transform_dataset and count_tokens functions, preventing potential conflicts and errors.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • open_instruct/dataset_transformation.py
    • Fixed an issue where the 'index' column was not properly handled when concatenating datasets, leading to potential errors.
    • Corrected the logic for validating the length of dataset_mixer_list_splits against dataset_mixer_list to support multiple splits correctly.
    • Adjusted the indexing for dataset_mixer_list_splits to i // 2 to align with the structure of dataset_mixer_list.
Activity
  • MohdElgaar opened the pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces crucial fixes to the dataset mixing and splitting logic, particularly when handling multiple dataset splits. The changes correctly align the validation and indexing of dataset_mixer_list_splits with the actual number of datasets being processed, resolving a significant correctness issue. Additionally, the PR adds a robust mechanism to prevent conflicts with existing 'index' columns when combining datasets, ensuring a cleaner and more predictable dataset structure. These improvements enhance the reliability and correctness of the dataset transformation pipeline.

f"Index {i // 2} out of bounds for dataset_mixer_list_splits of length {len(dataset_mixer_list_splits)}"
)
dataset_config = DatasetConfig(
dataset_name=dataset_name,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change correctly uses i // 2 to retrieve the dataset_split from dataset_mixer_list_splits. This ensures that each dataset is assigned its intended split, aligning with the corrected validation logic.

Suggested change
dataset_name=dataset_name,
dataset_split=dataset_mixer_list_splits[i // 2],

@hamishivi hamishivi enabled auto-merge April 8, 2026 17:07
@hamishivi hamishivi added this pull request to the merge queue Apr 8, 2026
Merged via the queue into allenai:main with commit 1cd303a Apr 8, 2026
6 checks passed
davidheineman pushed a commit that referenced this pull request Apr 10, 2026
* Fix the check between dataset_mixer_list_splits and dataset_mixer_list lengths

When len(dataset_mixer_list_splits) != 1, it is expected to be equal to len(dataset_mixer_list) // 2.

* Remove existing 'index' column before adding new in combined_dataset

* Add changelog entry

---------

Co-authored-by: Hamish Ivison <hamishivi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants