RGen is a utility package designed to simplify the process of creating README files for your machine learning models packaged with Cog and published on Replicate.
You can install RGen directly from its GitHub repository using pip:
pip install git+https://github.com/joehoover/rgen.git
To use the default Cog and Replicate README templates, you can just:
- Build a README yaml from the default Cog and Replicate README templates.
rgen extract
-
Fill out the fields in
readme.yaml
. -
Run
rgen generate
RGen provides a command-line interface to generate README files. It follows a two-step process:
- Extract: This operation reads the provided README templates, identifies the fields that need to be filled, and writes these fields into a readme.yaml file. If readme.yaml already exists, it will not be overwritten.
rgen extract --template1 path_or_url_to_readme_template1 --template2 path_or_url_to_readme_template2
By default, rgen uses cog_readme_template.md and replicate_readme_template.md for template1 and template2 respectively.
- Generate. This operation reads the readme.yaml file and populates the fields in the README templates. The populated README files are then written to the disk.
rgen generate --template1 path_or_url_to_readme_template1 --template2 path_or_url_to_readme_template2
readme.yaml
is a YAML file that holds the values for the fields that need to be filled in the README templates. After running rgen extract
, you should edit readme.yaml
to provide appropriate values for the fields.
For multi-line values in YAML, you can use the |
character for literal block scalars or the >
character for folded block scalars. For example:
multi_line: |
line 1
line 2
line 3
or
folded_multi_line: >
line 1
line 2
line 3