Add model-index files #494
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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
modelindexfolder which contains:models: Auto-generated full model READMEs in markdown format.model-index.yml: The root index file for the model index..templates: Amodelsfolder which contains the model templates and a filecode-snippets.mdwhich contains the code examples.To generate the model-index files from the templates, you just have to run:
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, likemodelindex/.templates/models/resnet.mdfor 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.