Skip to content

[QEff. Finetune]: Removed samsum dataset references from FT code. #482

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 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions QEfficient/finetune/configs/dataset_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
from dataclasses import dataclass


@dataclass
class samsum_dataset:
dataset: str = "samsum_dataset"
train_split: str = "train"
test_split: str = "validation"


@dataclass
class grammar_dataset:
dataset: str = "grammar_dataset"
Expand Down
6 changes: 3 additions & 3 deletions QEfficient/finetune/configs/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class TrainConfig:
weight_decay (float): Weight decay for optimizer (default: 0.0).
gamma (float): Learning rate decay factor (default: 0.85).
seed (int): Random seed for reproducibility (default: 42).
dataset (str): Dataset name for training (default: "samsum_dataset").
dataset (str): Dataset name for training (default: "alpaca_dataset").
task_type (str): Type of task for which the finetuning is to be done. Options: "generation" and "seq_classification". (default: "generation")
use_peft (bool): Whether to use PEFT (default: True).
peft_method (str): Parameter-efficient fine-tuning method (default: "lora").
from_peft_checkpoint (str): Path to PEFT checkpoint (default: "").
output_dir (str): Directory to save outputs (default: "meta-llama-samsum").
output_dir (str): Directory to save outputs (default: "training_results").
save_model (bool): Save the trained model (default: True).
save_metrics (bool): Save training metrics (default: True).
intermediate_step_save (int): Steps between intermediate saves (default: 1000).
Expand All @@ -48,7 +48,7 @@ class TrainConfig:
convergence_loss (float): Loss threshold for convergence (default: 1e-4).
use_profiler (bool): Enable profiling (default: False).
enable_ddp (bool): Enable distributed data parallel (default: False).
dump_root_dir (str): Directory for mismatch dumps (default: "meta-llama-samsum-mismatches/step_").
dump_root_dir (str): Directory for mismatch dumps (default: "mismatches/step_").
opByOpVerifier (bool): Enable operation-by-operation verification (default: False).
"""

Expand Down
4 changes: 0 additions & 4 deletions QEfficient/finetune/dataset/dataset_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
from QEfficient.finetune.dataset.imdb_dataset import (
get_preprocessed_imdb as get_imdb_dataset,
)
from QEfficient.finetune.dataset.samsum_dataset import (
get_preprocessed_samsum as get_samsum_dataset,
)

DATASET_PREPROC = {
"alpaca_dataset": partial(get_alpaca_dataset),
"grammar_dataset": get_grammar_dataset,
"samsum_dataset": get_samsum_dataset,
Copy link
Contributor

@quic-swatia quic-swatia Jun 30, 2025

Choose a reason for hiding this comment

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

Just removing this line of code is enough for the finetune.py to not throw DatasetNotFoundError error in case of "--dataset samsum_dataset". It will raise an error as follows: 'finetune.py: error: argument --dataset: invalid choice: 'samsum_dataset' (choose from 'alpaca_dataset', 'grammar_dataset', 'gsm8k_dataset', 'custom_dataset', 'imdb_dataset')'

Rest of the code changes of this PR are not required.

This way we can still keep the code for samsum_dataset for internal testing purpose and also if huggingface puts back the Samsum dataset, we would just need a single line of code to support it through QEfficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is discussed with Anuj and VB to remove all the references of this code. User should use this only via custom_dataset path.

"gsm8k_dataset": get_gsm8k_dataset,
"custom_dataset": get_custom_dataset,
"imdb_dataset": get_imdb_dataset,
Expand Down
48 changes: 0 additions & 48 deletions QEfficient/finetune/dataset/samsum_dataset.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/finetune.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ To run fine tuning for any user specific dataset, prepare the dataset using the
3. Inside the newly created efficient-transformers/dataset/custom_dataset.py, define a function named 'get_custom_dataset'.
4. get_custom_dataset() should have following 4 parameters: dataset_config, tokenizer, split, context_length.
5. Inside get_custom_dataset(), 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 [dataset](https://github.com/quic/efficient-transformers/tree/main/QEfficient/finetune/dataset). In case of Samsum dataset, get_preprocessed_samsum() of efficient-transformers/QEfficient/finetune/dataset/samsum_dataset.py is called.
6. For examples, please refer python files present in [dataset](https://github.com/quic/efficient-transformers/tree/main/QEfficient/finetune/dataset).
7. In [dataset_config.py](https://github.com/quic/efficient-transformers/blob/main/QEfficient/finetune/configs/dataset_config.py), for custom_dataset class, pass the appropriate value for train_split and test_split. As an alternative, these values can be passed as command line arguments as well with the finetune command. For example "--train_split train".
8. While running fine tuning, pass argument "-–dataset custom_dataset" to finetune on custom dataset.

Expand Down
25 changes: 23 additions & 2 deletions scripts/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pipeline {
}

stages {
stage('Install QEfficient') {
stage('Install QEfficient-Infer') {
steps {
sh '''
. ~/.bashrc
Expand All @@ -25,7 +25,6 @@ pipeline {
pip install junitparser pytest-xdist &&
pip install librosa==0.10.2 soundfile==0.13.1 && #packages needed to load example for whisper testing
pip install --extra-index-url https://download.pytorch.org/whl/cpu timm==1.0.14 torchvision==0.19.1+cpu einops==0.8.1 && #packages to load VLMs
pip install /opt/qti-aic/integrations/torch_qaic/py310/torch_qaic-0.1.0-cp310-cp310-linux_x86_64.whl && # For finetuning tests
rm -rf QEfficient"
'''
}
Expand Down Expand Up @@ -171,6 +170,28 @@ pipeline {
}
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@quic-hemagnih , @vbaddi , @quic-rishinr - FYI, Made a separate env for FT tests.

stage('Install QEfficient-FT') {
steps {
sh '''
. ~/.bashrc
sudo docker run --privileged -dit --name ${BUILD_TAG} -e HF_TOKEN=${HF_TOKEN} -v ./:/efficient-transformers -v ${HF_PATH}:${DOCKER_HF_PATH} ${DOCKER_LATEST}:master_latest
sudo docker exec ${BUILD_TAG} bash -c "
cd /efficient-transformers &&
apt update &&
apt install -y python3.10-venv &&
python3.10 -m venv preflight_qeff_ft &&
. preflight_qeff_ft/bin/activate &&
pip install --upgrade pip setuptools &&
pip install .[test] &&
pip install junitparser pytest-xdist &&
pip install librosa==0.10.2 soundfile==0.13.1 && #packages needed to load example for whisper testing
pip install --extra-index-url https://download.pytorch.org/whl/cpu timm==1.0.14 torchvision==0.19.1+cpu einops==0.8.1 && #packages to load VLMs
pip install /opt/qti-aic/integrations/torch_qaic/py310/torch_qaic-0.1.0-cp310-cp310-linux_x86_64.whl && # For finetuning tests
rm -rf QEfficient"
'''
}
}
stage('Finetune CLI Tests') {
steps {
timeout(time: 5, unit: 'MINUTES') {
Expand Down
Loading