Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.75k stars 456 forks source link

KeyError: 'Non-existent config key: SOLVER.CLIP_GRADIENTS' when trying to create TableBank model #97

Closed luanpo1234 closed 2 years ago

luanpo1234 commented 2 years ago

I am getting this error when declaring model = lp.Detectron2LayoutModel('lp://TableBank/faster_rcnn_R_101_FPN_3x/config') or any other TableBank or PrimaLayout model.

Traceback (most recent call last):
  File "tester.py", line 149, in <module>
    model = lp.Detectron2LayoutModel('lp://TableBank/faster_rcnn_R_101_FPN_3x/config')
  File "venv\lib\site-packages\layoutparser\models\detectron2\layoutmodel.py", line 101, in __init__
    cfg.merge_from_file(config_path)
  File "venv\lib\site-packages\detectron2\config\config.py", line 45, in merge_from_file
    self.merge_from_other_cfg(loaded_cfg)
  File "venv\lib\site-packages\fvcore\common\config.py", line 123, in merge_from_other_cfg
    return super().merge_from_other_cfg(cfg_other)
  File "venv\lib\site-packages\yacs\config.py", line 217, in merge_from_other_cfg
    _merge_a_into_b(cfg_other, self, self, [])
  File "venv\lib\site-packages\yacs\config.py", line 478, in _merge_a_into_b
    _merge_a_into_b(v, b[k], root, key_list + [k])
  File "venv\lib\site-packages\yacs\config.py", line 491, in _merge_a_into_b
    raise KeyError("Non-existent config key: {}".format(full_key))
KeyError: 'Non-existent config key: SOLVER.CLIP_GRADIENTS'

Can anyone help me there?

lolipopshock commented 2 years ago

I guess you're using an earlier version of Detectron2 -- could you share the version number with me pip show detectron2?

luanpo1234 commented 2 years ago

Thank you for replying, it says Version: 0.1

lolipopshock commented 2 years ago

Yeah I guess that's the cause -- please try to upgrade the version of Detectron2:

pip install "git+https://github.com/facebookresearch/detectron2.git@v0.5#egg=detectron2"

As for GPU machines, you'd like to check the official installation instruction -- https://detectron2.readthedocs.io/en/latest/tutorials/install.html