Skip to content

Commit

Permalink
[data_loader] expand the error message (#2221)
Browse files Browse the repository at this point in the history
* Update data_loader.py

* style
  • Loading branch information
stas00 authored Dec 7, 2023
1 parent 6a4857f commit 5296419
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/accelerate/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ def __init__(
self.batch_size = getattr(batch_sampler, "batch_size", None)
self.drop_last = getattr(batch_sampler, "drop_last", False)
if self.batch_size is None and self.even_batches:
raise ValueError("You need to use `even_batches=False` when the batch sampler has no batch size.")
raise ValueError(
"You need to use `even_batches=False` when the batch sampler has no batch size. If you "
"are not calling this method directly, set `accelerator.even_batches=False` instead."
)

@property
def total_length(self):
Expand Down

0 comments on commit 5296419

Please sign in to comment.