Repository navigation
fix: preserve persistent buffers in adapter checkpoints - #313
tastelikefeet merged 1 commit into
Conversation
Signed-off-by: liuchenbing <chenliumail@163.com>
|
@tastelikefeet could you please review this adapter-checkpoint correctness fix? I rechecked the committed regression with the exact
This is a focused CPU regression using real PEFT modules and safetensors save/load, with a small strategy fixture for parameter collection. It checks persistent float/integer buffer inclusion, excludes nonpersistent/backbone/other-adapter buffers, and restores a changed temperature buffer through PEFT. The harness substitutes the exact method from each revision into the same runtime; this is not a full main-branch training-suite run. Rechecked on Linux/aarch64, Python 3.12.13, Torch 2.10.0 and PEFT 0.19.0. An initial unprivileged attempt stopped at the separate import-time lock-directory permission issue; the results above were rerun in a writable working directory. Multi-rank FSDP/EP is still outside this validation scope. This is an independently reproduced bug found during adapter round-trip testing, rather than a claim to resolve an existing issue number. Thanks! |
|
Let me see |
|
Thanks! I will merge this PR into the main branch. |
PR type
PR information
Adapter checkpoint collection currently gathers parameters only. When a PEFT
modules_to_savemodule has persistent buffers, such as candidate token IDs or calibration temperatures, these are omitted fromadapter_model.safetensors; PEFT then raises a missing-key error when restoring the checkpoint.Collect persistent buffers from the selected adapter's saved modules before applying the existing PEFT key normalization. Nonpersistent buffers, the original module, other adapters, and backbone buffers remain excluded. The change does not materialize the full backbone state dictionary.
AI assistance was used for implementation and testing.
Experiment results
python -m pytest tests/transformers/test_adapter_persistent_buffers.py -q --confcutdir=tests/transformers: 1 passed.base_model.model.head.temperatureis missing.pre-commit run --all-files: passed.