Clarify NotImplementedError for fast_inference with full_finetuning (#3768)

* Improve error message for fast_inference and full_finetuning

* Refine error message string formatting

* Update unsloth/models/vision.py

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
Fizza Mukhtar 2025-12-25 18:46:13 -08:00 committed by GitHub
commit 181b76420e

View file

@ -718,9 +718,13 @@ class FastBaseModel:
if full_finetuning:
max_lora_rank = max(get_lora_supported_ranks())
raise NotImplementedError(
f"Unsloth: `fast_inference = True` does not yet support `full_finetuning = True`.\n"
f"Use LoRA rank `r = {max_lora_rank}` as the closest replacement for full finetuning with Unsloth for RL."
"Unsloth: `fast_inference=True` cannot be used together with `full_finetuning=True`.\n"
"Reason: fast_inference is optimized for inference-only workflows and "
"does not currently support full fine-tuning.\n"
"Workaround: disable fast_inference, or use parameter-efficient fine-tuning "
f"(e.g. LoRA with rank r={max_lora_rank})."
)
model_config.model_name = model_name
if fast_inference: