Get the model's metainfo by the model name. Args: model_name (str): The name of model. Returns: modelindex.models.Model: The metainfo of the specified model.
(cls, model_name)
| 45 | |
| 46 | @classmethod |
| 47 | def get(cls, model_name): |
| 48 | """Get the model's metainfo by the model name. |
| 49 | |
| 50 | Args: |
| 51 | model_name (str): The name of model. |
| 52 | |
| 53 | Returns: |
| 54 | modelindex.models.Model: The metainfo of the specified model. |
| 55 | """ |
| 56 | cls._register_mmpretrain_models() |
| 57 | # lazy load config |
| 58 | metainfo = copy.deepcopy(cls._models_dict.get(model_name.lower())) |
| 59 | if metainfo is None: |
| 60 | raise ValueError( |
| 61 | f'Failed to find model "{model_name}". please use ' |
| 62 | '`mmpretrain.list_models` to get all available names.') |
| 63 | if isinstance(metainfo.config, str): |
| 64 | metainfo.config = Config.fromfile(metainfo.config) |
| 65 | return metainfo |
| 66 | |
| 67 | @staticmethod |
| 68 | def _expand_config_path(metainfo: Model, |