MCPcopy
hub / github.com/open-mmlab/mmpretrain / get

Method get

mmpretrain/apis/model.py:47–65  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers 15

gen_packages_itemsFunction · 0.80
merge_argsFunction · 0.80
merge_argsFunction · 0.80
mainFunction · 0.80
merge_argsFunction · 0.80
process_checkpointFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
simulate_trainFunction · 0.80

Calls 1

Tested by 15

merge_argsFunction · 0.64
setUpMethod · 0.64
test_predictMethod · 0.64
test_get_modelMethod · 0.64
test_init_modelMethod · 0.64
test_initializeMethod · 0.64
test_get_cat_idsMethod · 0.64
test_reprMethod · 0.64
test_extra_reprMethod · 0.64
test_initializeMethod · 0.64
test_load_data_listMethod · 0.64