fix: support peft >= 0.19 in gptqmodel peft utils - #171
Merged
Merged
Conversation
peft 0.19 made two breaking changes that prevent this module from being imported or used: 1. `peft.peft_model.PEFT_TYPE_TO_MODEL_MAPPING` was renamed to `PEFT_TYPE_TO_TUNER_MAPPING` with no back-compat alias, so the module-level import raised ImportError on peft >= 0.19. 2. `GPTQLoraLinear.__init__` gained `config` as a required positional argument. On peft < 0.19 no such parameter exists and the previously passed `lora_config=` keyword was absorbed and discarded by **kwargs (LoRA hyperparameters reach the layer via **kwargs from LoraModel._create_and_replace, so nothing was lost). Both are handled without pinning a peft version: the mapping import falls back to the new name, and the constructor call is selected from the installed signature via inspect. Verified against peft 0.18.1, 0.19.1, 0.20.0 and 0.21.1 - the correct branch is chosen and the resulting call binds on each. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Dushyant Behl <myselfdushyantbehl@gmail.com>
dushyantbehl
force-pushed
the
fix/peft-019-compat
branch
from
September 30, 2026 20:02
1a60b1f to
a3e0786
Compare
kmehant
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
peft 0.19 made two breaking changes that prevent this module from being imported or used:
peft.peft_model.PEFT_TYPE_TO_MODEL_MAPPINGwas renamed toPEFT_TYPE_TO_TUNER_MAPPINGwith no back-compat alias, so the module-level import raised ImportError on peft >= 0.19.GPTQLoraLinear.__init__gainedconfigas a required positional argument. On peft < 0.19 no such parameter exists and the previously passedlora_config=keyword was absorbed and discarded by **kwargs (LoRA hyperparameters reach the layer via **kwargs from LoraModel._create_and_replace, so nothing was lost).Both are handled without pinning a peft version: the mapping import falls back to the new name, and the constructor call is selected from the installed signature via inspect. Verified against peft 0.18.1, 0.19.1, 0.20.0 and 0.21.1 - the correct branch is chosen and the resulting call binds on each.