Repository navigation
fix(writer): accept safe nested per-layer shard paths in EXL3 passthrough - #3846
Merged
Merged
Conversation
…ough The EXL3 native checkpoint passthrough builder rejected every index shard entry whose name was not a bare basename. The public reshard() per-layer layout emits nested paths such as model.layers.0/layer.safetensors, so a valid resharded source could not be published. Accept safe relative paths while still rejecting absolute or drive-qualified paths, backslashes, NUL bytes, and empty, "." or ".." components. Hugging Face snapshot symlinks that resolve outside the source root remain permitted. Adds regression coverage for the reshard() layout and for rejected unsafe paths.
ZX-ModelCloud
force-pushed
the
fix/3828-exl3-nested-shard
branch
from
November 13, 2026 09:13
41980fc to
e3067bf
Compare
Restore the import order required by ruff after #3845 so the repository lint gate passes again.
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
The EXL3 native checkpoint passthrough builder rejected every safetensors index shard entry whose name was not a bare basename. The public
reshard()per-layer layout writes nested paths such asmodel.layers.0/layer.safetensors, so a valid resharded source could not be published andsave_quantized()aborted with:Root cause
_build_exllamav3_checkpoint_passthrough_state_dict()validated shard names with:The guard was introduced in #3602 and is unchanged by #3712.
reshard()has always emittedmodel.layers.0/layer.safetensors(see its docstring andtests/test_reshard.py), so the guard rejects a supported layout.Fix
Add
_is_safe_relative_checkpoint_shard()and use it in place of the basename check. It accepts nested relative paths but still rejects:.and..componentsThe existing Hugging Face snapshot behavior is preserved: basename symlinks that resolve outside the snapshot root (to the shared
blobs/directory) remain allowed, because the guard validates the index entry, not the resolved path.Tests
tests/test_writer_state_overlay.py::test_exl3_checkpoint_passthrough_accepts_reshard_per_layer_shardsbuilds the realreshard()per-layer layout and verifies the passthrough preserves the native norm and embedding while replacing only the projection.tests/test_writer_state_overlay.py::test_exl3_checkpoint_passthrough_rejects_unsafe_shard_pathscovers absolute, traversal,./,//, and backslash entries.Validation
pytest tests/test_reshard.py tests/test_writer_state_overlay.py— 57 passedpytest tests/test_writer_attention.py tests/test_writer_dynamic_order.py tests/test_writer_instance_attrs.py tests/test_writer_quant_log.py— 21 passedruff check gptqmodel docs/eora tests setup.pypassesNotes
This is a localized validation fix; no control-flow or lifecycle change, so no logic-flow diagrams are needed. The
LazyTurtleactive-staging branch still requires a bare basename, but that path is not part of this report (the reproduction uses staging unset) and is left unchanged.The second commit only reorders the
from .quantizer import (...)names ingptqmodel/quantization/gptq.py, which #3845 left unsorted and which makes the repository lint gate fail onmainindependently of this change.Fixes #3828.