Skip to content

Footprint capability: header-only planInput for safetensors/ONNX, external_data fix, EDGE profile - #1170

Merged
michalharakal merged 1 commit into
developfrom
feature/1169-model-footprint
Aug 26, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/1169-model-footprint

Conversation

@michalharakal

@michalharakal michalharakal commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1169 — the library capability; the multi-format CLI over it incubates in SKaiNET-research (feature/model-footprint-cli) until a stable core release carries these APIs. Companion write-up: SKaiNET-developers/SKaiNET-research#5.

There was no quick way to check whether a model fits on an embedded device with limited memory and compute before investing a day in converting it. This PR makes the answer computable from headers/metadata alone, for all three formats:

  • StreamingSafeTensorsReader.planInput / StreamingOnnxReader.planInput — PlanInput with geometry = null: weights-only plans through the same render/verdict/suggestion pipeline GGUF uses. Byte counts are authoritative (safetensors data_offsets, ONNX raw_data).
  • ONNX external_data parsed instead of skipped — >2 GB models keep weights in a sibling file, and exactly those models previously reported ~0 bytes: a fit verdict that lied where it mattered most. Sizes are Long throughout (estimatedBytesLong; the Int view clamps instead of wrapping negative). Pinned by a 3 GiB-tensor test.
  • PlannerProfile.EDGE — an embedded device where the number the caller passes IS the usable RAM: reserve deliberately zero and documented to stay zero; weights mapped, KV auto-quantized past 80 %.
  • SafeTensorsDataTypeMapper no longer printlns a WARNING into stdout mid-parse.
  • The how-to doc shows the capability as a Kotlin API (open reader → planInput → EDGE.plan(...) → verdict).

Why the tests matter beyond this PR: they pin the memory-counting capability itself — per-format sums, the 3 GiB Long-correctness case, unknown-dtype pricing via offsets — so later memory-layout refactors cannot silently lose it.

Full pr-gate green (before the CLI split; the split removes app-level code only, and the affected module suites re-ran green).

🤖 Generated with Claude Code

…ly planInput, external_data fix, EDGE profile

There was no quick way to check whether a model fits on an embedded
device with limited memory and compute before investing a day in
converting it. This lands the library capability (#1169); the
multi-format CLI over it incubates in SKaiNET-research until a stable
core release carries these APIs.

- StreamingSafeTensorsReader.planInput / StreamingOnnxReader.planInput:
  PlanInput with null geometry — weights-only plans through the same
  render/verdict/suggestion pipeline GGUF uses. Byte counts are
  authoritative: safetensors from data_offsets, ONNX from raw_data.
- ONNX external_data (field 13) is parsed instead of skipped: >2 GB
  models keep their weights in a sibling file, and exactly those models
  previously reported ~0 bytes — a fit verdict that lied where it
  mattered most. Sizes are Long throughout (estimatedBytesLong; the Int
  view clamps instead of wrapping negative).
- PlannerProfile.EDGE: an embedded device where the number the caller
  passes IS the usable RAM — reserve deliberately zero and documented
  to stay zero; weights mapped, KV auto-quantized past 80%.
- SafeTensorsDataTypeMapper no longer printlns a WARNING into stdout
  mid-parse; UNKNOWN is the answer.
- Tests pin the capability so later memory-layout refactors cannot
  silently lose it: per-format planInput sums, the 3 GiB external
  tensor (Long correctness), unknown-dtype pricing via offsets.

Deferred (noted in #1169): HF config.json geometry, sharded index
support, /proc/meminfo DeviceMemory provider, ONNX TensorId maps.

Part of #1169.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michalharakal
michalharakal force-pushed the feature/1169-model-footprint branch from 939e2e3 to e6280d1 Compare August 26, 2026 13:25
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1170 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal michalharakal changed the title skainet-plan: model-footprint analysis for GGUF, safetensors and ONNX with a fits-in-RAM verdict Footprint capability: header-only planInput for safetensors/ONNX, external_data fix, EDGE profile Aug 26, 2026
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1170 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal
michalharakal merged commit fc57ee1 into develop Aug 26, 2026
17 checks passed
@michalharakal
michalharakal deleted the feature/1169-model-footprint branch August 26, 2026 13:37
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.

1 participant