Skip to content

Commit d33a7a7

Browse files
InfoSage05Ayushman Paul
andauthored
Fix: skip fp16/bf16 validation for full finetuning in RL trainers (#6813)
--------- Co-authored-by: Ayushman Paul <ayushman@HP>
1 parent 22cd26f commit d33a7a7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

unsloth/models/rl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,9 @@ def _patch_trl_rl_trainers_impl(trainer_file = "grpo_trainer"):
10151015
"dtype = _get_dtype(dtype)\n"
10161016
"float16 = dtype == torch.float16\n"
10171017
"bfloat16 = dtype == torch.bfloat16\n"
1018+
"if full_finetuning:\n"
1019+
" if bfloat16 and use_fp16: use_fp16 = False\n"
1020+
" if float16 and use_bf16: use_bf16 = False\n"
10181021
"if not force_float32 and (float16 and use_bf16): raise TypeError('Unsloth: Model is in float16 precision but you want to use bfloat16 precision. Set fp16 to `True` and bf16 to `False`')\n"
10191022
"if not force_float32 and (bfloat16 and use_fp16): raise TypeError('Unsloth: Model is in bfloat16 precision but you want to use float16 precision. Set fp16 to `False` and bf16 to `True`')\n"
10201023
"if force_float32:\n"

0 commit comments

Comments
 (0)