Skip to content

[Bug] FFT BF16 issue #6731

Closed
Closed

Description

@shimmyshimmer

originally from email:
Hello there!
First of all, Im a huge fan of unsloth studio and as of now only ever used the web GUI version. I recently was trying to fully finetune models like qwen3.5, qwen1.5 and one of my own models with custom architecture. Now it always gives me this error: Model is in bfloat16 precision but you want to use float16 precision. Set fp16 to False and bf16 to True That is quite annoying because it doesnt even make sense, my config file has torch_dtype set to float16, when I set it to bfloat16 it gives me the same error. What do I do now? How can I fix it or is this a known issue? Im not sure where I should set fp16 to false and bf16 to true either.
Thanks, with love
An anonymous user from the web

Activity

  1. InfoSage05 commented on Jul 2, 2026

    @InfoSage05
    Contributor

    Hi @shimmyshimmer, thanks for reporting this! The issue is a bug in unsloth's RL training code. When doing full fine-tuning (FFT) with a bfloat16 model, the code validates the fp16/bf16 settings in TrainingArguments before it has a chance to correct them automatically. So if your TrainingArguments happens to have fp16=True (which is a common default), it raises that error even though the code would have fixed it for you downstream.
    The fix is to skip this validation when full finetuning is active, since the corrective logic already handles bfloat16 models correctly by disabling autocasting entirely. A PR with the fix should be up soon. In the meantime, you can work around it by explicitly setting fp16=False and bf16=False in your TrainingArguments when doing full finetuning.
    Hope that helps!

  2. added a commit that references this issue on Jul 2, 2026
    146740d
  3. added a commit that references this issue on Jul 3, 2026
    c356427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions