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

Support ModelCardGenerator in Vertex AI #260

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions tfx_addons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
"__version__",
] + list(_PKG_METADATA.keys())

_ARTIFACTS = {
"ModelCard": "model_card_generator.artifact.ModelCard",
}


def __getattr__(name): # pylint: disable=C0103
# PEP-562: Lazy loaded attributes on python modules
# NB(gcasassaez): We lazy load to avoid issues with dependencies not installed
# for some subpackes
if name in _ACTIVE_MODULES:
return _importlib.import_module("." + name, __name__)
elif name in _ARTIFACTS:
return _importlib.import_module("." + _ARTIFACTS[name], __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2 changes: 1 addition & 1 deletion tfx_addons/model_card_generator/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ModelCard(Artifact):
`<uri>/data/model_card.proto`.
* the model card itself, located at the `<uri>/model_card/ directory`.
"""
TYPE_NAME = 'ModelCard'
TYPE_NAME = 'tfx_addons.ModelCard'
TYPE_ANNOTATION = Metrics


Expand Down
5 changes: 3 additions & 2 deletions tfx_addons/model_card_generator/artifact_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def test_create_and_save_artifact(self):
self.store.get_artifacts_by_id([mc_artifact.id]))
with self.subTest('properties'):
with self.subTest('type_id'):
self.assertEqual(mc_artifact.type_id,
self.store.get_artifact_type('ModelCard').id)
self.assertEqual(
mc_artifact.type_id,
self.store.get_artifact_type('tfx_addons.ModelCard').id)
with self.subTest('uri'):
self.assertEqual(mc_artifact.uri, '/path/to/model/card/assets')
with self.subTest('name'):
Expand Down