Repository navigation
Conversation
Qubitium
force-pushed
the
upstream/07-authenticated-shard-resume-20261108
branch
from
November 8, 2026 07:52
12dcf8c to
9d20a5f
Compare
Qubitium
reviewed
Nov 8, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Review: layer 7/36 — content-authenticated shard reuse
Rebased onto the layer-6 branch (4e73e000) rather than bare main: this layer calls layer 6's _atomic_shard_file, so dropping the predecessor would break it. Diff against the predecessor is only the two files this layer owns (utils/model.py, test_offload_files.py). Pushed as 9d20a5f3.
Verified
tests/test_offload_files.py -k streaming_state_dict→ 6 passed (5 original + 1 added)- Layer-6 fast suites on top of this branch (
test_config_only_export,test_writer_attention,test_reshard) → 36 passed ruff checkclean on touched files- Manual probe: unchanged source reuses, changed source rewrites, corrupt destination rewrites
Changes made
- Added
test_streaming_state_dict_to_shards_rewrites_when_source_changes. The existing tests prove "corrupt destination → rewrite" and "unchanged → reuse", but not the core claim in the other direction: a changed source must not be masked by an unchanged header. It passes. - Normalized top-level spacing around the new hashing helpers (ruff does not gate E302 in this repo, so this was cosmetic).
No functional defects found. The reuse decision is sound: exact header bytes + exact total size + per-entry payload digests + no trailing bytes, with a symlink guard, and it falls back to a full atomic rewrite on any miss.
Notes (not blockers)
OffloadTensorRef.sha256is currently never populated:_bundle_module_state_dictwrites onlydtype/shape/safetensors_file/weight_name/data_offsets, and_load_offload_entrydoes not read asha256key. So today every reuse goes through the content-hash fallback; the digest fast path becomes live with layer 8 (#3586). Consistent with the stack, just worth stating explicitly.- Reuse is not free: it hashes the source payload and then re-reads the whole existing shard, i.e. ~2× read instead of 1 read + 1 write. That is the right trade for slow/interrupted exports, but on fast NVMe with large checkpoints it can be close to a wash. If it matters, consider logging the reused byte count/timing or skipping reuse below a size threshold.
- Reused shards keep their existing file mode; only rewritten shards are normalized by the layer-6 writer. Minor.
_existing_shard_matchesreturnsFalseondigest is Noneand catchesOSError/TypeError/ValueError/struct.error. A corrupt source safetensors raisesSafetensorErrorand aborts rather than rewriting; the write path would fail on it anyway, so this is acceptable, but fail-closed-to-rewrite would be friendlier._safetensors_headerreturns aheaderdict that_write_shard_filediscards (_, header_bytes, _). Cosmetic.- No
fsyncbefore rename (inherited from layer 6): atomic against process failure, not power loss.
Layer looks good to land after #3584.
Qubitium
marked this pull request as ready for review
November 8, 2026 08:10
Also normalize top-level spacing around the new hashing helpers.
Qubitium
force-pushed
the
upstream/07-authenticated-shard-resume-20261108
branch
from
November 8, 2026 08:15
9d20a5f to
b55819b
Compare
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
Remove the ds4rt paths that no longer have a caller on main: - Drop the DS4/GLM `configure_base_replay_store` and `create_quantization_layer_output_writer` model hooks and the generic `ForwardExecutor` hook dispatch. `CalibrationConfig.spill_path` (G2) is the only output-collection path now. - Drop GLM5's `_prune_glm5_next_replay_frontier`, reachable only from the deleted hook. - Drop the never-written `distributed_quant_device` state read in `build_subset_plan`. - Retire `EXL3Config.module_include`: old checkpoints still load, the field warns once and is ignored, and `to_dict()` stops emitting it. `dynamic` `+:`/`-:` rules replace it. The test-only `offload_to_safetensors_reference` fixture, the #3585 shard-reuse probe and LazyTurtle remain because they still have callers or nothing is left in tree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks done
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
Remove the ds4rt paths that no longer have a caller on main: - Drop the DS4/GLM `configure_base_replay_store` and `create_quantization_layer_output_writer` model hooks and the generic `ForwardExecutor` hook dispatch. `CalibrationConfig.spill_path` (G2) is the only output-collection path now. - Drop GLM5's `_prune_glm5_next_replay_frontier`, reachable only from the deleted hook. - Drop the never-written `distributed_quant_device` state read in `build_subset_plan`. - Retire `EXL3Config.module_include`: old checkpoints still load and warn once, but quantization now raises with a `dynamic` negative-rule example instead of silently quantizing every module; `to_dict()` stops emitting it. The test-only `offload_to_safetensors_reference` fixture, the #3585 shard-reuse probe and LazyTurtle remain because they still have callers or nothing is left in tree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
Remove the ds4rt paths that no longer have a caller on main: - Drop the DS4/GLM `configure_base_replay_store` and `create_quantization_layer_output_writer` model hooks and the generic `ForwardExecutor` hook dispatch. `CalibrationConfig.spill_path` (G2) is the only output-collection path now. - Drop GLM5's `_prune_glm5_next_replay_frontier`, reachable only from the deleted hook. - Drop the never-written `distributed_quant_device` state read in `build_subset_plan`. - Retire `EXL3Config.module_include`: old checkpoints still load and warn once, but quantization now raises with a `dynamic` negative-rule example instead of silently quantizing every module; `to_dict()` stops emitting it. The test-only `offload_to_safetensors_reference` fixture, the #3585 shard-reuse probe and LazyTurtle remain because they still have callers or nothing is left in tree. Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Reuse a completed shard only when its exact header, size, and all payload digests match the current source. Compare legacy unhashed offload sources by content. Rewrite changed or truncated artifacts through the preceding atomic writer. This avoids repeated writes without treating matching filenames as completion evidence.
Stack
Layer 7/36 of a dependency-ordered fork extraction. Depends on #3584. Review only this layer.
GitHub requires this cross-fork PR to target upstream
main, so its Files changed tab includes earlier stack layers. After the predecessor lands, rebase this branch and retarget the next layer; do not merge later layers out of order. No predecessor is merged automatically.Tests
5 passed. Used Python 3.12, Torch 2.14.1, Transformers 5.19.0. No model quantization, GPU work, downloads, or heavyweight model validation. Unit fixtures are small and CPU execution is constrained to one math thread.
Review and remaining validation
This layer and its dependency diff were reviewed for scope, existing extension points, and compatibility with the resolved fork snapshot. New focused regression coverage is included. Kept as a draft for maintainer review; hardware paths and end-to-end model behavior have not been revalidated in this session. No speed claim. Original integration/history is preserved in tpurtell#3.