r"""This function returns docstring of entrypoint ``entry`` by following steps: 1. Pull the repo code specified by git and repo_info. 2. Load the entry defined in repo's hubconf.py 3. Return docstring of function entry. Args: repo_info: a string with format ``"repo_owner/re
(
repo_info: str,
entry: str,
git_host: str = DEFAULT_GIT_HOST,
use_cache: bool = True,
commit: str = None,
protocol: str = DEFAULT_PROTOCOL,
)
| 183 | |
| 184 | |
| 185 | def help( |
| 186 | repo_info: str, |
| 187 | entry: str, |
| 188 | git_host: str = DEFAULT_GIT_HOST, |
| 189 | use_cache: bool = True, |
| 190 | commit: str = None, |
| 191 | protocol: str = DEFAULT_PROTOCOL, |
| 192 | ) -> str: |
| 193 | r"""This function returns docstring of entrypoint ``entry`` by following steps: |
| 194 | |
| 195 | 1. Pull the repo code specified by git and repo_info. |
| 196 | 2. Load the entry defined in repo's hubconf.py |
| 197 | 3. Return docstring of function entry. |
| 198 | |
| 199 | Args: |
| 200 | repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional |
| 201 | tag/branch. The default branch is ``master`` if not specified. Eg: ``"brain_sdk/MegBrain[:hub]"`` |
| 202 | entry: an entrypoint defined in hubconf.py |
| 203 | git_host: host address of git repo. Eg: github.com |
| 204 | use_cache: whether to use locally cached code or completely re-fetch. |
| 205 | commit: commit id on github or gitlab. |
| 206 | protocol: which protocol to use to get the repo, and HTTPS protocol only supports public repo on github. |
| 207 | The value should be one of HTTPS, SSH. |
| 208 | |
| 209 | Returns: |
| 210 | docstring of entrypoint ``entry``. |
| 211 | """ |
| 212 | hubmodule = _init_hub(repo_info, git_host, use_cache, commit, protocol) |
| 213 | |
| 214 | if not hasattr(hubmodule, entry) or not callable(getattr(hubmodule, entry)): |
| 215 | raise RuntimeError("Cannot find callable {} in hubconf.py".format(entry)) |
| 216 | |
| 217 | doc = getattr(hubmodule, entry).__doc__ |
| 218 | return doc |
| 219 | |
| 220 | |
| 221 | def load_serialized_obj_from_url(url: str, model_dir=None) -> Any: |