Skip to content

Commit

Permalink
added digest version to the report
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Colangelo committed Dec 31, 2024
1 parent 18011ee commit dd84d64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/digest/model_class/digest_onnx_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from typing import List, Dict, Optional, Tuple, cast
from datetime import datetime
import importlib.metadata
from collections import OrderedDict
import yaml
import numpy as np
Expand Down Expand Up @@ -519,9 +520,11 @@ def save_yaml_report(self, filepath: str) -> None:

input_tensors = dict({k: vars(v) for k, v in self.model_inputs.items()})
output_tensors = dict({k: vars(v) for k, v in self.model_outputs.items()})
digest_version = importlib.metadata.version("digestai")

yaml_data = {
"report_date": report_date,
"digest_version": digest_version,
"model_type": self.model_type.value,
"model_file": self.filepath,
"model_name": self.model_name,
Expand Down Expand Up @@ -553,8 +556,11 @@ def save_text_report(self, filepath: str) -> None:

report_date = datetime.now().strftime("%B %d, %Y")

digest_version = importlib.metadata.version("digestai")

with open(filepath, "w", encoding="utf-8") as f_p:
f_p.write(f"Report created on {report_date}\n")
f_p.write(f"Digest version: {digest_version}\n")
f_p.write(f"Model type: {self.model_type.name}\n")
if self.filepath:
f_p.write(f"ONNX file: {self.filepath}\n")
Expand Down
2 changes: 1 addition & 1 deletion test/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_against_example_reports(self):
self.compare_yaml_files(
TEST_SUMMARY_YAML_REPORT,
yaml_report_filepath,
skip_keys=["report_date", "model_file"],
skip_keys=["report_date", "model_file", "digest_version"],
)
)

Expand Down

0 comments on commit dd84d64

Please sign in to comment.