Skip to content

Conversation

@gcucurull
Copy link
Contributor

This PR adds model-index files to document the models in the library.

Each model has a markdown file that provides a summary of the model, some code examples on how to use it, and the model details, that will be parsed by model-index.

The markdown files for each model are generated from model templates and the code snippets template, to make it more maintainable. This way, the code examples, which are very similar for all models, are only written once and can be easily updated for all models if the library API changes or new examples are added.

All data is stored in the modelindex folder which contains:

  • models: Auto-generated full model READMEs in markdown format.
  • model-index.yml: The root index file for the model index.
  • .templates: A models folder which contains the model templates and a file code-snippets.md which contains the code examples.

To generate the model-index files from the templates, you just have to run:

python modelindex/generate_readmes.py 

which will generate the READMEs inside modelindex/models.

Adding documentation for a new model can be done by creating a markdown file for the model in modelindex/.templates/models, like modelindex/.templates/models/resnet.md for example, with the summary and details of the model following the model-index format. Additionally, adding {% include 'code_snippets.md' %} will automatically add the code examples when the full README is generated.

@rwightman rwightman merged commit 36a5648 into huggingface:master Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants