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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix bf16 = None
Daniel Hand9be145849cd
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex f2f9280cad5..7407bba71fa 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -236,7 +236,9 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):if "args" in call_args and "model" in call_args:mixed_precision = \"use_bf16 = getattr(args, 'bf16', False)\n"\+ "if type(use_bf16) is not bool: use_bf16 = False\n"\"use_fp16 = getattr(args, 'fp16', False)\n"\+ "if type(use_fp16) is not bool: use_fp16 = False\n"\"force_float32 = False\n"\"if os.environ.get('UNSLOTH_FORCE_FLOAT32', '0') == '1':\n"\" print('Unsloth: Switching to float32 training since model cannot work with float16')\n"\@@ -293,7 +295,9 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"):" if eval_bsz == 8 and args.per_device_train_batch_size < eval_bsz: args.per_device_eval_batch_size = args.per_device_train_batch_size\n"\" if getattr(args, 'eval_accumulation_steps', None) is None and ga_steps is not None: args.eval_accumulation_steps = ga_steps\n"\"fp16_full_eval = getattr(args, 'fp16_full_eval', False)\n"\+ "if type(fp16_full_eval) is not bool: fp16_full_eval = False\n"\"bf16_full_eval = getattr(args, 'bf16_full_eval', False)\n"\+ "if type(bf16_full_eval) is not bool: bf16_full_eval = False\n"\"if args.fp16 and bf16_full_eval: args.bf16_full_eval = False; args.fp16_full_eval = True\n"\"if args.bf16 and fp16_full_eval: args.bf16_full_eval = True; args.fp16_full_eval = False\n"\"if force_float32:\n"\