Model card is an important component to consider when releasing a model. You can know more about model cards here.
Hugging Face Hub houses thousands of different models. Models that are a part of organizations such as
Google, Facebook, NVIDIA,
Hugging Face, etc. all have model cards. Apart from that, other models contributed
by the community also come with model cards (thanks to the
Trainer
class that makes this easy).
This repository shows how to generate model cards for a specific family of model in bulk.
- Prepare the generic text following these guidelines. The
text will remain fixed for all the different variants of a particular model family
(BERT is a model family and BERT-Base is a variant). For this purpose, prefer using the utilities from
huggingface_hub
. - Determine the variables that will change in the different model cards. Some examples: (pre-)training dataset, model architecture, parameters, performance metrics, etc.
This repository demonstrates these considerations with the MAXIM [1] model family. Here the
generic text can be found in template
of the generate_model_card.py
script. The
variables are found in the Config
class:
dataset_metadata
task
dataset
input_url
ckpt
psnr
ssim
Modify the generate_model_card.py
script as per your needs and then run it python generate_model_card.py
.
If you run the generate_model_card.py
as is here, you should see 11 directories
(with the maxim-s
prefix) after successful execution.
Here is an example model card generated with the script:
https://huggingface.co/google/maxim-s2-enhancement-lol (MAXIM model trained on the LOL dataset for low-light image enhancement)
[1] MAXIM: Multi-Axis MLP for Image Processing
Thanks to Willi Gierke from Google who initially gave me an earlier version of this script. I used that to generate TF-Hub documentation for 30 different variants of the ConvNeXt model.