clamsproject / app-slate-textdetection

Apache License 2.0
0 stars 0 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'fasterrcnn_resnet50_fpn.pth' #1

Closed afred closed 1 year ago

afred commented 1 year ago

To replicate

following the README I ran...

$ docker build -t clams-slatetext .
$ docker run -p 5001:5000 -v data:/data clams-slatetext
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Downloading: "https://download.pytorch.org/models/fasterrcnn_resnet50_fpn_coco-258fb6c6.pth" to /root/.cache/torch/hub/checkpoints/fasterrcnn_resnet50_fpn_coco-258fb6c6.pth
100.0%
Traceback (most recent call last):
  File "app.py", line 94, in <module>
    td_tool = Slate_TD()
  File "app.py", line 20, in __init__
    self.model.load_state_dict(torch.load('fasterrcnn_resnet50_fpn.pth', map_location=torch.device('cpu')))
  File "/usr/local/lib/python3.8/site-packages/torch/serialization.py", line 579, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/usr/local/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/usr/local/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'fasterrcnn_resnet50_fpn.pth'

I tried replacing "fasterrcnn_resnet50_fpn.pth" on line 20 of app.py with "fasterrcnn_resnet50_fpn_coco-258fb6c6.pth" as indicated in the "dowloading..." message, but it results in

No such file or directory: 'fasterrcnn_resnet50_fpn_coco-258fb6c6.pth'

... so I'm not sure where this file is expected to be.

marcverhagen commented 1 year ago

I get the same error. Also, I think the README file needs some updates.

Kelley, can we look at this if you are in on Thursday?

afred commented 1 year ago

@marcverhagen do you mean the host port vs container port in the -p option of docker compose? I think those need to be reversed, yeah?

kelleyl commented 1 year ago

The model file is too big to put on GitHub so that is what is causing the issue. I think in the past I pushed the image with the model to docker hub, but the version there is out of date now. The app does need to be updated for sdk changes and I should have that done by tomorrow.

On Tue, Feb 28, 2023 at 4:49 PM Andrew Myers @.***> wrote:

@marcverhagen https://github.com/marcverhagen do you mean the host port vs container port? I think those need to be reversed, yeah?

— Reply to this email directly, view it on GitHub https://github.com/clamsproject/app-slate-textdetection/issues/1#issuecomment-1448969637, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEAKHFU3ZNITD3FXPUT5OJ3WZZXGNANCNFSM6AAAAAAVJ3XQWU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

marcverhagen commented 1 year ago

@marcverhagen do you mean the host port vs container port in the -p option of docker compose? I think those need to be reversed, yeah?

No, I think the port is correct. Typically with one app you end up doing 5000:5000.

It is the input MMIF that seems to be an old version.

afred commented 1 year ago

Right, but I think it's docker run -p [host port]:5000 ... rather than docker run -p 5000:[host port]

keighrim commented 1 year ago

Closing issue as stale.