Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 0 additions & 12 deletions .pre-commit-config-zh-cn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ repos:
rev: v4.0.0
hooks:
- id: validate_manifest
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://gitee.com/openmmlab/mirrors-isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://gitee.com/openmmlab/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
rev: v5.0.0
hooks:
Expand Down
48 changes: 23 additions & 25 deletions docs/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@

import pytorch_sphinx_theme

sys.path.insert(0, os.path.abspath('../..'))

sys.path.insert(0, os.path.abspath("../.."))

# -- Project information -----------------------------------------------------

project = 'mmengine'
copyright = '2022, mmengine contributors'
author = 'mmengine contributors'
project = "mmengine"
copyright = "2022, mmengine contributors"
author = "mmengine contributors"

version_file = '../../mmengine/version.py'
version_file = "../../mmengine/version.py"
with open(version_file) as f:
exec(compile(f.read(), version_file, 'exec'))
__version__ = locals()['__version__']
exec(compile(f.read(), version_file, "exec"))
__version__ = locals()["__version__"]
# The short X.Y version
version = __version__
# The full version, including alpha/beta/rc tags
Expand All @@ -49,52 +50,49 @@
'sphinx.ext.autodoc.typehints',
'sphinx_tabs.tabs',
] # yapf: disable
autodoc_typehints = 'description'
autodoc_typehints = "description"
myst_heading_anchors = 4
myst_enable_extensions = ['colon_fence']
myst_enable_extensions = ["colon_fence"]

# Configuration for intersphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable', None),
'torch': ('https://pytorch.org/docs/stable/', None),
'mmcv': ('https://mmcv.readthedocs.io/en/2.x/', None),
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable", None),
"torch": ("https://pytorch.org/docs/stable/", None),
"mmcv": ("https://mmcv.readthedocs.io/en/2.x/", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'pytorch_sphinx_theme'
html_theme = "pytorch_sphinx_theme"
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]

html_theme_options = {
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmengine'
},
"menu": [
{"name": "GitHub", "url": "https://github.com/open-mmlab/mmengine"},
],
# Specify the language of shared menu
'menu_lang': 'en',
"menu_lang": "en",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
html_static_path = ["_static"]
html_css_files = ["css/readthedocs.css"]

# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_text = r">>> |\.\.\. "
copybutton_prompt_is_regexp = True
2 changes: 1 addition & 1 deletion docs/resources/config/config_sgd.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
optimizer = dict(type="SGD", lr=0.1, momentum=0.9, weight_decay=0.0001)
8 changes: 4 additions & 4 deletions docs/resources/config/cross_repo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_base_ = [
'mmdet::_base_/schedules/schedule_1x.py',
'mmdet::_base_/datasets/coco_instance.py',
'mmdet::_base_/default_runtime.py',
'mmdet::_base_/models/faster-rcnn_r50_fpn.py',
"mmdet::_base_/schedules/schedule_1x.py",
"mmdet::_base_/datasets/coco_instance.py",
"mmdet::_base_/default_runtime.py",
"mmdet::_base_/models/faster-rcnn_r50_fpn.py",
]
4 changes: 2 additions & 2 deletions docs/resources/config/custom_imports.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
custom_imports = dict(imports=['my_module'], allow_failed_imports=False)
optimizer = dict(type='CustomOptim')
custom_imports = dict(imports=["my_module"], allow_failed_imports=False)
optimizer = dict(type="CustomOptim")
19 changes: 10 additions & 9 deletions docs/resources/config/demo_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@


def parse_args():
parser = argparse.ArgumentParser(description='Train a model')
parser.add_argument('config', help='train config file path')
parser = argparse.ArgumentParser(description="Train a model")
parser.add_argument("config", help="train config file path")
parser.add_argument(
'--cfg-options',
nargs='+',
"--cfg-options",
nargs="+",
action=DictAction,
help='override some settings in the used config, the key-value pair '
'in xxx=yyy format will be merged into config file. If the value to '
help="override some settings in the used config, the key-value pair "
"in xxx=yyy format will be merged into config file. If the value to "
'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
'Note that the quotation marks are necessary and that no white space '
'is allowed.')
"Note that the quotation marks are necessary and that no white space "
"is allowed.",
)

args = parser.parse_args()
return args
Expand All @@ -29,5 +30,5 @@ def main():
print(cfg)


if __name__ == '__main__':
if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions docs/resources/config/example.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
model = dict(type='CustomModel', in_channels=[1, 2, 3])
optimizer = dict(type='SGD', lr=0.01)
model = dict(type="CustomModel", in_channels=[1, 2, 3])
optimizer = dict(type="SGD", lr=0.01)
2 changes: 1 addition & 1 deletion docs/resources/config/learn_read_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
test_int = 1
test_list = [1, 2, 3]
test_dict = dict(key1='value1', key2=0.1)
test_dict = dict(key1="value1", key2=0.1)
2 changes: 1 addition & 1 deletion docs/resources/config/optimizer_cfg.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer = dict(type="SGD", lr=0.02, momentum=0.9, weight_decay=0.0001)
2 changes: 1 addition & 1 deletion docs/resources/config/predefined_var.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
work_dir = './work_dir/{{fileBasenameNoExtension}}'
work_dir = "./work_dir/{{fileBasenameNoExtension}}"
2 changes: 1 addition & 1 deletion docs/resources/config/refer_base_var.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
_base_ = ['resnet50.py']
_base_ = ["resnet50.py"]
a = {{_base_.model}}
6 changes: 3 additions & 3 deletions docs/resources/config/replace_data_root.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dataset_type = 'CocoDataset'
data_root = '{{$DATASET:/data/coco/}}'
dataset = dict(ann_file=data_root + 'train.json')
dataset_type = "CocoDataset"
data_root = "{{$DATASET:/data/coco/}}"
dataset = dict(ann_file=data_root + "train.json")
2 changes: 1 addition & 1 deletion docs/resources/config/replace_num_classes.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
model = dict(bbox_head=dict(num_classes={{'$NUM_CLASSES:80'}}))
model = dict(bbox_head=dict(num_classes={{"$NUM_CLASSES:80"}}))
4 changes: 2 additions & 2 deletions docs/resources/config/resnet50.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
_base_ = ['optimizer_cfg.py']
model = dict(type='ResNet', depth=50)
_base_ = ["optimizer_cfg.py"]
model = dict(type="ResNet", depth=50)
6 changes: 3 additions & 3 deletions docs/resources/config/resnet50_delete_key.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = ['optimizer_cfg.py', 'runtime_cfg.py']
model = dict(type='ResNet', depth=50)
optimizer = dict(_delete_=True, type='SGD', lr=0.01)
_base_ = ["optimizer_cfg.py", "runtime_cfg.py"]
model = dict(type="ResNet", depth=50)
optimizer = dict(_delete_=True, type="SGD", lr=0.01)
4 changes: 2 additions & 2 deletions docs/resources/config/resnet50_lr0.01.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = ['optimizer_cfg.py', 'runtime_cfg.py']
model = dict(type='ResNet', depth=50)
_base_ = ["optimizer_cfg.py", "runtime_cfg.py"]
model = dict(type="ResNet", depth=50)
optimizer = dict(lr=0.01)
4 changes: 2 additions & 2 deletions docs/resources/config/resnet50_runtime.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
_base_ = ['optimizer_cfg.py', 'runtime_cfg.py']
model = dict(type='ResNet', depth=50)
_base_ = ["optimizer_cfg.py", "runtime_cfg.py"]
model = dict(type="ResNet", depth=50)
54 changes: 26 additions & 28 deletions docs/zh_cn/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@

import pytorch_sphinx_theme

sys.path.insert(0, os.path.abspath('../..'))

sys.path.insert(0, os.path.abspath("../.."))

# -- Project information -----------------------------------------------------

project = 'mmengine'
copyright = '2022, mmengine contributors'
author = 'mmengine contributors'
project = "mmengine"
copyright = "2022, mmengine contributors"
author = "mmengine contributors"

version_file = '../../mmengine/version.py'
version_file = "../../mmengine/version.py"
with open(version_file) as f:
exec(compile(f.read(), version_file, 'exec'))
__version__ = locals()['__version__']
exec(compile(f.read(), version_file, "exec"))
__version__ = locals()["__version__"]
# The short X.Y version
version = __version__
# The full version, including alpha/beta/rc tags
Expand All @@ -37,7 +38,7 @@

# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'zh_CN'
language = "zh_CN"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -54,60 +55,57 @@
'sphinx.ext.autodoc.typehints',
'sphinx_tabs.tabs',
] # yapf: disable
autodoc_typehints = 'description'
autodoc_typehints = "description"
myst_heading_anchors = 4
myst_enable_extensions = ['colon_fence']
myst_enable_extensions = ["colon_fence"]

# Configuration for intersphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable', None),
'torch': ('https://pytorch.org/docs/stable/', None),
'mmcv': ('https://mmcv.readthedocs.io/zh_CN/2.x/', None),
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable", None),
"torch": ("https://pytorch.org/docs/stable/", None),
"mmcv": ("https://mmcv.readthedocs.io/zh_CN/2.x/", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'pytorch_sphinx_theme'
html_theme = "pytorch_sphinx_theme"
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]

html_theme_options = {
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmengine'
},
"menu": [
{"name": "GitHub", "url": "https://github.com/open-mmlab/mmengine"},
],
# Specify the language of shared menu
'menu_lang': 'cn',
"menu_lang": "cn",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']
html_static_path = ["_static"]
html_css_files = ["css/readthedocs.css"]

# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_text = r">>> |\.\.\. "
copybutton_prompt_is_regexp = True


def builder_inited_handler(app):
subprocess.run(['./cp_origin_docs.sh'])
subprocess.run(["./cp_origin_docs.sh"])


def setup(app):
app.connect('builder-inited', builder_inited_handler)
app.connect("builder-inited", builder_inited_handler)
Loading