Skip to content

Conversation

@puerco
Copy link
Member

@puerco puerco commented Nov 5, 2025

Summary

This PR adds a digest subcommand to the model_signing CLi. This allows other tools to find out the computed digest of a serialized model directory. It uses the same serializer as the sign command and supports adding files to the ignore list.

[puerco@babieco model-transparency] on  digest-subcommand 🐍 [venv]❯ python -m model_signing digest --help
Usage: python -m model_signing digest [OPTIONS] MODEL_PATH

  Computes the digest of a model.

  The digest subcommand serializes a model directory and computes the "root"
  digest (hash), the same used when signing and as the attestation subject.

  By default, git-related files are ignored (same behavior as the sign
  command). Use --no-ignore-git-paths to include them. To ignore other files
  from the directory serialization, use --ignore-paths.

Options:
  --ignore-paths IGNORE_PATHS     File paths to ignore when signing or
                                  verifying.
  --ignore-git-paths / --no-ignore-git-paths
                                  Ignore git-related files when signing or
                                  verifying.  [default: ignore-git-paths]
  --allow_symlinks                Whether to allow following symlinks when
                                  signing or verifying files.
  -h, --help                      Show this message and exit.

Checklist
  • All commits are signed-off, using DCO
  • All new code has docstrings and type annotations
  • All new code is covered by tests. Aim for at least 90% coverage. CI is configured to highlight lines not covered by tests.
  • Public facing changes are paired with documentation changes
  • Release note has been added to CHANGELOG.md if needed

Closes #565

@puerco puerco requested review from a team as code owners November 5, 2025 22:36
@puerco puerco force-pushed the digest-subcommand branch from 29c51b1 to 84a1717 Compare November 5, 2025 22:39
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@puerco puerco force-pushed the digest-subcommand branch from 84a1717 to c0c4cff Compare November 5, 2025 22:41
Copy link
Collaborator

@mihaimaruseac mihaimaruseac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good, but I have 2 points that I'd like to discuss a little bit more:

  • First, should we only output just the root hash or all the hashes in the manifest?
  • Second, maybe rather than importing from the private API, we could make the hashing config provide the root hash itself? Let me think a little bit more about this, while we discuss the first one.

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.

Compute model digest through the CLI

2 participants