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

[Fix] Fix the sparsezoo.Model to "see" metrics.yaml #430

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added hehe.py
Empty file.
3 changes: 3 additions & 0 deletions src/sparsezoo/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def __init__(self, source: str, download_path: Optional[str] = None):
)
self.eval_results: File = self._file_from_files(files, display_name="eval.yaml")

self.metrics: File = self._file_from_files(files, display_name="metrics.yaml")

# plaintext validation metrics optionally parsed from a zoo stub
self.validation_results: Optional[
Dict[str, List[ModelResult]]
Expand Down Expand Up @@ -248,6 +250,7 @@ def __init__(self, source: str, download_path: Optional[str] = None):
"benchmarks": self.benchmarks,
"benchmark": self.benchmark,
"eval_results": self.eval_results,
"metrics": self.metrics,
}

self.inference_runner = InferenceRunner(
Expand Down
2 changes: 2 additions & 0 deletions src/sparsezoo/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"outputs",
"onnx_gz",
"benchmark",
"metrics",
}

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -345,6 +346,7 @@ def restructure_request_json(
that will not be filtered out during restructuring
:return: restructured files
"""

# create `training` folder
training_dicts_list = fetch_from_request_json(
request_json, "file_type", "framework"
Expand Down
1 change: 1 addition & 0 deletions tests/sparsezoo/model/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"eval.yaml",
"analysis.yaml",
"model.md",
"metrics.yaml",
}

files_nlp = copy.copy(files_ic)
Expand Down
Loading