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: BentoML config file specification in bentofile.yaml causes filenotfound error when using it containerised #7

Open
hugocool opened this issue Sep 13, 2023 · 2 comments

Comments

@hugocool
Copy link

There is an issue in the specification of the bentofile.yaml file, specifically in the docker section where the env entry is defined. When the BENTOML_CONFIG environment variable is specified in the env entry, the BentoML service fails to start in a Docker container.

Steps to reproduce:
git clone this repo, keep the bentofile.yml as is (so the BENTOML_CONFIG environment variable in the env entry of the bentofile.yaml file is defined as /.config/default.yaml
Build and containerize the BentoML service using the bentoml build and bentoml containerize commands.

ECR_REPO=...
TAG=latest
SERVICE_NAME=transformers-nlp-service-gpu

bentoml build && bentoml containerize "${SERVICE_NAME}" -t "${ECR_REPO}:${TAG}"

Run the Docker container using the docker run command.

docker run --rm -p 3000:3000 "${ECR_REPO}:${TAG}"

Expected behavior:

The BentoML service should start in the Docker container without any issues.

Actual behavior:

The BentoML service fails to start in the Docker container and the following error message is displayed:

Traceback (most recent call last): File "/usr/local/bin/bentoml", line 5, in from bentoml_cli.cli import cli File "/usr/local/lib/python3.9/site-packages/bentoml_cli/cli.py", line 57, in cli = create_bentoml_cli() File "/usr/local/lib/python3.9/site-packages/bentoml_cli/cli.py", line 20, in create_bentoml_cli from bentoml._internal.context import component_context File "/usr/local/lib/python3.9/site-packages/bentoml/init.py", line 25, in load_config() File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/configuration/init.py", line 143, in load_config raise FileNotFoundError( FileNotFoundError: BentoML config file specified in ENV VAR not found: 'BENTOML_CONFIG=./config/default.yaml'

Proposed solution: Update the bentofile.yaml file to remove the env entry and provide instructions on how to set the BENTOML_CONFIG environment variable when running the Docker container.

versions

python 3.9.11
os: ubuntu 24
bentoml 1.1.6

@parano
Copy link
Member

parano commented Sep 13, 2023

Hi @hugocool - could you share your bentofile.yaml? Did you include the ./config/default.yaml file in the include section?

@hugocool
Copy link
Author

this happened right after cloning this exact repo from the main brach.
So the bentofile.yaml is exactly as it is in this repo:

service: 'service.py:svc'
name: transformers-nlp-service
labels:
  owner: bentoml-team
  project: transformers-nlp-service
include:
  - '*.py'
  - '/tests'
  - 'pyproject.toml'
  - '/config'
python:
  requirements_txt: requirements/tests.txt
docker:
  dockerfile_template: ./Dockerfile.template
  system_packages:
    - 'git'
  env:
    BENTOML_CONFIG: ./config/default.yaml

and so if the the ./config/default.yaml file is in the include section in this repo, it was in mine.

I also checked the bentos directory and the /home/ec2-user/bentoml/bentos/transformers-nlp-service-gpu/.../bento.yaml contained:

docker:
  distro: debian
  python_version: '3.9'
  cuda_version: 11.6.2
  env:
    BENTOML_CONFIG: ./config/default.yaml

and the default.yaml was located at:
.../src/config/default.yaml

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