Skip to content

Commit 9de0a67

Browse files
committed
Add documentation for models
1 parent e2bcaa3 commit 9de0a67

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

docs/mkdocs_macros.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from collections import defaultdict
2+
3+
from helm.proxy.models import ALL_MODELS
4+
5+
6+
def define_env(env):
7+
@env.macro
8+
def models_by_organization():
9+
result = defaultdict(list)
10+
for model in ALL_MODELS:
11+
result[model.creator_organization].append(model)
12+
if "Simple" in result:
13+
del result["Simple"]
14+
return result
15+
16+
@env.macro
17+
def render_model_tags(model):
18+
return ", ".join([f"`{tag}`" for tag in model.tags])

docs/models.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Models
2+
3+
{% for organization, models in models_by_organization().items() %}
4+
5+
## {{ organization }}
6+
7+
{% for model in models %}
8+
9+
### {{ model.display_name }}
10+
11+
- Name: `{{ model.name }}`
12+
- Group: `{{ model.group }}`
13+
- Tags: {{ render_model_tags(model) }}
14+
15+
{{ model.description }}
16+
17+
{% endfor %}
18+
{% endfor %}

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mkdocs==1.4.2
22
mkdocstrings[python]==0.19.0
3+
mkdocs-macros-plugin==0.7.0

mkdocs.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ theme:
55
highlightjs: false
66
plugins:
77
- search
8+
- macros:
9+
module_name: docs/mkdocs_macros
810
- mkdocstrings:
9-
handlers:
10-
python:
11-
show_root_heading: true
12-
show_signature_annotations: true
13-
show_bases: false
14-
show_source: false
11+
handlers:
12+
python:
13+
show_root_heading: true
14+
show_signature_annotations: true
15+
show_bases: false
16+
show_source: false
1517
extra_css:
1618
- docstrings.css
1719
markdown_extensions:

0 commit comments

Comments
 (0)