Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vidyasiv committed Jun 13, 2024
1 parent bdc9f25 commit 47dad76
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions examples/language-modeling/run_lora_clm.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ def main():

if "validation" not in raw_datasets.keys() and training_args.do_eval:
if not data_args.validation_split_percentage:
raise ValueError("Please set --validation_split_percentage as dataset does not contain `validation` key")
raise ValueError(
"Please set --validation_split_percentage as dataset does not contain `validation` key"
)
raw_datasets["validation"] = load_dataset(
data_args.dataset_name,
data_args.dataset_config_name,
Expand Down Expand Up @@ -540,11 +542,12 @@ def main():
**dataset_args,
)


# If no validation data is there, validation_split_percentage will be used to divide the dataset.
if "validation" not in raw_datasets.keys() and training_args.do_eval:
if not data_args.validation_split_percentage:
raise ValueError("Please set --validation_split_percentage as dataset does not contain `validation` key")
raise ValueError(
"Please set --validation_split_percentage as dataset does not contain `validation` key"
)
raw_datasets["validation"] = load_dataset(
extension,
data_files=data_files,
Expand All @@ -563,7 +566,12 @@ def main():
)
single_column_dataset = False
# For named dataset (timdettmers/openassistant-guanaco) or custom dataset with a single column "text"
if training_args.do_train and raw_datasets["train"].num_columns == 1 or training_args.do_eval and raw_datasets["validation"].num_columns == 1:
if (
training_args.do_train
and raw_datasets["train"].num_columns == 1
or training_args.do_eval
and raw_datasets["validation"].num_columns == 1
):
single_column_dataset = True
raw_datasets = raw_datasets.map(
lambda x: {
Expand Down

0 comments on commit 47dad76

Please sign in to comment.