Repository navigation
fix(eora): keep generated adapter tensors for repeated saves - #5446
Merged
Merged
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
Fixes #5354.
An EoRA-quantized model could be saved only once.
_eora_save()exported the generated adapter and then deletedself.lora_results, the only in-memory copy. A secondsave()wrote the new base checkpoint and then failed at thehasattr(self, "lora_results")assertion, leaving the destination without an adapter.What Changed
gptqmodel/models/writer.py: stop deletinglora_resultsafter an adapter export. The EoRA pass stores CPU-resident A/B tensors on the model; they now live for the model's lifetime, so everysave()re-exports the same payload with a destination-specificadapter_config.json.gptqmodel/looper/eora_processor.py: document that the generated adapters are model-lifetime state.tests/test_eora_repeat_save_5354.py: writer-level regression (two exports from one result map) and an end-to-end regression (quantize once, save twice to distinct base/adapter destinations, compare both adapter payloads, and reload both exports for logits parity).The suggested staged/preflight export is not needed for this failure: the writer now always retains the payload it exports. Arbitrary adapter I/O failures are unchanged and out of scope.
Tests
Red (pre-fix, both new tests):
python -m pytest tests/test_eora_repeat_save_5354.py -q -ra # 2 failed; both hit AssertionError at gptqmodel/models/writer.py:2047Green (post-fix):
No hardware-dependent skips: the regressions are deterministic and run on CPU.
Model Support / Module Plan
Not applicable: no model definitions, aliases, module plans, or fusion changes.
AWQ onboarding safety
Not applicable: no model/definition/AWQ changes.
Logic Flow Documentation
file:lineevidence.docs/repeats the diagrams, titled for the mechanism, and is linked fromREADME.md.Diagram summary: local persistence-state fix. The EoRA export still runs at the same call site with the same inputs; only the post-export deletion of the payload is removed. No stage, selection order, dispatch, or failure-path decision changed.
Review Requirements
AI-assisted code is welcome. Open the PR as a draft. Mark it ready only after review and after GitHub confirms the pushed head has no conflicts with the current remote base.
I or an AI agent (such as Codex or Claude) have:
Kernel Accuracy Requirements
Not applicable: no kernel or fusion changes.
Notes
The retained payload is the CPU adapter tensor set already produced by the EoRA pass, the same bytes previously exported. It is released with the model; there is no API, config, or checkpoint-layout change.