r"""Loads model from github or gitlab repo, with pretrained weights. Args: 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. Eg: ``"brain_sdk/MegBrain[:hub]"``
(
repo_info: str,
entry: str,
*args,
git_host: str = DEFAULT_GIT_HOST,
use_cache: bool = True,
commit: str = None,
protocol: str = DEFAULT_PROTOCOL,
**kwargs
)
| 147 | |
| 148 | |
| 149 | def load( |
| 150 | repo_info: str, |
| 151 | entry: str, |
| 152 | *args, |
| 153 | git_host: str = DEFAULT_GIT_HOST, |
| 154 | use_cache: bool = True, |
| 155 | commit: str = None, |
| 156 | protocol: str = DEFAULT_PROTOCOL, |
| 157 | **kwargs |
| 158 | ) -> Any: |
| 159 | r"""Loads model from github or gitlab repo, with pretrained weights. |
| 160 | |
| 161 | Args: |
| 162 | repo_info: a string with format ``"repo_owner/repo_name[:tag_name/:branch_name]"`` with an optional |
| 163 | tag/branch. The default branch is ``master`` if not specified. Eg: ``"brain_sdk/MegBrain[:hub]"`` |
| 164 | entry: an entrypoint defined in hubconf. |
| 165 | git_host: host address of git repo. Eg: github.com |
| 166 | use_cache: whether to use locally cached code or completely re-fetch. |
| 167 | commit: commit id on github or gitlab. |
| 168 | protocol: which protocol to use to get the repo, and HTTPS protocol only supports public repo on github. |
| 169 | The value should be one of HTTPS, SSH. |
| 170 | |
| 171 | Returns: |
| 172 | a single model with corresponding pretrained weights. |
| 173 | """ |
| 174 | hubmodule = _init_hub(repo_info, git_host, use_cache, commit, protocol) |
| 175 | |
| 176 | if not hasattr(hubmodule, entry) or not callable(getattr(hubmodule, entry)): |
| 177 | raise RuntimeError("Cannot find callable {} in hubconf.py".format(entry)) |
| 178 | |
| 179 | _check_dependencies(hubmodule) |
| 180 | |
| 181 | module = getattr(hubmodule, entry)(*args, **kwargs) |
| 182 | return module |
| 183 | |
| 184 | |
| 185 | def help( |
no test coverage detected