fix: guard against negative dataset_slice_end before streaming

Fall back to full download when dataset_slice_end is negative,
avoiding an empty stream.take(0) that would produce a broken dataset.
This commit is contained in:
Roland Tannous 2026-03-10 20:12:42 +00:00
commit 905e5a460e

View file

@ -1871,7 +1871,7 @@ class UnslothTrainer:
if subset:
load_kwargs["name"] = subset
if dataset_slice_end is not None:
if dataset_slice_end is not None and dataset_slice_end >= 0:
# Manual slice — stream only the rows we need instead of
# downloading the entire dataset.
rows_to_stream = dataset_slice_end + 1