From 429cca8e2b6da8d4de4a8314096d3f0ce20960f2 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 6 May 2020 11:28:10 +0800 Subject: [PATCH] docs(mge/hub): refine docstring in hub module GitOrigin-RevId: 2f73c1242b0c377c14cb05f2d24fe3ddbef9da27 --- python_module/megengine/hub/fetcher.py | 12 ++++++------ python_module/megengine/hub/hub.py | 11 ++++++----- python_module/megengine/hub/tools.py | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/python_module/megengine/hub/fetcher.py b/python_module/megengine/hub/fetcher.py index 408a79dcf..dfbfb0e7e 100644 --- a/python_module/megengine/hub/fetcher.py +++ b/python_module/megengine/hub/fetcher.py @@ -102,17 +102,17 @@ class GitSSHFetcher(RepoFetcherBase): silent: bool = True, ) -> str: """ - Fetch git repo by SSH protocol + Fetches git repo by SSH protocol :param git_host: - host address of git repo - dxample: github.com + host address of git repo. + example: github.com :param repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional tag/branch. The default branch is ``master`` if not specified. - dxample: ``"brain_sdk/MegBrain[:hub]"`` + example: ``"brain_sdk/MegBrain[:hub]"`` :param use_cache: - whether to use locally cached code or completely re-fetch + whether to use locally fetched code or completely re-fetch :param commit: commit id on github or gitlab :param silent: @@ -215,7 +215,7 @@ class GitHTTPSFetcher(RepoFetcherBase): silent: bool = True, ) -> str: """ - Fetch git repo by HTTPS protocol + Fetches git repo by HTTPS protocol :param git_host: host address of git repo diff --git a/python_module/megengine/hub/hub.py b/python_module/megengine/hub/hub.py index c7c654dd2..5342cd8e5 100644 --- a/python_module/megengine/hub/hub.py +++ b/python_module/megengine/hub/hub.py @@ -94,7 +94,7 @@ def _init_hub( commit: str = None, protocol: str = DEFAULT_PROTOCOL, ): - """Import hubmodule like python import + """Imports hubmodule like python import :param repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional @@ -137,7 +137,7 @@ def list( commit: str = None, protocol: str = DEFAULT_PROTOCOL, ) -> List[str]: - """List all entrypoints available in repo hubconf + """Lists all entrypoints available in repo hubconf :param repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional @@ -175,7 +175,7 @@ def load( protocol: str = DEFAULT_PROTOCOL, **kwargs ) -> Any: - """Load model from github or gitlab repo, with pretrained weights. + """Loads model from github or gitlab repo, with pretrained weights. :param repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional @@ -250,7 +250,7 @@ def help( def load_serialized_obj_from_url(url: str, model_dir=None) -> Any: - """Loads MegEngine serialized object at the given URL. + """Loads MegEngine serialized object from the given URL. If the object is already present in ``model_dir``, it's deserialized and returned. If no ``model_dir`` is specified, it will be ``MGE_HOME/serialized``. @@ -291,7 +291,8 @@ def load_serialized_obj_from_url(url: str, model_dir=None) -> Any: class pretrained: - r"""Decorator helps quick link model function to existing pretrained weights. + r""" + Decorator which helps to download pretrained weights from the given url. For example, we can decorate a resnet18 function as follows diff --git a/python_module/megengine/hub/tools.py b/python_module/megengine/hub/tools.py index 60a70b3cc..0bf9c98c7 100644 --- a/python_module/megengine/hub/tools.py +++ b/python_module/megengine/hub/tools.py @@ -15,7 +15,7 @@ from typing import Iterator def load_module(name: str, path: str) -> types.ModuleType: """ - Load module specified by name and path + Loads module specified by name and path :param name: module name :param path: module path @@ -27,7 +27,7 @@ def load_module(name: str, path: str) -> types.ModuleType: def check_module_exists(module: str) -> bool: - """Check python module exist or not + """Checks whether python module exists or not :param module: name of module """ @@ -36,7 +36,7 @@ def check_module_exists(module: str) -> bool: @contextmanager def cd(target: str) -> Iterator[None]: - """Change current directory to target + """Changes current directory to target :param target: target directory """ -- GitLab