Repository navigation
Conversation
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.
Summary
DoRA adapters (
use_dora: true) used to load without error and then run as plain LoRA, becauseLoraConfigonly rejected DoRA whenmegatron_configwas also set. The same silent-accept path dropped other PEFT features (use_qalora,alora_invocation_tokens,target_parameters, CORDA), andLora.post_initconsumed onlylora_A/lora_B, ignoringlora_magnitude_vector, trained biases, andmodules_to_savetensors.This change fails closed: unsupported adapter semantics now raise a
ValueErrorbefore any tensor is applied, while metadata-only keys from newer PEFT versions are logged as a warning instead of disappearing.What Changed
gptqmodel/adapter/peft.pyLoraConfig.__post_init__: rejectuse_doraunconditionally (previously only with Megatron), plusbias != "none", non-emptymodules_to_save, and non-emptylayer_replication.LoraConfig.from_pretrained: reject enabled PEFT feature keys that change adapter math (use_qalora,alora_invocation_tokens,target_parameters,corda_config/use_corda) and warn (once) for unknown metadata keys such aspeft_version/inference_modeinstead of silently dropping them.gptqmodel/adapter/adapter.py_reject_unsupported_adapter_tensorsand called it fromLora.post_init(config/magnitude-vector region only) to reject checkpoints carryinglora_magnitude_vector,modules_to_savetensors, or adapter.biastensors even when the config does not declare them.tests/test_adapter_unsupported_peft.py(new): DoRA rejected with and without Megatron (direct and viaadapter_config.json), magnitude vector rejected without the flag, bias/modules_to_save rejected via config and tensors, unknown key warns and still loads, unsupported feature keys raise, and a plain LoRA still loads with the correct folded scale.No change to the target-module gating/assert path owned by #4210.
Tests
CPU-only (
CUDA_VISIBLE_DEVICES=); no GPU/model download needed for these adapter-config and tensor-path tests. Real DoRA/aLoRA/QALoRA checkpoints were not downloaded — their rejection is covered by synthetic configs/tensors.Model Support / Module Plan
N/A — no new model types or registry entries.
Fixes #4211