Skip to content

Commit

Permalink
add mkdocs files
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyang23333 committed Jun 15, 2023
1 parent 9f21985 commit 5ee9ce5
Show file tree
Hide file tree
Showing 34 changed files with 351 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/en/how_to_guides/write_a_new_model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Write A New Model
comming soon.
8 changes: 8 additions & 0 deletions docs/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
hide:
- navigation
- toc
---


{% include-markdown "../../README.md" %}
9 changes: 9 additions & 0 deletions docs/en/modelzoo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
hide:
- navigation
- toc
---

# Model Zoo

{% include-markdown "../../MODEL_ZOO.md" %}
3 changes: 3 additions & 0 deletions docs/en/notes/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Change Log

Coming soon.
3 changes: 3 additions & 0 deletions docs/en/notes/code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of Conduct

Coming soon.
1 change: 1 addition & 0 deletions docs/en/notes/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include-markdown "../../../CONTRIBUTING.md" %}
3 changes: 3 additions & 0 deletions docs/en/notes/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FAQ

Coming soon.
Empty file removed docs/en/readme.md
Empty file.
5 changes: 5 additions & 0 deletions docs/en/reference/data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Data


## comming soon

6 changes: 6 additions & 0 deletions docs/en/reference/loss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Loss


## Loss Factory


5 changes: 5 additions & 0 deletions docs/en/tutorials/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# Configuration

{% include-markdown "../../../tutorials/configuration_CN.md" %}
5 changes: 5 additions & 0 deletions docs/en/tutorials/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# Deployment

{% include-markdown "../../../deploy/README.md" %}
5 changes: 5 additions & 0 deletions docs/en/tutorials/finetune.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# Finetune

{% include-markdown "../../../examples/finetune_SHWD/README.md" %}
7 changes: 7 additions & 0 deletions docs/en/tutorials/modelarts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


# Modelarts

{% include-markdown "../../../tutorials/modelarts.md" %}


6 changes: 6 additions & 0 deletions docs/en/tutorials/quick_start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


# Quick Start


{% include-markdown "../../../GETTING_STARTED.md" %}
Empty file removed docs/en/tutorials/readme.md
Empty file.
59 changes: 59 additions & 0 deletions docs/gen_ref_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Generate the code reference pages of models."""
import os
import sys

sys.path.append(".")

import importlib
import logging
from pathlib import Path

_logger = logging.getLogger('mkdocs')
_langs = ["en", "zh"]


def _gen_page(lang):
full_doc_path = Path(f"docs/{lang}/reference/models.md")
_logger.info(f"Generating reference page: {full_doc_path}")
with open(full_doc_path, "w") as fd:
print("# Models", file=fd)
print("\n\n## Create Model", file=fd)
print("\n### ::: mindyolo.models.model_factory.create_model", file=fd)

for path in sorted(Path("mindyolo/models").rglob("*.py")):
module_path = path.with_suffix("") # eg: mindyolo/models/resnet
parts = list(module_path.parts) # eg: ["mindyolo", "models", "resnet"]
if parts[-1].startswith("__") or parts[-2] == "layers":
continue
# fileter out utility modules
if parts[-1] in ["model_factory", "registry", "utils", "helpers"]:
continue
# filter out the net module which is replaced by the net function with the same name
# TODO: we need to change mechanism of model importing
if parts[-1] in ["googlenet", "inception_v3", "inception_v4", "xception", "pnasnet"]:
continue

try:
print(f"\n\n## {parts[-1]}", file=fd)
identifier = ".".join(parts) # eg: mindyolo.models.resnet
mod = importlib.import_module(identifier)
for mem in sorted(set(mod.__all__)):
print(f"\n### ::: {identifier}.{mem}", file=fd)
except Exception as err:
_logger.warning(f"Cannot generate reference of {identifier}, error: {err}.")


def _del_page(lang):
full_doc_path = Path(f"docs/{lang}/reference/models.md")
_logger.info(f"Cleaning generated reference page: {full_doc_path}")
os.remove(full_doc_path)


def on_startup(command, dirty):
for lang in _langs:
_gen_page(lang)


def on_shutdown():
for lang in _langs:
_del_page(lang)
2 changes: 2 additions & 0 deletions docs/zh/how_to_guides/write_a_new_model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 模型编写指南
即将到来
8 changes: 8 additions & 0 deletions docs/zh/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
hide:
- navigation
- toc
---


{% include-markdown "../../README_CN.md" %}
9 changes: 9 additions & 0 deletions docs/zh/modelzoo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
hide:
- navigation
- toc
---

# 模型仓库

{% include-markdown "../../MODEL_ZOO.md" %}
3 changes: 3 additions & 0 deletions docs/zh/notes/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 更新日志

即将到来
3 changes: 3 additions & 0 deletions docs/zh/notes/code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 行为准则

即将到来
1 change: 1 addition & 0 deletions docs/zh/notes/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include-markdown "../../../CONTRIBUTING.md" %}
3 changes: 3 additions & 0 deletions docs/zh/notes/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 常见问题

即将到来
5 changes: 5 additions & 0 deletions docs/zh/reference/data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Data


## comming soon

7 changes: 7 additions & 0 deletions docs/zh/reference/loss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Loss


## Loss Factory



5 changes: 5 additions & 0 deletions docs/zh/tutorials/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# 配置

{% include-markdown "../../../tutorials/configuration_CN.md" %}
5 changes: 5 additions & 0 deletions docs/zh/tutorials/deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# 部署

{% include-markdown "../../../deploy/README.md" %}
5 changes: 5 additions & 0 deletions docs/zh/tutorials/finetune.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


# 微调

{% include-markdown "../../../examples/finetune_SHWD/README.md" %}
6 changes: 6 additions & 0 deletions docs/zh/tutorials/modelarts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


# 云上启动


{% include-markdown "../../../tutorials/modelarts_CN.md" %}
7 changes: 7 additions & 0 deletions docs/zh/tutorials/quick_start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


# 快速开始


{% include-markdown "../../../GETTING_STARTED_CN.md" %}

Empty file removed docs/zh_cn/readme.md
Empty file.
Empty file removed docs/zh_cn/tutorials/readme.md
Empty file.
155 changes: 155 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
site_name: MindYolo Docs
site_url: https://mindspore-lab.github.io/mindyolo
repo_url: https://github.com/mindspore-lab/mindyolo
repo_name: mindspore-lab/mindyolo
copyright: Copyright © 2022 - 2023 MindSpore Lab

nav:
- Home: index.md
- Benchmark: modelzoo.md
- Tutorials: # Learning Oriented
- Quick Start: tutorials/quick_start.md
- Configuration: tutorials/configuration.md
- Finetune: tutorials/finetune.md
- CloudBrain: tutorials/modelarts.md
- Deployment: tutorials/deployment.md
- How-To Guides: # Problem Oriented
- Write A New Model: how_to_guides/write_a_new_model.md
- Reference:
- data: reference/data.md
# - loss: reference/loss.md
# - models.layers: reference/models.layers.md
- models: reference/models.md
# - optim: reference/optim.md
# - scheduler: reference/scheduler.md
# - utils: reference/utils.md
- Notes:
- Change Log: notes/changelog.md
- Contributing: notes/contributing.md
- Code of Conduct: notes/code_of_conduct.md
- FAQ: notes/faq.md

theme:
name: material
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
primary: black
toggle:
icon: material/weather-sunny
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: black
toggle:
icon: material/weather-night
name: Switch to light mode
features:
# - navigation.instant # see https://github.com/ultrabug/mkdocs-static-i18n/issues/62
- navigation.tracking
- navigation.tabs
- navigation.sections
- navigation.indexes
- navigation.top
- navigation.footer
- toc.follow
- search.highlight
- search.share
- search.suggest
- content.action.view
- content.action.edit
- content.tabs.link
- content.code.copy
- content.code.select
- content.code.annotations

markdown_extensions:
# Officially Supported Extensions
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- meta
- sane_lists
- tables
- toc:
permalink: true
- wikilinks
# Third Party Extensions(Bundles, PyMdown Extensions)
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.details
- pymdownx.highlight
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde

hooks:
- docs/gen_ref_pages.py

plugins:
- search
- include-markdown
- mkdocstrings:
default_handler: python
handlers:
python:
options:
# Headings
show_root_heading: true
show_root_toc_entry: true
show_object_full_path: true
# Members
show_submodules: true
# Docstrings
docstring_section_style: spacy
- i18n:
default_language: en
docs_structure: folder
languages:
en:
name: English
zh:
name: 中文
nav_translations:
zh:
Home: 主页
Installation: 安装
Model Zoo: 模型仓库
Tutorials: 教程
Quick Start: 快速开始
Configuration: 配置
Finetune: 微调
CloudBrain: 云上启动
Deployment: 部署
Notes: 说明
Change Log: 更新日志
Code of Conduct: 行为准则
FAQ: 常见问题
How-To Guides: 指导
Reference: 引用



extra:
generator: false
social:
- icon: fontawesome/solid/paper-plane
link: mailto:mindspore-lab@huawei.com
- icon: fontawesome/brands/github
link: https://github.com/mindspore-lab/mindyolo
- icon: fontawesome/brands/zhihu
link: https://www.zhihu.com/people/mindsporelab

0 comments on commit 5ee9ce5

Please sign in to comment.