From 21ef22a9ff6162e1c5b33f49ada76262d7b9dc81 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Tue, 10 Mar 2026 20:21:23 +0000 Subject: [PATCH] fix: skip streaming when dataset_slice_start > dataset_slice_end Prevents training on the wrong row range when start exceeds end by falling back to full download where existing clamping handles it. --- studio/backend/core/training/trainer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/studio/backend/core/training/trainer.py b/studio/backend/core/training/trainer.py index c72a54af00..2e37cad189 100644 --- a/studio/backend/core/training/trainer.py +++ b/studio/backend/core/training/trainer.py @@ -1871,7 +1871,10 @@ class UnslothTrainer: if subset: load_kwargs["name"] = subset - if dataset_slice_end is not None and dataset_slice_end >= 0: + _slice_start = dataset_slice_start or 0 + if (dataset_slice_end is not None + and dataset_slice_end >= 0 + and dataset_slice_end >= _slice_start): # Manual slice — stream only the rows we need instead of # downloading the entire dataset. rows_to_stream = dataset_slice_end + 1