diff --git a/docs/assets/images/model-parallelism.png b/docs/assets/images/model-parallelism.png new file mode 100644 index 00000000..45543956 Binary files /dev/null and b/docs/assets/images/model-parallelism.png differ diff --git a/docs/assets/templates/python/material/class.html b/docs/assets/templates/python/material/class.html new file mode 100644 index 00000000..ab982e5a --- /dev/null +++ b/docs/assets/templates/python/material/class.html @@ -0,0 +1,127 @@ +
+{% with html_id = class.path %} + + {% if config.only_parameters or config.only_class_level %} + + {% with docstring_sections = class.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + + {% if config.merge_init_into_class %} + {% if "__init__" in class.members and class.members["__init__"].has_docstring %} + {% with docstring_sections = class.members["__init__"].docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + {% endif %} + {% endif %} + + {% else %} + + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} + + {% if not root or config.show_root_heading %} + + {% filter heading(heading_level, + role="class", + id=html_id, + class="doc doc-heading", + toc_label=class.name) %} + + {% if config.separate_signature %} + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} + {% elif config.merge_init_into_class and "__init__" in class.members -%} + {%- with function = class.members["__init__"] -%} + {%- filter highlight(language="python", inline=True) -%} + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} + {%- include "signature.html" with context -%} + {%- endfilter -%} + {%- endwith -%} + {% else %} + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} + {% endif %} + + {% with labels = class.labels %} + {% include "labels.html" with context %} + {% endwith %} + + {% endfilter %} + + {% if config.separate_signature and config.merge_init_into_class %} + {% if "__init__" in class.members %} + {% with function = class.members["__init__"] %} + {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %} + {% if show_full_path %}{{ class.path }}{% else %}{{ class.name }}{% endif %} + {% endfilter %} + {% endwith %} + {% endif %} + {% endif %} + + {% else %} + {% if config.show_root_toc_entry %} + {% filter heading(heading_level, + role="class", + id=html_id, + toc_label=class.path if config.show_root_full_path else class.name, + hidden=True) %} + {% endfilter %} + {% endif %} + {% set heading_level = heading_level - 1 %} + {% endif %} + +
+ {% if config.show_bases and class.bases %} +

+ Bases: {% for expression in class.bases -%} + {% include "expression.html" with context %}{% if not loop.last %}, {% endif %} + {% endfor -%} +

+ {% endif %} + + {% with docstring_sections = class.docstring.parsed %} + {% with is_merged_init = True %} + {% include "docstring.html" with context %} + {% endwith %} + {% endwith %} + + {% if config.merge_init_into_class %} + {% if "__init__" in class.members and class.members["__init__"].has_docstring %} + {% with docstring_sections = class.members["__init__"].docstring.parsed, is_merged_init = True %} + {% include "docstring.html" with context %} + {% endwith %} + {% endif %} + {% endif %} + + {% if config.show_source %} + {% if config.merge_init_into_class %} + {% if "__init__" in class.members and class.members["__init__"].source %} +
+ Source code in {{ class.relative_filepath }} + {{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }} +
+ {% endif %} + {% elif class.source %} +
+ Source code in {{ class.relative_filepath }} + {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }} +
+ {% endif %} + {% endif %} + + {% with obj = class %} + {% set root = False %} + {% set heading_level = heading_level + 1 %} + {% include "children.html" with context %} + {% endwith %} +
+ {% endif %} + +{% endwith %} +
diff --git a/docs/assets/templates/python/material/docstring.html b/docs/assets/templates/python/material/docstring.html new file mode 100644 index 00000000..c67ef633 --- /dev/null +++ b/docs/assets/templates/python/material/docstring.html @@ -0,0 +1,34 @@ +{% if docstring_sections %} + {{ log.debug("Rendering docstring") }} + {% for section in docstring_sections %} + {% if not config.only_parameters %} + {% if section.kind.value == "text" %} + {{ section.value|convert_markdown(heading_level, html_id) }} + {% elif section.kind.value == "attributes" %} + {% include "docstring/attributes.html" with context %} + {% elif section.kind.value == "parameters" %} + {% include "docstring/parameters.html" with context %} + {% elif section.kind.value == "other parameters" %} + {% include "docstring/other_parameters.html" with context %} + {% elif section.kind.value == "raises" %} + {% include "docstring/raises.html" with context %} + {% elif section.kind.value == "warns" %} + {% include "docstring/warns.html" with context %} + {% elif section.kind.value == "yields" %} + {% include "docstring/yields.html" with context %} + {% elif section.kind.value == "receives" %} + {% include "docstring/receives.html" with context %} + {% elif section.kind.value == "returns" %} + {% include "docstring/returns.html" with context %} + {% elif section.kind.value == "examples" %} + {% include "docstring/examples.html" with context %} + {% elif section.kind.value == "admonition" %} + {% include "docstring/admonition.html" with context %} + {% endif %} + {% elif section.kind.value == "parameters" %} + {% include "docstring/parameters.html" with context %} + {% elif section.kind.value == "attributes" %} + {% include "docstring/attributes.html" with context %} + {% endif %} + {% endfor %} +{% endif %} diff --git a/docs/assets/templates/python/material/docstring/examples.html b/docs/assets/templates/python/material/docstring/examples.html new file mode 100644 index 00000000..cc5371d6 --- /dev/null +++ b/docs/assets/templates/python/material/docstring/examples.html @@ -0,0 +1,8 @@ +{{ "# Examples\n"|convert_markdown(heading_level, html_id) }} +{% for section_type, sub_section in section.value %} + {% if section_type.value == "text" %} + {{ sub_section|convert_markdown(heading_level, html_id) }} + {% elif section_type.value == "examples" %} + {{ sub_section|highlight(language="pycon", linenums=False) }} + {% endif %} +{% endfor %} diff --git a/docs/assets/templates/python/material/docstring/parameters.html b/docs/assets/templates/python/material/docstring/parameters.html new file mode 100644 index 00000000..7df6fddf --- /dev/null +++ b/docs/assets/templates/python/material/docstring/parameters.html @@ -0,0 +1,105 @@ +{{ log.debug("Rendering parameters section") }} +{% if is_merged_init %} + {{ "# Parameters\n"|convert_markdown(heading_level, html_id) }} +{% endif %} +{% if config.docstring_section_style == "table" %} + {% block table_style %} +

{{ section.title or "Parameters:" }}

+ + + + + + + + + + + {% for parameter in section.value %} + {% if not config.only_parameters or parameter.name not in ("nlp", "name", "vocab", "scorer") %} + + + + + + + {% endif %} + {% endfor %} + +
NameTypeDescriptionDefault
{{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + {{ parameter.description|convert_markdown(heading_level, html_id) }} + {% if parameter.default %} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% else %} + required + {% endif %} +
+ {% endblock table_style %} +{% elif config.docstring_section_style == "list" %} + {% block list_style %} +

{{ section.title or "Parameters:" }}

+ + {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style %} + + + + + + + + + {% for parameter in section.value %} + {% if not config.only_parameters or parameter.name not in ("nlp", "name", "vocab", "scorer") %} + + + + + {% endif %} + {% endfor %} + +
{{ (section.title or "PARAMETER").rstrip(":").upper() }}DESCRIPTION
{{ parameter.name }} + {{ parameter.description|convert_markdown(heading_level, html_id) }} +

+ {% if parameter.annotation %} + + TYPE: + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} + {% if parameter.default %} + + DEFAULT: + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +

+
+ {% endblock spacy_style %} +{% endif %} diff --git a/docs/assets/templates/python/material/function.html b/docs/assets/templates/python/material/function.html new file mode 100644 index 00000000..54fa6fac --- /dev/null +++ b/docs/assets/templates/python/material/function.html @@ -0,0 +1,74 @@ +{{ log.debug("Rendering " + function.path) }} + +
+{% with html_id = function.path %} + + {% if root %} + {% set show_full_path = config.show_root_full_path %} + {% set root_members = True %} + {% elif root_members %} + {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %} + {% set root_members = False %} + {% else %} + {% set show_full_path = config.show_object_full_path %} + {% endif %} + + {% if not root or config.show_root_heading %} + + {% filter heading(heading_level, + role="function", + id=html_id, + class="doc doc-heading", + toc_label=function.name ~ "()") %} + + {% if config.separate_signature %} + {% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %} + {% else %} + {% filter highlight(language="python", inline=True) %} + {% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %} + {% include "signature.html" with context %} + {% endfilter %} + {% endif %} + + {% with labels = function.labels %} + {% include "labels.html" with context %} + {% endwith %} + + {% endfilter %} + + {% if config.separate_signature %} + {% filter highlight(language="python", inline=False) %} + {% filter format_signature(config.line_length) %} + {% if show_full_path %}{{ function.path }}{% else %}{{ function.name }}{% endif %} + {% include "signature.html" with context %} + {% endfilter %} + {% endfilter %} + {% endif %} + + {% else %} + {% if config.show_root_toc_entry %} + {% filter heading(heading_level, + role="function", + id=html_id, + toc_label=function.path if config.show_root_full_path else function.name, + hidden=True) %} + {% endfilter %} + {% endif %} + {% set heading_level = heading_level - 1 %} + {% endif %} + +
+ {% with docstring_sections = function.docstring.parsed %} + {% include "docstring.html" with context %} + {% endwith %} + + {% if not config.only_parameters and config.show_source and function.source %} +
+ Source code in {{ function.relative_filepath }} + {{ function.source|highlight(language="python", linestart=function.lineno, linenums=True) }} +
+ {% endif %} +
+ +{% endwith %} +