Skip to content
This repository was archived by the owner on Sep 27, 2024. It is now read-only.
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Fixes [issue or discussion link]
## Before submitting

Before submitting a pull request, please be sure to do the following:
- [ ] Read the [How to Contribute guide](https://github.com/tensorflow/model-card-toolkit/blob/master/CONTRIBUTING.md) if this is your first contribution.
- [ ] Read the [How to Contribute guide](https://github.com/tensorflow/model-card-toolkit/blob/main/CONTRIBUTING.md) if this is your first contribution.
- [ ] Open an issue or discussion topic to discuss this change.
- [ ] Write new tests if applicable.
- [ ] Update documentation if applicable.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'setup.py'
- 'pyproject.toml'
branches:
- master
- main
- r*
pull_request:
paths:
Expand All @@ -17,7 +17,7 @@ on:
- 'setup.py'
- 'pyproject.toml'
branches:
- master
- main
- r*

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'model_card_toolkit/**'
- 'setup.py'
branches:
- master
- main
- r*
release:
types: [published]
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ bazel run //model_card_toolkit:move_generated_files

Include a license at the top of new files.

- [Python license example](https://github.com/tensorflow/model-card-toolkit/blob/master/setup.py#L1)
- [Bash license example](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/move_generated_files.sh#L2)
- [Python license example](https://github.com/tensorflow/model-card-toolkit/blob/main/setup.py#L1)
- [Bash license example](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/move_generated_files.sh#L2)

Bazel BUILD files also need to include a license section. See
[BUILD example](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/BUILD#L15).
[BUILD example](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/BUILD#L15).

**Do not** include a license at the top of Jinja template files.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Some use cases of model cards include:
* Informing users of ML models to make better-informed decisions about how to use them (or how not to use them).
* Providing model information required for effective public oversight and accountability.

![Generated model card image](https://raw.githubusercontent.com/tensorflow/model-card-toolkit/master/model_card_toolkit/documentation/guide/images/model_card.png)
![Generated model card image](https://raw.githubusercontent.com/tensorflow/model-card-toolkit/main/model_card_toolkit/documentation/guide/images/model_card.png)

## Installation

Expand Down
14 changes: 7 additions & 7 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ TFX Addons follows [Semantic Versioning 2.0](https://semver.org/) strategy.

## Making Major and Minor Releases

1. Create new `rX.Y` branch on https://github.com/tensorflow/model-card-toolkit from `master`.
1. Create new `rX.Y` branch on https://github.com/tensorflow/model-card-toolkit from `main`.
2. Create new PR with updates to `version.py` against `rX.Y` branch.
* Set the correct version and suffix in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/version.py).
* Ensure proper supported Python libraries are set in [setup.py](https://github.com/tensorflow/model-card-toolkit/blob/master/setup.py).
* Set the correct version and suffix in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/version.py).
* Ensure proper supported Python libraries are set in [setup.py](https://github.com/tensorflow/model-card-toolkit/blob/main/setup.py).
3. Create a [new release](https://github.com/tensorflow/model-card-toolkit/releases) from `rX.Y` branch. Create a tag with `vX.Y.Z` name.
* Add updates for new features, enhancements, bug fixes
* Add contributors using `git shortlog <last-version>..HEAD -s`
4. Create a new PR and merge an increase of `_MINOR_VERSION` in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/version.py) on `master` to get ready for next release.
4. Create a new PR and merge an increase of `_MINOR_VERSION` in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/version.py) on `main` to get ready for next release.

## Making Patch Releases
1. Cherry-pick commits to `rX.Y` branch. Release team can just port PR by commenting "/cherry-pick rX.Y" in a merged PR.
2. Create new PR with increasing `_PATCH_VERSION` in `version.py` against `rX.Y` branch.
* Set the correct version and suffix in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/version.py).
* Ensure proper supported Python libraries are set in [setup.py](https://github.com/tensorflow/model-card-toolkit/blob/master/setup.py).
* Set the correct version and suffix in [version.py](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/version.py).
* Ensure proper supported Python libraries are set in [setup.py](https://github.com/tensorflow/model-card-toolkit/blob/main/setup.py).
3. Create a [new release](https://github.com/tensorflow/model-card-toolkit/releases) from `rX.Y` branch. Create a tag with `vX.Y.Z` name.
* Add updates for new features, enhancements, bug fixes
* Add contributors using `git shortlog <last-version>..HEAD -s`
Expand Down Expand Up @@ -131,7 +131,7 @@ Current Release Team:
#### Bug fixes and other changes

* Update default template layout so charts can wrap to multiple rows
* Installing from source now requires [Bazel](https://docs.bazel.build/versions/master/install.html)>=2.0.0.
* Installing from source now requires [Bazel](https://docs.bazel.build/versions/main/install.html)>=2.0.0.
* Update model card templates to use new schema.
* `model_card_toolkit.utils.validation.validate_json_schema()` can now validate both schema v0.0.1 and v0.0.2.
* Add `_jinja_loader` attribute to `model_card_toolkit` to allow custom Jinja loaders.
Expand Down
14 changes: 7 additions & 7 deletions model_card_toolkit/documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ html = mct.export_format()

## Tutorials

* [Standalone Model Card Toolkit](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb)
* [Scikit-Learn with Model Card Toolkit](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb)
* [Standalone Model Card Toolkit](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb)
* [Scikit-Learn with Model Card Toolkit](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb)

If you want to try out the Model Card Toolkit (MCT) right away, you can run the
[standalone Model Card Toolkit demo](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb),
[standalone Model Card Toolkit demo](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb),
or the
[Scikit-Learn Model Card Toolkit demo](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb),
[Scikit-Learn Model Card Toolkit demo](https://colab.sandbox.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb),
which demonstrates how MCT can be used in a Scikit-Learn workspace.

These demos can be run directly from your browser. Click
[here](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/README.md)
[here](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/README.md)
to learn more.

## Guides

The
[Concepts guide](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/guide/concepts.md)
[Concepts guide](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/guide/concepts.md)
provides a high-level explanation of the terminology used by MCT. Use this as a
reference as you read other documentation pages.

The
[Templates page](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/guide/templates.md)
[Templates page](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/guide/templates.md)
explains how MCT uses templates as a skeleton to generate Model Card reports.
You can use a premade template provided by MCT, or you can create your own
template to generate Model Cards for your specific use case.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
" \u003ca target=\"_blank\" href=\"https://www.tensorflow.org/responsible_ai/model_card_toolkit/examples/Scikit_Learn_Model_Card_Toolkit_Demo\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" /\u003eView on TensorFlow.org\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca href=\"https://storage.googleapis.com/tensorflow_docs/model-card-toolkit/model_card_toolkit/documentation/examples/Scikit_Learn_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/download_logo_32px.png\" /\u003eDownload notebook\u003c/a\u003e\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
" \u003ca target=\"_blank\" href=\"https://www.tensorflow.org/responsible_ai/model_card_toolkit/examples/Standalone_Model_Card_Toolkit_Demo\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" /\u003eView on TensorFlow.org\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView on GitHub\u003c/a\u003e\n",
" \u003c/td\u003e\n",
" \u003ctd\u003e\n",
" \u003ca href=\"https://storage.googleapis.com/tensorflow_docs/model-card-toolkit/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/download_logo_32px.png\" /\u003eDownload notebook\u003c/a\u003e\n",
Expand Down
2 changes: 1 addition & 1 deletion model_card_toolkit/documentation/examples/cats_vs_dogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def create_model(
https://www.tensorflow.org/guide/keras/transfer_learning.

This model is used in
https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb.
https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/documentation/examples/Standalone_Model_Card_Toolkit_Demo.ipynb.

Args:
training_epochs: The number of epochs to train the model over. 4 by default.
Expand Down
2 changes: 1 addition & 1 deletion model_card_toolkit/documentation/guide/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ landing_page:
<br>
<br>
MCT stores model card fields using a
<a href="https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/schema/v0.0.1/model_card.schema.json">JSON schema</a>.
<a href="https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/schema/v0.0.1/model_card.schema.json">JSON schema</a>.
MCT can automatically populate those fields for TFX users via
<a href="https://www.tensorflow.org/tfx/guide/mlmd">ML Metadata (MLMD)</a>. Model card
fields can also be manually populated via a
Expand Down
12 changes: 6 additions & 6 deletions model_card_toolkit/documentation/guide/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Some use cases of model cards include:
### Schema

The
[Model Card schema](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/proto/model_card.proto)
[Model Card schema](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/proto/model_card.proto)
is a [proto](https://developers.google.com/protocol-buffers) describing a model
card's available fields. A
[JSON interface](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/schema)
[JSON interface](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/schema)
is also available. These objects can be interfaced with other systems for
storage, analysis, or visualization.

Expand All @@ -45,14 +45,14 @@ Toolkit can help with [generating base64 images](###model-card-api).
## Model Card Toolkit

The
[Model Card Toolkit](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/model_card_toolkit.py)
[Model Card Toolkit](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/model_card_toolkit.py)
allows you to generate [Model Card documents](###model-card-documents), as well
as [Proto and JSON objects](###schema), with a streamlined Python interface.

### Model Card API

The Model Card Toolkit includes a Model Card API consisting of a
[Python class](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/model_card.py).
[Python class](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/model_card.py).
Updates made to a Model Card Python object are written to a Model Card proto
object.

Expand All @@ -64,10 +64,10 @@ used to convert graphics, such as Matplotlib figures, to base64 strings.
### Model Card Documents

By default, the generated model card document is a HTML file based on
[default_template.html.jinja](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/template/html/default_template.html.jinja).
[default_template.html.jinja](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/template/html/default_template.html.jinja).
However, you can also provide your own custom Jinja template. These templates
files can be any text-based format (HTML, Markdown, LaTeX, etc.). A
[Markdown template](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/template/md/default_template.md.jinja)
[Markdown template](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/template/md/default_template.md.jinja)
is provided as an example.

### TFX and MLMD Integration
Expand Down
4 changes: 2 additions & 2 deletions model_card_toolkit/documentation/guide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ versions of pip starting with 20.3
## Installing from source

Starting with
[version 0.1.4](https://github.com/tensorflow/model-card-toolkit/blob/master/RELEASE.md)
[version 0.1.4](https://github.com/tensorflow/model-card-toolkit/blob/main/RELEASE.md)
compiling Model Card Toolkit requires
[Bazel](https://docs.bazel.build/versions/master/install.html)>=2.0.0.
[Bazel](https://docs.bazel.build/versions/main/install.html)>=2.0.0.

First, clone the github repo:

Expand Down
4 changes: 2 additions & 2 deletions model_card_toolkit/documentation/guide/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ model_card = mct.scaffold_assets()
mct.update_model_card(model_card)
```

When you run `mct.scaffold_assets()`, the contents of [model_card_toolkit/template](https://github.com/tensorflow/model-card-toolkit/tree/master/model_card_toolkit/template) are copied into `mct_directory/template`. This includes premade templates such as [default_template.html.jinja](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/template/html/default_template.html.jinja) and [default_template.md.jinja](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/template/md/default_template.md.jinja).
When you run `mct.scaffold_assets()`, the contents of [model_card_toolkit/template](https://github.com/tensorflow/model-card-toolkit/tree/main/model_card_toolkit/template) are copied into `mct_directory/template`. This includes premade templates such as [default_template.html.jinja](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/template/html/default_template.html.jinja) and [default_template.md.jinja](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/template/md/default_template.md.jinja).

The
[`model_card`](https://www.tensorflow.org/responsible_ai/model_card_toolkit/api_docs/python/model_card_toolkit/ModelCard)
Expand All @@ -40,7 +40,7 @@ mct.export_format(template_path=template_path, output_file='model_card.html')

### Modify the Model Card Template

You can freely modify a premade template to change styling, reorganize information, etc. You should be familiar with the [Jinja API](https://jinja.palletsprojects.com/en/2.11.x/api/) and [control structures](https://jinja.palletsprojects.com/en/2.11.x/templates/#list-of-control-structures). Model Card field names are taken from [model_card.py](https://github.com/tensorflow/model-card-toolkit/blob/master/model_card_toolkit/model_card.py).
You can freely modify a premade template to change styling, reorganize information, etc. You should be familiar with the [Jinja API](https://jinja.palletsprojects.com/en/2.11.x/api/) and [control structures](https://jinja.palletsprojects.com/en/2.11.x/templates/#list-of-control-structures). Model Card field names are taken from [model_card.py](https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/model_card.py).

### Creating a new Model Card Template

Expand Down
2 changes: 1 addition & 1 deletion model_card_toolkit/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def validate_json_schema(

If schema_version is not provided, it will use the latest schema version.
See
https://github.com/tensorflow/model-card-toolkit/tree/master/model_card_toolkit/schema/.
https://github.com/tensorflow/model-card-toolkit/tree/main/model_card_toolkit/schema/.

Args:
json_dict: A dictionary following the schema for a model card field.
Expand Down
Loading