复现结果失败
Closed this issue · 7 comments
Teassassin commented
Teassassin commented
你可以试试回退到上一个commit 最新的代码里我试图拆出一个FPN,但是好像没太成功(
感谢回复。回退之后又出现了新的问题😥,报错如下:
(sam_mmdet) PS D:\__EXPERIMENTS__\sam-with-mmdet> python merge_sam_det.py ./sam_vit_b_01ec64.pth ./rtmdet_l_8xb32-300e_coco_20220719_112030-5a0be7c4.pth ./configs/rtm_l_sam_b.py ./merge.pth
Traceback (most recent call last):
File "D:\__EXPERIMENTS__\sam-with-mmdet\merge_sam_det.py", line 39, in <module>
fire.Fire(merge_sam_det)
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\fire\core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "D:\__EXPERIMENTS__\sam-with-mmdet\merge_sam_det.py", line 14, in merge_sam_det
mm_model = init_detector(config, device='cpu', palette='coco')
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\mmdet\apis\inference.py", line 53, in init_detector
config = Config.fromfile(config)
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\mmengine\config\config.py", line 489, in fromfile
raise e
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\mmengine\config\config.py", line 487, in fromfile
cfg_dict, imported_names = Config._parse_lazy_import(filename)
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\mmengine\config\config.py", line 1037, in _parse_lazy_import
base_modules = Config._get_base_modules(parsed_codes.body)
File "E:\__ENVS__\.conda\Windows\envs\sam_mmdet\lib\site-packages\mmengine\config\config.py", line 574, in _get_base_modules
raise ConfigParsingError(
mmengine.config.utils.ConfigParsingError: The configuration file type in the inheritance chain must match the current configuration file type, either "lazy_import" or non-"lazy_import". You got this error since you use the syntax like `_base_ = "_base_"` in your config. You should use `with read_base(): ... to` mark the inherited config file. See more information in https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html
liuyanyi commented
这个看起来是MMEngine的问题, 在解析config的时候使用了新config格式, 我猜测是config中的import导致的.
方案1是降低mmengine的版本,到没有new config的版本,但是可能mmdet版本也得降
第二种方案是改写成新config, 或者把现在config里的import改掉
Teassassin commented
这个看起来是MMEngine的问题, 在解析config的时候使用了新config格式, 我猜测是config中的import导致的. 方案1是降低mmengine的版本,到没有new config的版本,但是可能mmdet版本也得降 第二种方案是改写成新config, 或者把现在config里的import改掉
好的谢谢,我试一下
Yoow4 commented
@Teassassin 请问这个问题最后是怎么解决的,可以教一下吗
Teassassin commented
@Teassassin 请问这个问题最后是怎么解决的,可以教一下吗
不好意思,我当时对mmdet不熟悉,没解决,后来就没管了。建议手动修改配置文件来适配新版mmengine(作者给出的第二种方案)。
Yoow4 commented
经测试,将rtm_l_sam_b.py文件中的from functools import partial修改成
from mmengine.config import read_base
with read_base():
from functools import partial,后面操作不变即可复现结果