Layout-Parser / layout-parser

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

The following command produces an error #143

Open nfeliccia opened 2 years ago

nfeliccia commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Internally producing an invalid argument trying to load config.yaml for the model .

To Reproduce Steps to reproduce the behavior:

  1. What command or script did you run?
    
    from layoutparser.models import Detectron2LayoutModel

model = Detectron2LayoutModel('lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config', extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.5], label_map={0: "Text", 1: "Title", 2: "List", 3: "Table", 4: "Figure"})


**Environment**
1. Please describe your Platform [Windows/MacOS/Linux] - windows 10
3. Please show the Layout Parser version - 
2. You may add addition that may be helpful for locating the problem, such as
    - How you installed PyTorch [e.g., pip, conda, source]
    - Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)

**Error traceback**
If applicable, paste the error traceback here.
Traceback (most recent call last):

File "C:\layoutparserdirty\layout_processor.py", line 3, in model = Detectron2LayoutModel('lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config', File "C:\layoutparserdirty\venv\lib\site-packages\layoutparser\models\detectron2\layoutmodel.py", line 91, in init config_path = PathManager.get_local_path(config_path) File "C:\layoutparserdirty\venv\lib\site-packages\iopath\common\file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, kwargs) File "C:\layoutparserdirty\venv\lib\site-packages\layoutparser\models\detectron2\catalog.py", line 136, in _get_local_path return PathManager.get_local_path(model_url, kwargs) File "C:\layoutparserdirty\venv\lib\site-packages\iopath\common\file_io.py", line 1197, in get_local_path bret = handler._get_local_path(path, force=force, kwargs) File "C:\layoutparserdirty\venv\lib\site-packages\iopath\common\file_io.py", line 794, in _get_local_path with file_lock(cached): File "C:\layoutparserdirty\venv\lib\site-packages\portalocker\utils.py", line 157, in enter return self.acquire() File "C:\layoutparserdirty\venv\lib\site-packages\portalocker\utils.py", line 239, in acquire fh = self._get_fh() File "C:\layoutparserdirty\venv\lib\site-packages\portalocker\utils.py", line 289, in _get_fh return open(self.filename, self.mode, self.file_open_kwargs) OSError: [Errno 22] Invalid argument: 'C:\Users\nfeliccia/.torch/iopath_cache\s/nau5ut6zgthunil\config.yaml?dl=1.lock'



Process finished with exit code 1

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
ArvinderKumar133 commented 1 year ago

OSError: [Errno 22] Invalid argument: 'C:\Users\arvinder.sharma/.torch/iopath_cache\s/nau5ut6zgthunil\config.yaml?dl=1.lock'

I am getting same error. Running this on windows 10. its working in google colab but not in Jupter notebook or when run through flask.

Let me know how to resolve it.

ddekadt commented 2 months ago

Apologies for reviving this, but @nfeliccia and @ArvinderKumar133 did either of you manage to solve this? |

Edit -- found the (workaround) solution here: https://github.com/Layout-Parser/layout-parser/issues/15