Commit c87cfd65 authored by Sylvain Gugger's avatar Sylvain Gugger
Browse files

Better error message when inputs are empty

parent e9fa7cd5
......@@ -1934,6 +1934,11 @@ class Trainer:
handling potential state.
"""
inputs = self._prepare_input(inputs)
if len(inputs) == 0:
raise ValueError(
"The batch received was empty, your model won't be able to train on it. Double-check that your "
f"training dataset contains keys expected by the model: {','.join(self._signature_columns)}."
)
if self.args.past_index >= 0 and self._past is not None:
inputs["mems"] = self._past
......
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