* 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). * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: wrap ClippableLinear patch in try/finally to always restore Ensures _create_and_replace is restored even if PeftModel.from_pretrained raises, preventing leaked global state across subsequent model loads. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| _utils.py | ||
| cohere.py | ||
| dpo.py | ||
| falcon_h1.py | ||
| gemma.py | ||
| gemma2.py | ||
| glm4_moe.py | ||
| granite.py | ||
| llama.py | ||
| llama4.py | ||
| loader.py | ||
| loader_utils.py | ||
| mapper.py | ||
| mistral.py | ||
| qwen2.py | ||
| qwen3.py | ||
| qwen3_moe.py | ||
| rl.py | ||
| rl_replacements.py | ||
| sentence_transformer.py | ||
| vision.py | ||