bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and more!
https://bentoml.com
Apache License 2.0
7.15k stars 792 forks source link

bug: AttributeError: module 'bentoml' has no attribute 'service'. Did you mean: 'Service'? #4473

Closed rattle99 closed 9 months ago

rattle99 commented 9 months ago

Describe the bug

Just trying out the QuickStart guide from here.

Using the same service.py file as described in the link.

from __future__ import annotations
import bentoml
from transformers import pipeline

EXAMPLE_INPUT = "Breaking News: In an astonishing turn of events, the small \
town of Willow Creek has been taken by storm as local resident Jerry Thompson's cat, \
Whiskers, performed what witnesses are calling a 'miraculous and gravity-defying leap.' \
Eyewitnesses report that Whiskers, an otherwise unremarkable tabby cat, jumped \
a record-breaking 20 feet into the air to catch a fly. The event, which took \
place in Thompson's backyard, is now being investigated by scientists for potential \
breaches in the laws of physics. Local authorities are considering a town festival \
to celebrate what is being hailed as 'The Leap of the Century."

@bentoml.service(
    resources={"cpu": "2"},
    traffic={"timeout": 10},
)
class Summarization:
    def __init__(self) -> None:
        self.pipeline = pipeline('summarization')

    @bentoml.api
    def summarize(self, text: str = EXAMPLE_INPUT) -> str:
        result = self.pipeline(text)
        return result[0]['summary_text']

Upon trying to start the service with bentoml serve service:Summarization I get the error AttributeError: module 'bentoml' has no attribute 'service'. Did you mean: 'Service'?

To reproduce

No response

Expected behavior

No response

Environment

Environment variable

BENTOML_DEBUG=''
BENTOML_QUIET=''
BENTOML_BUNDLE_LOCAL_BUILD=''
BENTOML_DO_NOT_TRACK=''
BENTOML_CONFIG=''
BENTOML_CONFIG_OPTIONS=''
BENTOML_PORT=''
BENTOML_HOST=''
BENTOML_API_WORKERS=''

System information

bentoml: 1.1.11 python: 3.12.1 platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 uid_gid: 1000:1000

pip_packages
``` accelerate==0.26.1 aiohttp==3.9.3 aiosignal==1.3.1 anyio==4.2.0 appdirs==1.4.4 asgiref==3.7.2 asttokens==2.4.1 attrs==23.2.0 bentoml==1.1.11 black==24.1.1 build==1.0.3 cattrs==23.1.2 certifi==2023.11.17 charset-normalizer==3.3.2 circus==0.18.0 click==8.1.7 click-option-group==0.5.6 cloudpickle==3.0.0 comm==0.2.1 contextlib2==21.6.0 debugpy==1.8.0 decorator==5.1.1 deepmerge==1.1.1 Deprecated==1.2.14 executing==2.0.1 filelock==3.13.1 flake8==7.0.0 frozenlist==1.4.1 fs==2.4.16 fsspec==2023.12.2 h11==0.14.0 httpcore==1.0.2 httpx==0.26.0 huggingface-hub==0.20.3 idna==3.6 importlib-metadata==6.11.0 inflection==0.5.1 ipykernel==6.29.0 ipython==8.20.0 ipywidgets==8.1.1 isort==5.13.2 jedi==0.19.1 Jinja2==3.1.3 jupyter_client==8.6.0 jupyter_core==5.7.1 jupyterlab-widgets==3.0.9 markdown-it-py==3.0.0 MarkupSafe==2.1.4 matplotlib-inline==0.1.6 mccabe==0.7.0 mdurl==0.1.2 mpmath==1.3.0 multidict==6.0.4 mypy-extensions==1.0.0 nest-asyncio==1.6.0 networkx==3.2.1 numpy==1.26.3 nvidia-cublas-cu12==12.1.3.1 nvidia-cuda-cupti-cu12==12.1.105 nvidia-cuda-nvrtc-cu12==12.1.105 nvidia-cuda-runtime-cu12==12.1.105 nvidia-cudnn-cu12==8.9.2.26 nvidia-cufft-cu12==11.0.2.54 nvidia-curand-cu12==10.3.2.106 nvidia-cusolver-cu12==11.4.5.107 nvidia-cusparse-cu12==12.1.0.106 nvidia-ml-py==11.525.150 nvidia-nccl-cu12==2.19.3 nvidia-nvjitlink-cu12==12.3.101 nvidia-nvtx-cu12==12.1.105 opentelemetry-api==1.20.0 opentelemetry-instrumentation==0.41b0 opentelemetry-instrumentation-aiohttp-client==0.41b0 opentelemetry-instrumentation-asgi==0.41b0 opentelemetry-sdk==1.20.0 opentelemetry-semantic-conventions==0.41b0 opentelemetry-util-http==0.41b0 packaging==23.2 parso==0.8.3 pathspec==0.12.1 peft==0.8.1 pexpect==4.9.0 pip-requirements-parser==32.0.1 pip-tools==7.3.0 platformdirs==4.2.0 prometheus-client==0.19.0 prompt-toolkit==3.0.43 psutil==5.9.8 ptyprocess==0.7.0 pure-eval==0.2.2 pycodestyle==2.11.1 pyflakes==3.2.0 Pygments==2.17.2 pyparsing==3.1.1 pyproject_hooks==1.0.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-multipart==0.0.6 PyYAML==6.0.1 pyzmq==25.1.2 regex==2023.12.25 requests==2.31.0 rich==13.7.0 safetensors==0.4.2 schema==0.7.5 setuptools==69.0.3 simple-di==0.1.5 six==1.16.0 sniffio==1.3.0 stack-data==0.6.3 starlette==0.36.1 sympy==1.12 tokenizers==0.15.1 torch==2.2.0 tornado==6.4 tqdm==4.66.1 traitlets==5.14.1 transformers==4.37.2 triton==2.2.0 typing_extensions==4.9.0 urllib3==2.1.0 uvicorn==0.27.0.post1 watchfiles==0.21.0 wcwidth==0.2.13 wheel==0.42.0 widgetsnbextension==4.0.9 wrapt==1.16.0 yarl==1.9.4 zipp==3.17.0 ```
frostming commented 9 months ago

Sorry, the documentation goes ahead. We just released version 1.2. Please upgrade BentoML and try again.