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

Commit 5abb5fb

Browse files
committed
Optionally import ModelCardGenerator
1 parent 21873ee commit 5abb5fb

File tree

5 files changed

+63
-40
lines changed

5 files changed

+63
-40
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,19 @@ The Model Card Toolkit is hosted on [PyPI](https://pypi.org/project/model-card-t
3737

3838
If you are using [TensorFlow Extended (TFX)](https://www.tensorflow.org/tfx), you can
3939
incorporate model card generation into your TFX pipeline via the `ModelCardGenerator`
40-
component. The `ModelCardGenerator` component is moving to the
41-
[TFX Addons](https://github.com/tensorflow/tfx-addons) library and will not be
42-
included in Model Card Toolkit from version 1.4.0. This page will be updated to
43-
include the new links for the Model Cards in TFX
44-
guide and the end-to-end demo when that migration is completed.
40+
component.
41+
42+
The `ModelCardGenerator` component is moving to the
43+
[TFX Addons](https://github.com/tensorflow/tfx-addons) library and will no longer
44+
be packaged in Model Card Toolkit from version 1.4.0. Before you can use the
45+
component, you will need to install the `tfx-addons` package:
46+
47+
```sh
48+
pip install tfx-addons[model_card_generator]
49+
```
50+
51+
This page will be updated to include the new links for the Model Cards in TFX
52+
guide and the end-to-end demo when the migration is completed.
4553

4654
## Schema
4755

model_card_toolkit/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"""A module to streamline and automate generation of Model Cards."""
1515
from model_card_toolkit.core import ModelCardToolkit
1616
from model_card_toolkit.model_card import *
17+
from model_card_toolkit.tfx.component import ModelCardGenerator
1718
from model_card_toolkit.utils.source import *
1819
from model_card_toolkit.version import __version__

model_card_toolkit/tfx/__init__.py

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
"""
2-
Removal notice for the ModelCardGenerator TFX component.
3-
"""
4-
5-
raise ImportError(
6-
"""
7-
The ModelCardGenerator component and its dependencies have been moved to
8-
the TFX Addons project (https://github.com/tensorflow/tfx-addons).
9-
10-
Install the tfx-addons package with
11-
12-
```
13-
$ pip install tfx-addons[model_card_generator]
14-
```
15-
16-
You can then import the component via
17-
```
18-
from tfx_addons.model_card_generator.component import ModelCardGenerator
19-
```
20-
21-
and use it as usual.
22-
"""
23-
)
1+
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""
16+
Optionally imports the ModelCardGenerator TFX component.
17+
"""
18+
import logging
19+
20+
try:
21+
from tfx_addons.model_card_generator.component import ModelCardGenerator
22+
except ImportError:
23+
ModelCardGenerator = None
24+
logging.info(
25+
"""
26+
The ModelCardGenerator component and its dependencies have been moved to
27+
the TFX Addons project (https://github.com/tensorflow/tfx-addons).
28+
29+
If you'd like to use the component, you need to install the tfx-addons package:
30+
31+
```
32+
$ pip install tfx-addons[model_card_generator]
33+
```
34+
"""
35+
)

model_card_toolkit/tfx/init_test.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)