accelerate
a9e2e6b5 - is_peft_model: trust the imported peft, not just distribution metadata

Commit
66 days ago
is_peft_model: trust the imported peft, not just distribution metadata is_peft_available() checks importlib metadata, so a peft provided only through PYTHONPATH (source checkout, shipped environment) makes is_peft_model() return False even while a PeftModel instance is right there in the model tree. Callers then treat the wrapper as a plain model; in TRL this patched a fused-loss forward onto the PeftModel, where transformers' base_model property resolves to peft's LoraModel and training crashes with an unrelated-looking AttributeError. If peft is already in sys.modules, isinstance against it directly; fall back to the metadata check only to trigger the first import.
Author
Parents
Loading