mim
mim copied to clipboard
use site-packages/${project}/.mim/config as the base config
Describe the feature I would like to be able to specify the config under .mim as the base config and run it as shown below.
_base_ = [
'site-packages/mmcls/.mim/config/_base_/models/resnet18_cifar.py',
'site-packages/mmcls/.mim/config/_base_/datasets/cifar10_bs16.py',
'site-packages/mmcls/.mim/config/_base_/schedules/cifar10_bs128.py',
'site-packages/mmcls/.mim/config/_base_/default_runtime.py'
]
Motivation When specifying the config in the repo as the base config, I find it inconvenient that I need to either download it locally by git clone or copy the config to be used itself under .mim.
Additional context The following part of mmcv is the load part of the base config. I think it is possible to load the config from .mim by changing this part, is this the proper way? https://github.com/open-mmlab/mmcv/blob/76cfd77b3a88ce17508471bf335829eb0628abcf/mmcv/utils/config.py#L239-L269
Is this the proper way to do it, or is there a way to complete it with a .mim repo?
related: https://github.com/open-mmlab/mmdetection/issues/4481
Hi, it is a great idea. In fact, mmcv also supports loading base config with an absolute path.
if BASE_KEY in cfg_dict:
cfg_dir = osp.dirname(filename)
base_filename = cfg_dict.pop(BASE_KEY)
base_filename = base_filename if isinstance(
base_filename, list) else [base_filename]
cfg_dict_list = list()
cfg_text_list = list()
for f in base_filename:
_cfg_dict, _cfg_text = Config._file2dict(osp.join(cfg_dir, f))
cfg_dict_list.append(_cfg_dict)
cfg_text_list.append(_cfg_text)
https://github.com/open-mmlab/mmcv/blob/76cfd77b3a88ce17508471bf335829eb0628abcf/mmcv/utils/config.py#L248
If the f
is an absolute path, the osp.join(cfg_dir, f)
will return the f
without concatenating the cfg_dir
However, I think it is slightly inconvenient that the path of site-packages changes depending on the environment.
Totally agree, but we need an elegant way to implement this feature.
Hi~ We recently did an architectural upgrade and released MMEngine
, and we suggest to use Config in MMEngine
. It can load config from other repos like this:
_base_ = [
'mmdet::_base_/schedules/schedule_1x.py',
'mmdet::_base_/datasets/coco_instance.py',
'mmdet::_base_/default_runtime.py',
'mmdet::_base_/models/faster_rcnn_r50_fpn.py',
]
Cool! Thank you for your great effort:)