fix: patch PEFT for Gemma4ClippableLinear in loader checkpoint path
The same Gemma4ClippableLinear monkey-patch that exists in vision.py for training is needed in loader.py for loading existing checkpoints (used by export and inference). Gemma4ClippableLinear wraps nn.Linear but does not subclass it, so PEFT's LoRA injection fails with "Target module not supported". The patch redirects PEFT to target the inner .linear child instead. Applied only to the vision model PeftModel.from_pretrained path. Temporary fix until PEFT adds native support (peft#3129).
This commit is contained in:
parent
aa17486f44
commit
ec4f2a15a0
1 changed files with 3 additions and 0 deletions
|
|
@ -1584,7 +1584,10 @@ class FastModel(FastBaseModel):
|
|||
|
||||
if _clippable_linear_cls is not None:
|
||||
from peft.tuners.lora.model import LoraModel as _LoraModel
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 35ebf398 (fix: patch PEFT for Gemma4ClippableLinear in loader checkpoint path)
|
||||
_original_car = _LoraModel._create_and_replace
|
||||
|
||||
def _patched_car(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue