from peft import PeftModel
File "/app/.venv/lib/python3.14/site-packages/peft/__init__.py", line 17, in <module>
from .auto import (
...<8 lines>...
)
File "/app/.venv/lib/python3.14/site-packages/peft/auto.py", line 32, in <module>
from .peft_model import (
...<7 lines>...
)
File "/app/.venv/lib/python3.14/site-packages/peft/peft_model.py", line 42, in <module>
from peft.tuners.lora.variants import get_alora_offsets_for_forward, get_alora_offsets_for_generate
File "/app/.venv/lib/python3.14/site-packages/peft/tuners/__init__.py", line 15, in <module>
from .adalora import AdaLoraConfig, AdaLoraModel
File "/app/.venv/lib/python3.14/site-packages/peft/tuners/adalora/__init__.py", line 18, in <module>
from .config import AdaLoraConfig
File "/app/.venv/lib/python3.14/site-packages/peft/tuners/adalora/config.py", line 19, in <module>
from peft.tuners.lora import LoraConfig
File "/app/.venv/lib/python3.14/site-packages/peft/tuners/lora/__init__.py", line 23, in <module>
from .model import LoraModel
File "/app/.venv/lib/python3.14/site-packages/peft/tuners/lora/model.py", line 26, in <module>
from transformers.modeling_layers import GradientCheckpointingLayer
ModuleNotFoundError: No module named 'transformers.modeling_layers'
Library dependencies should prevent installation with old unsupported transformer.
System Info
The commit 30a19a0 added gradient check-pointing, which was introduced into transformers v4.52.0 as far as I can see (it's not mentioned in the release but the commit huggingface/transformers@9167fad that introduced it was first included in tag v4.52.0).
So this should be added as a version constraint in the
setup.py.Who can help?
No response
Reproduction
Install with transformer<=4.51.3 and try
from peft import PeftModelwill result in:Expected behavior
Library dependencies should prevent installation with old unsupported transformer.