Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omegaconf.errors.ConfigAttributeError: ListConfig does not support attribute access #44

Open
HoWingYip opened this issue May 12, 2024 · 1 comment

Comments

@HoWingYip
Copy link

HoWingYip commented May 12, 2024

When I try to run inference using APE-Ti, I get the following error:

Traceback (most recent call last):
  File "/home/jupyter/TIL-2024/vlm/train/APE/demo/demo_lazy.py", line 134, in <module>
    demo = VisualizationDemo(cfg, args=args)
  File "/home/jupyter/TIL-2024/vlm/train/APE/demo/predictor_lazy.py", line 138, in __init__
    self.metadata = MetadataCatalog.get(
  File "/home/jupyter/.local/lib/python3.9/site-packages/omegaconf/listconfig.py", line 176, in __getattr__
    self._format_and_raise(
  File "/home/jupyter/.local/lib/python3.9/site-packages/omegaconf/base.py", line 190, in _format_and_raise
    format_and_raise(
  File "/home/jupyter/.local/lib/python3.9/site-packages/omegaconf/_utils.py", line 821, in format_and_raise
    _raise(ex, cause)
  File "/home/jupyter/.local/lib/python3.9/site-packages/omegaconf/_utils.py", line 719, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ConfigAttributeError: ListConfig does not support attribute access
    full_key: dataloader.train[dataset]
    object_type=list

Error occurs on line 138 of demo/predictor_lazy.py when accessing cfg.dataloader.train.dataset.names.
cfg.dataloader.train is a ListConfig of 9 datasets.
When inferring on APE-D, cfg.dataloader.train appears to be a single dataset, and I don't get this error.

The command I run for APE-Ti is:

python3 demo/demo_lazy.py \
--config-file configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitt_eva02_vlf_lsj1024_cp_16x4_1080k_mdl.py \
--input demo/examples/DesertStorm.jpeg \
--output demo/examples_output/DesertStorm.jpeg/ \
--confidence-threshold 0.1 \
--text-prompt 'white fighter jet' \
--with-box \
--opts \
train.init_checkpoint=configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitt_eva02_vlf_lsj1024_cp_16x4_1080k_mdl_20240203_230000/model_final.pth \
model.model_vision.select_box_nums_for_evaluation=500 \
model.model_vision.text_feature_bank_reset=True

For APE-D, I run:

python3 demo/demo_lazy.py \
--config-file configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k.py \
--input demo/examples/DesertStorm.jpeg \
--output demo/examples_output/DesertStorm.jpeg/ \
--confidence-threshold 0.1 \
--text-prompt 'white fighter jet' \
--with-box \
--opts \
train.init_checkpoint=configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitl_eva02_clip_vlf_lsj1024_cp_16x4_1080k_mdl_20230829_162438/model_final.pth \
model.model_vision.select_box_nums_for_evaluation=500 \
model.model_vision.text_feature_bank_reset=True

Any help is appreciated. Thanks.

@shenyunhang
Copy link
Owner

shenyunhang commented May 27, 2024

During inference, do not use the config file that ends with _mdl.py, which is only used during training.

Try to replace

configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitt_eva02_vlf_lsj1024_cp_16x4_1080k_mdl.py 

with

configs/LVISCOCOCOCOSTUFF_O365_OID_VGR_SA1B_REFCOCO_GQA_PhraseCut_Flickr30k/ape_deta/ape_deta_vitt_eva02_vlf_lsj1024_cp_16x4_1080k.py 

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants