Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for model metadata in RTen models #48

Merged
merged 4 commits into from
Feb 4, 2024

Conversation

robertknight
Copy link
Owner

Add initial support for storing model metadata in RTen models. Metadata is accessed via Model::metadata in Rust and added to converted models by specifying a JSON file containing the metadata when running convert-onnx.py, using a new --metadata flag.

The ONNX spec is quite bare-bones with respect to standard metadata fields. RTen is a bit more prescriptive about what should be included and the formats of those fields.

Summary of changes:

  • Add Metadata table to FlatBuffers schema for .rten models
  • Add support for writing Metadata table when converting ONNX models
  • Add Model::metadata to access model metadata
  • Print model metadata when running rten-cli <model_path>

Part of #20

Add a new `Metadata` table to the FlatBuffers schema and `Model::metadata`
structure for accessing this data in Rust.

The initial set of fields includes a description, license and metadata
describing the provenance of the model:

 - The SHA-256 hash of the input ONNX model
 - The code repository (eg. GitHub)
 - The model repository (eg. Hugging Face)
 - Training run ID and URL (eg. from an experiment tracking platform such as
   Weights and Biases)
This initial support assumes that the metadata is stored separately from the
ONNX file. In future it will also be useful to import from metadata stored
within the ONNX file itself.
@robertknight robertknight merged commit 82eabb7 into main Feb 4, 2024
1 check passed
@robertknight robertknight deleted the model-metadata branch February 4, 2024 13:26
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