Skip to content

[QEff Finetune]: Adding steps about how to fine tune on any custom dataset. #381

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

quic-swatia
Copy link
Contributor

@quic-swatia quic-swatia commented Apr 28, 2025

  1. Added steps on how to create the custom_dataset.py to run fine-tuning through QEfficient pipeline on any custom dataset. Also, added a detailed template for the user which covers how to create custom_dataset.py
  2. Added the argument 'context_length' in the existing APIs which helps run fine tuning with padding for custom dataset.

@quic-swatia quic-swatia self-assigned this Apr 28, 2025
@quic-swatia quic-swatia requested a review from vbaddi April 28, 2025 11:16
@quic-rishinr quic-rishinr marked this pull request as draft April 28, 2025 16:51
@quic-mamta quic-mamta changed the title Adding steps about how to fine tune on any custom dataset. [QEff Finetune]: Adding steps about how to fine tune on any custom dataset. May 8, 2025
@quic-swatia quic-swatia marked this pull request as ready for review May 9, 2025 10:39
@quic-swatia quic-swatia requested a review from quic-amitraj as a code owner May 9, 2025 10:39
Signed-off-by: Swati Allabadi <[email protected]>
Copy link
Contributor

@quic-meetkuma quic-meetkuma left a comment

Choose a reason for hiding this comment

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

Good work in listing down the detailed steps for custom dataset, Swati! Please check on the comments. :)

To run fine tuning for any user specific dataset, prepare the dataset using the following steps:

1) Create a directory named 'dataset' inside efficient-transformers.
Copy link
Contributor

Choose a reason for hiding this comment

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

double space between "a" and "directory"


def tokenize():

Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comment as "Implement tokenization and prepare inputs for the training."

# load dataset
# based on split, retrieve only the specific portion of the dataset (train or eval) either here or at the last

Copy link
Contributor

Choose a reason for hiding this comment

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

Add one more comment as "Define a prompt template"


def apply_prompt_template():

Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comment as "Convert the raw input into format as per the template defined earlier."

5) Inside get_custom_dataset(), dataset needs to prepared for fine tuning. So, the user needs to apply prompt and tokenize the dataset accordingly. Please refer the below template on how to define get_custom_dataset().
6) For examples, please refer python files present in efficient-transformers/QEfficient/finetune/dataset. In case of Samsum dataset, get_preprocessed_samsum() of efficient-transformers/QEfficient/finetune/dataset/samsum_dataset.py is called.
7) In efficient-transformers/QEfficient/finetune/configs/dataset_config.py, for custom_dataset class, pass the appropriate value for train_split and test_split according to the dataset keys corresponding to train and test data points.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is no longer needed after PR#289. We can directly pass --train_split and --test_split from the CLI.

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

Successfully merging this pull request may close these issues.

3 participants