Repository navigation
fix(lora): load_adapter_peft checks dtype, converts bf16/f16, sorts weights (PMAT-7024) - #7067
Merged
Merged
Conversation
…-7024) F32/BF16/F16 are decoded to f32; any other dtype or a misaligned byte length returns PeftFormatError naming the tensor. Weights are sorted by name instead of HashMap order. Tests: bf16/f16 values, I64/F64 rejected, sorted order. Pmat-Ticket: PMAT-7024 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
§13.11 rung 1 — quorum shadow verdict Shadow mode: this records a verdict and merges nothing. A refusal |
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.
What
load_adapter_peftchecks the tensor dtype instead of reading every tensor as f32.AdapterError::PeftFormatErrornaming the tensor.f32::from_le_bytes, so the cast no longer depends on buffer alignment.crates/aprender-train/src/lora/adapter/io.rsonly (+97/-1). No workflow, gate, script or contract change.Measured (build host, scratch copy of the branch at e875bc4)
cargo test -p aprender-train --lib lora::adapter::ioexit 101;test_peft_bf16_and_f16_convert_to_f32andtest_peft_unsupported_dtype_is_errorfail.cargo test -p aprender-train --lib lora::adapter58 passed, 0 failed.cargo clippy -p aprender-train --lib -- -D warnings0;cargo fmt --all -- --check0.Not measured
test_peft_weights_sorted_by_namealso passed with the sort reverted (three keys can come out of a HashMap in sorted order), so it does not prove the sort.ont-delta: none (a loader refuses or converts dtypes it used to misread; no surface, contract or ontology row changes)
Closes #7024
Pmat-Ticket: PMAT-7024
🤖 Generated with Claude Code