Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.

Commit 13df76a

Browse files
shuklak13ml-fairness-infra-github
authored andcommitted
make channel fields optional
PiperOrigin-RevId: 429085129
1 parent ce96783 commit 13df76a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

model_card_toolkit/tfx/component.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ class ModelCardGeneratorSpec(component_spec.ComponentSpec):
3434
INPUTS = {
3535
standard_component_specs.STATISTICS_KEY:
3636
component_spec.ChannelParameter(
37-
type=standard_artifacts.ExampleStatistics),
37+
type=standard_artifacts.ExampleStatistics, optional=True),
3838
standard_component_specs.EVALUATION_KEY:
3939
component_spec.ChannelParameter(
40-
type=standard_artifacts.ModelEvaluation),
40+
type=standard_artifacts.ModelEvaluation, optional=True),
4141
standard_component_specs.PUSHED_MODEL_KEY:
42-
component_spec.ChannelParameter(type=standard_artifacts.PushedModel),
42+
component_spec.ChannelParameter(
43+
type=standard_artifacts.PushedModel, optional=True),
4344
}
4445
OUTPUTS = {
4546
MODEL_CARD_KEY:

model_card_toolkit/tfx/component_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ def test_component_construction(self):
5050
('path/to/md/template', 'mc.md')]
5151
}, this_component.exec_properties)
5252

53+
def test_empty_component_construction(self):
54+
this_component = ModelCardGenerator()
55+
with self.subTest('outputs'):
56+
self.assertEqual(this_component.outputs['model_card'].type_name,
57+
artifact.ModelCard.TYPE_NAME)
58+
5359

5460
if __name__ == '__main__':
5561
absltest.main()

0 commit comments

Comments
 (0)