Skip to content

0.2.0

Latest

Choose a tag to compare

@physicsrob physicsrob released this 09 Aug 06:21

Schematics are readable through a typed API

  • New torch-free package torchwright.schematic: load_schematic
    reads and validates a manifest file alone (integrity and content
    hashes, reference resolution — the same checks the builder runs);
    load_schematic_bundle binds it to the artifact directory (config
    pointer, file presence and sizes, support-npz structure;
    verify_files=True re-hashes every bound file). Typed views cover
    region navigation, residual-state column ownership with reverse
    lookup, checkpoint translation and its inverse, realization and
    schedule queries. All failures raise SchematicValidationError.
  • docs/schematic.md documents the format and reader (pinned against
    the code by tests/docs/test_schematic_doc.py).
  • Breaking import moves (no aliases): sha256_json, the SCHEMATIC_*
    constants, and column_runs live in torchwright.schematic.format
    (formerly torchwright.compiler.truth); encode_cols/decode_cols
    moved there from torchwright.compiler.graph_identity.

Schematics carry semantic regions

  • Every public op-library constructor now stamps the nodes it creates
    with construction-time provenance (@op_scope): derived op name,
    sanitized non-node parameters, operand/result references, and the
    enclosing-call chain. The stamps are pure metadata — canonical ids,
    fingerprints, and the schedule cache are unaffected.
  • The schematic's source graph gains a semantic_regions table and
    a per-node region membership field, both covered by the source
    content hash, so a consumer can read a compiled graph as the sequence
    of op calls that built it.

HF bundles ship an artifact schematic

  • Naming note: this artifact was briefly published as
    torchwright_truth.json (config key torchwright_truth, format
    torchwright.truth.v1) on pre-release Hub bundles; it is now the
    schematic everywhere — file, format string, config pointer, and API.
  • compile_hf_bundle writes torchwright_schematic.json into every bundle,
    alongside its JSON Schema and a parameter-support archive: the source and
    lowered graphs, the schedule, residual-stream layout, physical weight
    placements (in trimmed checkpoint coordinates), and the token-I/O
    contract, hash-bound to the bundle files.
  • The manifest carries a whole-manifest integrity hash, and staged bundles
    are validated against it — structure, file hashes, and coordinate
    bounds — before the destination is replaced.
  • config.json gains a torchwright_schematic pointer to the manifest files.
    Models returned by compile_to_hf (and bundles re-saved from them via
    save_hf_bundle) carry no schematic files and therefore no pointer.

Breaking: compiled vocabularies require an explicit unknown token

  • compile_hf_bundle, save_hf_bundle, and compile_to_onnx now require
    the vocabulary to contain exactly one <unk> token.