mbtorch-io-formats

Community

Safe, compatible model I/O for MbTorch

Authorc-tomioka
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill defines design, validation, and testing guidance for MbTorch model input/output so that ONNX, safetensors, and the native .mbt format are parsed and emitted safely, deterministically, and without silent compatibility regressions or corrupted tensors.

Core Features & Use Cases

  • Format isolation: keep all format-specific parsing and serialization inside io/ and ensure core tensor and nn modules remain format-agnostic.
  • Strict validation & fail-fast behavior: verify magic bytes, header structure, version/opset compatibility, and tensor offsets before mapping binary buffers to memory.
  • Explicit error taxonomy: surface precise errors (e.g., InvalidMagicBytes, UnsupportedOpset, HeaderMismatch, TensorShapeMismatch) with file path, format, version, and remedial hints.
  • DTO-based intermediate representation: translate file formats into I/O-specific metadata structures before converting to nn.Model or core.Tensor to minimize coupling.
  • .mbt format and versioning rules: two-part layout (magic + JSON metadata + binary blobs), required metadata fields, and clear version bump/migration procedures.
  • Testing strategy: require ONNX parity tests, safetensors header/data checks, .mbt round-trip and version compatibility tests, plus corruption and unsupported-version cases.
  • Use case: when importing an ONNX model or saving a model for edge distribution, use these rules to avoid mismatched shapes, unsupported ops, or silently corrupted weights.

Quick Start

Enable mbtorch-io-formats when modifying any io/ loader or writer and add a parity or round-trip test that fails if metadata, shapes, dtype, or outputs diverge.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: mbtorch-io-formats
Download link: https://github.com/c-tomioka/mbtorch/archive/main.zip#mbtorch-io-formats

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.