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

[BUG] AttributeError: 'ConfigDict' object has no attribute 'test_pipeline' #284

Open
pekopoke opened this issue Feb 22, 2023 · 2 comments
Open

Comments

@pekopoke
Copy link

Thanks for your error report and we appreciate it a lot.

Checklist

  1. I have searched related issues but cannot get the expected help.
  2. I have read the FAQ documentation but cannot get the expected help.
  3. The bug has not been fixed in the latest version(dev-1.x).

Describe the bug

----------------------------- Captured stderr call -----------------------------
  Traceback (most recent call last):
    File "/opt/mmflow/mmengine/mmengine/config/config.py", line 51, in __getattr__
      value = super().__getattr__(name)
    File "/opt/conda/lib/python3.7/site-packages/addict/addict.py", line 67, in __getattr__
      return self.__getitem__(item)
    File "/opt/mmflow/mmengine/mmengine/config/config.py", line 47, in __missing__
      raise KeyError(name)
  KeyError: 'test_pipeline'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/opt/mmflow/demo/image_demo.py", line 50, in <module>
      main(args)
    File "/opt/mmflow/demo/image_demo.py", line 38, in main
      result = inference_model(model, args.img1, args.img2)
    File "/opt/mmflow/mmflow/apis/inference.py", line 91, in inference_model
      cfg.test_pipeline.remove(t)
    File "/opt/mmflow/mmengine/mmengine/config/config.py", line 53, in __getattr__
      raise AttributeError(f"'{self.__class__.__name__}' object has no "AttributeError: 'ConfigDict' object has no attribute 'test_pipeline'

Reproduction

  1. What command or script did you run?

AssertionError: Failed to run image_demo.py

python /opt/mmflow/demo/image_demo.py /opt/mmflow/demo/frame_0001.png /opt/mmflow/demo/frame_0001.png /opt/mmflow/configs/pwcnet/pwcnet_8xb1_slong_flyingchairs-384x448.py pwcnet_8x1_slong_flyingchairs_384x448.pth work_dir

Environment
mmcv 2.0.0rc1
mmflow 1.0.0rc0
mmengine 0.5.0

@LovingThresh
Copy link

In inference.py Line 79 - 82,the cfg is changed and the cfg.test_pipeline is replaced by cfg.pipeline.
if isinstance(cfg.test_dataloader, list): cfg = copy.deepcopy(cfg.test_dataloader[0].dataset) else: cfg = copy.deepcopy(cfg.test_dataloader.dataset)

So, the code will run after changing cfg.test_pipeline.remove(t) to cfg.pipeline.remove(t).

@pekopoke
Copy link
Author

pekopoke commented Mar 9, 2023

In inference.py Line 79 - 82,the cfg is changed and the cfg.test_pipeline is replaced by cfg.pipeline. if isinstance(cfg.test_dataloader, list): cfg = copy.deepcopy(cfg.test_dataloader[0].dataset) else: cfg = copy.deepcopy(cfg.test_dataloader.dataset)

So, the code will run after changing cfg.test_pipeline.remove(t) to cfg.pipeline.remove(t).

Thanks a lot, I run after changing cfg.test_pipeline.remove(t) to cfg.pipeline.remove(t) and successfull solved the problem.
I hope the developer could fix code in the dev-1.x.

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