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

Can't test the docker containers as is #5

Open
MayStepanyan opened this issue Sep 5, 2023 · 7 comments
Open

Can't test the docker containers as is #5

MayStepanyan opened this issue Sep 5, 2023 · 7 comments

Comments

@MayStepanyan
Copy link

Hi.

I run the command from README:

docker run --gpus all -p 3000:3000 ghcr.io/bentoml/ocr-as-a-service:gpu

and after pulling it throws an error:

FileNotFoundError: BentoML config file specified in ENV VAR not found: 'BENTOML_CONFIG=./config/default.yaml'

I've tried to create a dummy config with this content:

version: 1
api_server:
  workers: 4

which results in another error:

2023-09-05T07:20:23+0000 [ERROR] [cli] Failed to download https://layoutlm.blob.core.windows.net/dit/dit-fts/publaynet_dit-b_cascade.pth
Traceback (most recent call last):
  File "/usr/local/bin/bentoml", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bentoml_cli/utils.py", line 334, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bentoml_cli/utils.py", line 305, in wrapper
    return_value = func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bentoml_cli/utils.py", line 262, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bentoml_cli/env_manager.py", line 122, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bentoml_cli/serve.py", line 218, in serve
    serve_http_production(
  File "/usr/local/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/usr/local/lib/python3.9/site-packages/bentoml/serve.py", line 266, in serve_http_production
    svc = load(bento_identifier, working_dir=working_dir)
  File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 328, in load
    svc = load_bento_dir(bento_path, standalone_load=standalone_load)
  File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 236, in load_bento_dir
    return _load_bento(bento, standalone_load)
  File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 246, in _load_bento
    svc = import_service(
  File "/usr/local/lib/python3.9/site-packages/simple_di/__init__.py", line 139, in _
    return func(*_inject_args(bind.args), **_inject_kwargs(bind.kwargs))
  File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/service/loader.py", line 137, in import_service
    module = importlib.import_module(module_name, package=working_dir)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/bentoml/bento/src/service.py", line 12, in <module>
    from warmup import convert_pdf_to_images
  File "/home/bentoml/bento/src/warmup.py", line 121, in <module>
    predictor = dit.get_predictor(cfg)
  File "/home/bentoml/bento/src/dit/__init__.py", line 38, in get_predictor
    return DefaultPredictor(get_cfg(cfg))
  File "/usr/local/lib/python3.9/site-packages/detectron2/engine/defaults.py", line 288, in __init__
    checkpointer.load(cfg.MODEL.WEIGHTS)
  File "/usr/local/lib/python3.9/site-packages/detectron2/checkpoint/detection_checkpoint.py", line 61, in load
    path = self.path_manager.get_local_path(path)
  File "/usr/local/lib/python3.9/site-packages/iopath/common/file_io.py", line 1197, in get_local_path
    bret = handler._get_local_path(path, force=force, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/iopath/common/file_io.py", line 797, in _get_local_path
    cached = download(path, dirname, filename=filename)
  File "/usr/local/lib/python3.9/site-packages/iopath/common/download.py", line 58, in download
    tmp, _ = request.urlretrieve(url, filename=tmp, reporthook=hook(t))
  File "/usr/local/lib/python3.9/urllib/request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 409: Public access is not permitted on this storage account.

Same issues is with cpu docker image.

I suspect the config file should include some credentials I don't have access to. How can I fix this issue to test the service?

@MayStepanyan
Copy link
Author

Update: tried the install version too, throws the same exception with HTTP Error 409

@aarnphm
Copy link
Collaborator

aarnphm commented Sep 11, 2023

@jianshen92 can you help take a look with this?

@alejones
Copy link

I'm running into the same issue. Any suggestions on how to get it working?

@MayStepanyan
Copy link
Author

MayStepanyan commented Oct 24, 2023

@alejones yes, I fixed this.

Turns out publayanet link in dit/__init__.py/get_cfg(), line 26 is not working. We

  1. Found a new link and downloaded the weights locally under the name "publaynet_dit-b_cascade.pth" (we just added a suffix to the link as mentioned here)

  2. changed the mentioned line of code to cfg.MODEL.WEIGHTS = ("publaynet_dit-b_cascade.pth") to reuse the same file and not download it on every run again

  3. Mounted the weights file when running the script with docker

It works just fine.

@jianshen92
Copy link
Contributor

@alejones yes, I fixed this.

Turns out publayanet link in dit/__init__.py/get_cfg(), line 26 is not working. We

  1. Found a new link and downloaded the weights locally under the name "publaynet_dit-b_cascade.pth" (we just added a suffix to the link as mentioned here)

  2. changed the mentioned line of code to cfg.MODEL.WEIGHTS = ("publaynet_dit-b_cascade.pth")

  3. Mounted the weights file when running the script with docker

It works just fine.

Hey @MayStepanyan ! Thanks for checking it out! Would be very helpful to the team if you could raise a PR for this fix!

@skytodmoon
Copy link

mark, I met the same problem

@skytodmoon
Copy link

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

5 participants