Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Check the `skip_prepare_dataset` before accessing dataset fields. #2496 (#2633)

Premikd8bf17959aa4
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index af401a2696f..2ff0e253e32 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -99,6 +99,8 @@ def sft_trainer_prepare_dataset(function_name, function):
pass
check_text = \
+ "if 'skip_prepare_dataset' in locals() and skip_prepare_dataset:\n"\
+ " return dataset\n"\
"if 'tokenizer' not in locals(): tokenizer = processing_class\n"\
"if 'formatting_func' not in locals(): raise RuntimeError('Unsloth: Please file a bug report - `formatting_func` does not exist!')\n"\
"if 'dataset_text_field' not in locals() and 'args' in locals(): dataset_text_field = args.dataset_text_field\n"\