Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_is_peft_model update to recognise peft submodules, allowing training quantised models with peft submodules #30884

Closed
wants to merge 9 commits into from
7 changes: 6 additions & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,12 @@ def _is_peft_model(model):
from peft import PeftMixedModel

classes_to_check = (*classes_to_check, PeftMixedModel)
return isinstance(model, classes_to_check)
if isinstance(model, classes_to_check):
return True
else:
for submodule in model.modules():
if isinstance(submodule, classes_to_check):
return True
return False


Expand Down
Loading