Make Ignored Columns ValueError More Informative (#33299)

Make Ignored Columns Value Error More Informative

Included forward method signature columns in the ValueError so end users will know what columns are expected to be passed to the model in addition to those which are ignored.
This commit is contained in:
William Buchanan 2025-04-16 10:14:55 -04:00 committed by GitHub
parent 0577cae808
commit 2f517200c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -939,7 +939,7 @@ class Trainer:
columns = [k for k in signature_columns if k in dataset.column_names]
if len(columns) == 0:
raise ValueError(
"No columns in the dataset match the model's forward method signature. "
"No columns in the dataset match the model's forward method signature: ({', '.join(signature_columns)}). "
f"The following columns have been ignored: [{', '.join(ignored_columns)}]. "
"Please check the dataset and model. You may need to set `remove_unused_columns=False` in `TrainingArguments`."
)