feat(io-safetensors): tensorFilter on the single-file SafeTensorsParametersLoader (#1256) - #1258
Merged
Merged
Conversation
…metersLoader (#1256) Parity with ShardedSafeTensorsParametersLoader: an optional predicate over the file's tensor headers, applied before any tensor is read or delivered and before the progress total is computed; threaded through withPolicy. Lets a family load selectively from a checkpoint that also carries tensors the requested dtype cannot accept, instead of failing on the first unmapped one. Unblocks the Voxtral and llm-core legacy-path collapses downstream. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Closes #1256.
SafeTensorsParametersLoadergainstensorFilter: ((StreamingSafeTensorInfo) -> Boolean)? = null(also onwithPolicy), applied before any tensor is read or delivered and before the progress total is computed — the same hookShardedSafeTensorsParametersLoaderalready has. Filtered-out tensors are never materialized, so a checkpoint that also carries tensors the requested dtype cannot accept (int64 index tables, custom quantized payloads) can be loaded selectively instead of failing on the first unmapped one. Defaultnull= unchanged behavior.Testing: new
SafeTensorsParametersLoaderFilterTest(jvmTest) over a single file holding an F32 weight and an I64 table — filter delivers only the weight with the progress total reflecting the filtered count; without the filter the I64 tensor still fails the FP32requireexactly as before;withPolicythreads the filter. Module suite green.Downstream (SKaiNET-transformers): unblocks the Voxtral SafeTensors collapse and shrinks llm-core's legacy Q4/non-float path to Q4-only.