mim icon indicating copy to clipboard operation
mim copied to clipboard

download function in openmim.commands.download module cannot find config file

Open fcakyon opened this issue 4 years ago • 4 comments

Hello @zhouzaida, @ZwwWayne ,

steps to reproduce:

  • install mmdet, mmcv-full and mim via pip:
pip install -U mmdet mmcv-full mim==0.1.2
  • or install mmdet via mim:
mim install mmdet
  • then call download function from mim:
from openmim.commands.download import download

download(package="mmdet", configs=['cascade_mask_rcnn_r50_fpn_1x_coco'])

error:

Exception has occurred: ValueError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
[31m[1mlib/python3.8/site-packages/mmdet/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py is not found.[0m
  File "xxx.py", line 79, in download
    raise ValueError(highlighted_error(f"{config_path} is not found."))

reason:

this line creates a config path:

config_path = resource_filename(module_name, config_path)

directing to:

"lib/python3.8/site-packages/mmdet/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py"

but mmdet package doesn't include configs directory in the package so this is a bug that should be fixed.

solution:

add an argument local to download function and when local=False, download config files from mmdetection repo instead of searching in local mmdet package directory.

fcakyon avatar Jun 24 '21 12:06 fcakyon

In fact, the config directory is copied from codebase directory to package directory by mim, so if we install codebase by pip, the config will be not found. Please refer to https://github.com/open-mmlab/mim/blob/main/mim/commands/install.py#L400

zhouzaida avatar Jun 24 '21 13:06 zhouzaida

@zhouzaida install_from_wheel does not handle config directory issue: https://github.com/open-mmlab/mim/blob/1bb17cd47d5573f963542395d0f18c82b6d67710/mim/commands/install.py#L543

and mim install mmdet calls install_from_wheel function: https://github.com/open-mmlab/mim/blob/1bb17cd47d5573f963542395d0f18c82b6d67710/mim/commands/install.py#L217

fcakyon avatar Jun 24 '21 13:06 fcakyon

if we install an openmmlab codebase (exclude mmcv), it will firstly clone the codebase from GitHub and install it. install_from_wheel just handles other packages.

zhouzaida avatar Jun 24 '21 13:06 zhouzaida

The install command of mim will be refactored in the future version

zhouzaida avatar Jun 24 '21 13:06 zhouzaida