Skip to content

feat: gguf support immediate saving and AR_RESUME_DIR - #2736

Open
n1ck-guo wants to merge 2 commits into
mainfrom
hengguo/gguf_imediate_saving
Open

n1ck-guo wants to merge 2 commits into
mainfrom
hengguo/gguf_imediate_saving

Conversation

@n1ck-guo

@n1ck-guo n1ck-guo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Description

  • support immediate saving and AR_RESUME_DIR
  • fix large tensor packing OOM

Type of Change

New feature

Related Issues

Fixes or relates to #

Checklist Before Submitting

  • My code has been tested locally.
  • Documentation has been updated as needed.
  • New or updated tests are included where applicable.
  • The CUDA CI has passed. You can trigger it by commenting /azp run Unit-Test-CUDA-AutoRound.

Signed-off-by: n1ck-guo <heng.guo@intel.com>
Copilot AI lite review requested due to automatic review settings December 3, 2026 01:57
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
3 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Three critical correctness issues remain: a background staging write can race with finalization, stale resume data can be reused across incompatible runs, and reloaded quantization tensors may remain on CPU while weights are on an accelerator.

3 open issues
What changed in this PR

Adds GGUF immediate-saving and resumable export support, safer large-tensor packing, and quantization metadata preservation.

Changes:

  • Introduces per-block GGUF staging and crash-resume recovery.
  • Adds chunked packing and CPU/OOM fallback handling.
  • Expands offload support and related integration tests.
File Description
test/​unit/​test_cuda/​export/​test_gguf_format.py Updates CUDA GGUF format tests for tensor-type handling.
test/​unit/​test_cpu/​export/​test_gguf_immediate_saving_resume.py Adds CPU tests for GGUF immediate saving and resume behavior.
test/​unit/​test_cpu/​core/​test_resume_integration.py Tests export-crash recovery and resume integration.
test/​unit/​common/​utils/​test_offload_helpers.py Tests quantization metadata persistence during offload and reload.
test/​unit/​common/​export/​test_gguf_packing_helpers.py Tests chunked GGUF packing and OOM fallback behavior.
auto_round/​utils/​offload.py Adds persistence of extra quantization attributes and configurable staging directories.
auto_round/​export/​formats/​gguf/​writer.py Manages temporary GGUF output and export lifecycle.
auto_round/​export/​formats/​gguf/​staging.py Implements per-block GGUF staging and recovery.
auto_round/​export/​formats/​gguf/​packing.py Adds chunked and memory-efficient GGUF tensor packing.
auto_round/​export/​formats/​gguf/​hf_checkpoint_restorer.py Supports lazy restoration of staged checkpoint tensors.
auto_round/​export/​formats/​gguf/​convert.py Integrates staged tensors into GGUF conversion.
auto_round/​compressors/​shard_writer.py Handles resumed shard writing and finalization.
auto_round/​compressors/​orchestrator.py Integrates GGUF staging and resume orchestration.
auto_round/​compressors/​base.py Configures immediate GGUF saving during quantization.

Review effort: Lite

Comment on lines +2026 to +2027
if self.compress_context.is_immediate_saving and has_single_gguf_format:
self.compress_context.is_immediate_packing = False
Comment on lines +147 to +148
def _persist_index(self) -> None:
_atomic_write_json(self._index_path, {"modules": sorted(self._staged_modules)})
continue
if hasattr(target, "orig_layer"):
target = target.orig_layer
setattr(target, parts[-1], tensor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants