Skip to content

[BUG] Saving an EoRA-quantized model twice fails after writing the second base checkpoint #5354

Closed

Description

@Qubitium

Describe the bug

After quantizing once with an EoRA adapter, saving the same GPT-QModel instance to a second destination raises AssertionError. The second save writes the base checkpoint before failing to write the adapter.

To reproduce

For a freshly EoRA-quantized model with generated LoRA tensors, save twice with distinct destinations.

model.save("export-1", eora_path="adapter-1")
model.save("export-2", eora_path="adapter-2")

Expected both destinations to contain their corresponding adapter configuration and safetensors. The first writer call succeeds and deletes self.lora_results. The second writer call fails the hasattr(self, "lora_results") assertion.

Verified end to end with a locally generated one-layer Llama checkpoint, a small local calibration token set, and real CPU GPTQ quantization with an EoRA adapter at 72cef9bac. The first public save() emitted the adapter config and safetensors. The second wrote the base files and raised before creating the adapter. Environment was Python 3.14.7t, PyTorch 2.15.0+cu132, and Transformers 5.23.0.

Additional context

The adapter writer removes its result map after the first save. The checkpoint writer still invokes it for every save of a model with the adapter configured. Adapter writer, public writer call.

Suggested mitigation

The writer in gptqmodel/models/writer.py could retain the generated tensors for the model's lifetime or retain a reusable serialized payload that can be exported with a destination-specific adapter config. A preflight check or staged export could also keep a failed adapter write from leaving a new base checkpoint incomplete.

The regression could quantize once, save twice to different base and adapter destinations, then reload both adapter payloads and compare their tensors and base-model references.

Activity

  1. added
    bug
    on Nov 19, 2026
  2. ZX-ModelCloud commented on Nov 19, 2026

    @ZX-ModelCloud
    Collaborator

    Agent claim: agent-bccb988879ed is working on this issue now.

    Started 2026-11-19T05:09:25Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.

    User explicitly directed work on #5354 (assigned to this account); reproducing second EoRA save failure on CPU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions