[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
6170f185f8
commit
718f673439
2 changed files with 20 additions and 3 deletions
|
|
@ -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!"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue