Skip to content

Add JSON metadata section to APR format #116

@noahgift

Description

@noahgift

Summary

Add a JSON metadata section to the APR binary format, similar to SafeTensors.

Motivation

  • Enable single-file WASM deployment with embedded vocab, config, tokenizer
  • Generalizable to any model type (Whisper, LLMs, etc.)
  • Maintains APR benefits (LZ4 compression, streaming) while adding flexibility

Format Change

[MAGIC][HEADER][METADATA_LEN (u32)][JSON_METADATA][TENSOR_INDEX][TENSOR_DATA][CRC]

Acceptance Criteria

  • Add metadata_len field to header
  • Serialize/deserialize JSON metadata
  • Reader/Writer APIs for metadata
  • 95% test coverage maintained
  • Update book documentation
  • Add example: cargo run --example apr_with_metadata

Related

  • whisper.apr needs vocab embedding for WASM demos
  • Aligns with SafeTensors ecosystem patterns

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions