From 718f673439d99189eb85bcf0c31d6e0372f7d5ea Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 08:19:58 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- unsloth/models/llama.py | 18 ++++++++++++++++-- unsloth/models/loader.py | 5 ++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index 8a7e754425..8853715ac4 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -2808,7 +2808,14 @@ class FastLlamaModel: if r <= 0: raise TypeError(f"Unsloth: Rank of {str(r)} must be larger than 0.") - if isinstance(model, (PeftModelForCausalLM, PeftModelForSequenceClassification, PeftModelForSeq2SeqLM)): + if isinstance( + model, + ( + PeftModelForCausalLM, + PeftModelForSequenceClassification, + PeftModelForSeq2SeqLM, + ), + ): # Check if exactly the same and then pass through! assert hasattr(model, "peft_config") @@ -3246,7 +3253,14 @@ class FastLlamaModel: model = model, use_gradient_checkpointing = use_gradient_checkpointing, ) - if not isinstance(model, (PeftModelForCausalLM, PeftModelForSequenceClassification, PeftModelForSeq2SeqLM)): + if not isinstance( + model, + ( + PeftModelForCausalLM, + PeftModelForSequenceClassification, + PeftModelForSeq2SeqLM, + ), + ): raise TypeError( "Unsloth: Your model needs to call `.get_peft_model` first!" ) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index b585a4492f..33dd8928e2 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -1395,7 +1395,10 @@ class FastModel(FastBaseModel): is_vlm = any(x.endswith("ForConditionalGeneration") for x in architectures) is_vlm = is_vlm or hasattr(model_config, "vision_config") if auto_model is None: - if AutoModelForSeq2SeqLM._model_mapping.get(type(model_config), None) is not None: + if ( + AutoModelForSeq2SeqLM._model_mapping.get(type(model_config), None) + is not None + ): auto_model = AutoModelForSeq2SeqLM elif is_vlm: # Check if the model's auto_map supports the VLM auto class.