Skip to content

Conversation

@Ofir408
Copy link

@Ofir408 Ofir408 commented Dec 4, 2025

Motivation

The train_eagle3.py script supports the --is-preformatted flag, which allows users to provide input data that already has the chat template applied. However, prepare_hidden_states.py was missing this flag, causing inconsistency between the two scripts.

Users who prepare their data with chat templates pre-applied (e.g., for custom formatting or to avoid repeated template application) couldn't use prepare_hidden_states.py without first converting their data back to raw conversation format.

This PR adds the --is-preformatted flag to prepare_hidden_states.py for feature parity with train_eagle3.py.

Modifications

  1. Added --is-preformatted argument to the data argument group in parse_args():

    • Uses action="store_true" (defaults to False)
    • Includes help text matching train_eagle3.py
  2. Updated cache key to include is_preformatted:

    • Ensures datasets with different is_preformatted values are cached separately
    • Prevents cache collisions between preformatted and non-preformatted data
  3. Pass is_preformatted to build_eagle3_dataset():

    • Enables the preprocessing function to handle preformatted data correctly

Related Issues

N/A

Accuracy Test

This PR does not affect model-side code or model architecture. It only adds an argument passthrough to existing functionality in build_eagle3_dataset(), which already supports is_preformatted.

Benchmark & Profiling

This PR does not impact performance. It only adds argument parsing and passes an existing parameter.

Added support for preformatted input data in prepare_hidden_states.py,
matching the existing flag in train_eagle3.py. This allows users to skip
chat template application when their data already has the template applied.

Changes:
- Added --is-preformatted argument to data group
- Updated cache key to include is_preformatted for proper caching
- Pass is_preformatted to build_eagle3_dataset()
…tes.py

- Updated script docstring with usage example for --is-preformatted
- Updated data_preparation.md to document --is-preformatted for offline training
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Ofir408, 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 enhances the prepare_hidden_states.py script by introducing the --is-preformatted flag. This change resolves an inconsistency with train_eagle3.py, allowing users to seamlessly process input data where chat templates have already been applied. The update ensures proper data handling, prevents cache conflicts, and provides clearer documentation for this workflow.

Highlights

  • Feature Parity: The --is-preformatted flag has been added to prepare_hidden_states.py to align its functionality with train_eagle3.py, allowing consistent handling of pre-formatted chat data.
  • Argument Addition: A new --is-preformatted boolean flag was introduced in prepare_hidden_states.py's argument parser, defaulting to False.
  • Cache Management: The dataset cache key now incorporates the is_preformatted flag, preventing cache collisions between datasets processed with and without pre-applied chat templates.
  • Data Processing Integration: The is_preformatted argument is now passed to the build_eagle3_dataset() function, enabling correct processing of pre-formatted data.
  • Documentation Update: The data_preparation.md documentation has been updated with an example demonstrating how to use the --is-preformatted flag with prepare_hidden_states.py.
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
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 the --is-preformatted flag to prepare_hidden_states.py, achieving feature parity with train_eagle3.py and enabling the use of datasets with pre-applied chat templates. The changes are well-implemented, correctly adding the command-line argument, updating the dataset cache key to prevent collisions, and passing the flag to the data processing function. The documentation has also been updated accordingly. My review includes one suggestion to enhance the clarity of a usage example in the script's docstring.

Ofir408 and others added 2 commits December 4, 2025 12:09
Added back the --output-path argument to the first usage example in the
docstring for clarity and consistency with the pre-formatted data example.
@Ofir408
Copy link
Author

Ofir408 commented Dec 11, 2025

I’ve pulled the latest changes from master. Could you please review this PR? @shuaills @sleepcoo @FrankLeeeee ?

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.

1 participant