"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "ec4e421b7ded2f6b1baa63c19f2c0b2c11a36d92"
Unverified Commit e94d63f6 authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

[trainer] fix ignored columns logger (#10219)



* [trainer] fix ignored columns logger

This PR fixes a confusing log entry that says:
```
The following columns in the evaluation set don't have a corresponding argument in `T5ForConditionalGeneration.forward` and have been ignored: .
```
when everything is in order.

* Update src/transformers/trainer.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent 4210cd96
...@@ -434,11 +434,12 @@ class Trainer: ...@@ -434,11 +434,12 @@ class Trainer:
self._signature_columns += ["label", "label_ids"] self._signature_columns += ["label", "label_ids"]
columns = [k for k in self._signature_columns if k in dataset.column_names] columns = [k for k in self._signature_columns if k in dataset.column_names]
ignored_columns = list(set(dataset.column_names) - set(self._signature_columns)) ignored_columns = list(set(dataset.column_names) - set(self._signature_columns))
dset_description = "" if description is None else f"in the {description} set " if len(ignored_columns) > 0:
logger.info( dset_description = "" if description is None else f"in the {description} set "
f"The following columns {dset_description}don't have a corresponding argument in " logger.info(
f"`{self.model.__class__.__name__}.forward` and have been ignored: {', '.join(ignored_columns)}." f"The following columns {dset_description} don't have a corresponding argument in "
) f"`{self.model.__class__.__name__}.forward` and have been ignored: {', '.join(ignored_columns)}."
)
dataset.set_format(type=dataset.format["type"], columns=columns, format_kwargs=dataset.format["format_kwargs"]) dataset.set_format(type=dataset.format["type"], columns=columns, format_kwargs=dataset.format["format_kwargs"])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment