Skip to content

feat(io-safetensors): tensorFilter on the single-file SafeTensorsParametersLoader (#1256) - #1258

Merged
michalharakal merged 1 commit into
developfrom
feat/1256-single-file-tensor-filter
Sep 2, 2026
Merged

michalharakal merged 1 commit into
developfrom
feat/1256-single-file-tensor-filter

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Closes #1256.

SafeTensorsParametersLoader gains tensorFilter: ((StreamingSafeTensorInfo) -> Boolean)? = null (also on withPolicy), applied before any tensor is read or delivered and before the progress total is computed — the same hook ShardedSafeTensorsParametersLoader already 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. Default null = 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 FP32 require exactly as before; withPolicy threads 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.

…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>
@michalharakal
michalharakal merged commit 2fa89bb into develop Sep 2, 2026
14 checks passed
@michalharakal
michalharakal deleted the feat/1256-single-file-tensor-filter branch September 2, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SafeTensors: tensorFilter on the single-file SafeTensorsParametersLoader (parity with the sharded loader)

1 participant