Browse Source

docs(mge/hub): refine docstring in hub module

GitOrigin-RevId: 2f73c1242b
tags/v0.4.0
Megvii Engine Team Xinran Xu 5 years ago
parent
commit
429cca8e2b
3 changed files with 15 additions and 14 deletions
  1. +6
    -6
      python_module/megengine/hub/fetcher.py
  2. +6
    -5
      python_module/megengine/hub/hub.py
  3. +3
    -3
      python_module/megengine/hub/tools.py

+ 6
- 6
python_module/megengine/hub/fetcher.py View File

@@ -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


+ 6
- 5
python_module/megengine/hub/hub.py View File

@@ -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



+ 3
- 3
python_module/megengine/hub/tools.py View File

@@ -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
"""


Loading…
Cancel
Save