2. What exact command you run:
Running above script
3. __Full logs__ or other relevant observations:
Traceback (most recent call last):
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 532, in find_python_name
import(module_name)
ModuleNotFoundError: No module named 'detectron2._cfg_loader1c03'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "front_end/test.py", line 12, in
args = LazyConfig.load(dump_cfg_path)
File "~/lib/python3.7/site-packages/detectron2/config/lazy.py", line 207, in load
obj = yaml.unsafe_load(f)
File "~/lib/python3.7/site-packages/yaml/init.py", line 182, in unsafe_load
return load(stream, UnsafeLoader)
File "~/lib/python3.7/site-packages/yaml/init.py", line 114, in load
return loader.get_single_data()
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 43, in get_single_data
return self.construct_document(node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 52, in construct_document
for dummy in generator:
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 404, in construct_yaml_map
value = self.construct_mapping(node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 210, in construct_mapping
return super().construct_mapping(node, deep=deep)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 135, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 94, in construct_object
data = constructor(self, tag_suffix, node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 551, in construct_python_name
return self.find_python_name(suffix, node.start_mark)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 711, in find_python_name
return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 535, in find_python_name
"cannot find module %r (%s)" % (module_name, exc), mark)
yaml.constructor.ConstructorError: while constructing a Python object
cannot find module 'detectron2._cfg_loader1c03.mask_rcnn_R_50_FPN_100ep_LSJ.py' (No module named 'detectron2._cfg_loader1c03')
in "test_conf.yaml", line 99, column 18
4. please simplify the steps as much as possible so they do not require additional resources to
run, such as a private dataset.
## Expected behavior:
Could load saved lazyconfig without error
## Environment:
Provide your environment information using the following command:
If your issue looks like an installation issue / environment issue,
please first try to solve it yourself with the instructions in
https://detectron2.readthedocs.io/tutorials/install.html#common-installation-issues
This is as expected. Because the config is a python file, there is no way to guarantee the config can be correctly saved to a yaml file since yaml has much more limited syntax.
Instructions To Reproduce the 🐛 Bug:
from detectron2.config import LazyConfig from detectron2 import model_zoo from detectron2.config import LazyConfig, instantiate
model_name="new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ.py"
cfg = LazyConfig.load(model_zoo.get_config_file(model_name)) dump_cfg_path = f'./test_conf.yaml' LazyConfig.save(cfg, dump_cfg_path) args = LazyConfig.load(dump_cfg_path)
Traceback (most recent call last): File "~/lib/python3.7/site-packages/yaml/constructor.py", line 532, in find_python_name import(module_name) ModuleNotFoundError: No module named 'detectron2._cfg_loader1c03'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "front_end/test.py", line 12, in
args = LazyConfig.load(dump_cfg_path)
File "~/lib/python3.7/site-packages/detectron2/config/lazy.py", line 207, in load
obj = yaml.unsafe_load(f)
File "~/lib/python3.7/site-packages/yaml/init.py", line 182, in unsafe_load
return load(stream, UnsafeLoader)
File "~/lib/python3.7/site-packages/yaml/init.py", line 114, in load
return loader.get_single_data()
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 43, in get_single_data
return self.construct_document(node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 52, in construct_document
for dummy in generator:
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 404, in construct_yaml_map
value = self.construct_mapping(node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 210, in construct_mapping
return super().construct_mapping(node, deep=deep)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 135, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 94, in construct_object
data = constructor(self, tag_suffix, node)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 551, in construct_python_name
return self.find_python_name(suffix, node.start_mark)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 711, in find_python_name
return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True)
File "~/lib/python3.7/site-packages/yaml/constructor.py", line 535, in find_python_name
"cannot find module %r (%s)" % (module_name, exc), mark)
yaml.constructor.ConstructorError: while constructing a Python object
cannot find module 'detectron2._cfg_loader1c03.mask_rcnn_R_50_FPN_100ep_LSJ.py' (No module named 'detectron2._cfg_loader1c03')
in "test_conf.yaml", line 99, column 18
sys.platform linux Python 3.7.11 (default, Jul 27 2021, 14:32:16) [GCC 7.5.0] numpy 1.20.1 detectron2 0.5 @~/lib/python3.7/site-packages/detectron2 Compiler GCC 7.3 CUDA compiler CUDA 10.1 detectron2 arch flags 3.7, 5.0, 5.2, 6.0, 6.1, 7.0, 7.5 DETECTRON2_ENV_MODULE
PyTorch 1.7.1+cu101 @~/lib/python3.7/site-packages/torch
PyTorch debug build False
GPU available Yes
GPU 0 GeForce RTX 2080 (arch=7.5)
CUDA_HOME /usr/local/cuda-10.1
Pillow 8.1.0
torchvision 0.8.2+cu101 @~/lib/python3.7/site-packages/torchvision
torchvision arch flags 3.5, 5.0, 6.0, 7.0, 7.5
fvcore 0.1.5.post20210825
iopath 0.1.8
cv2 4.5.1
PyTorch built with: