bentoml / BentoML

The easiest way to serve AI apps and models - Build reliable Inference APIs, LLM apps, Multi-model chains, RAG service, and much more!
https://bentoml.com
Apache License 2.0
7.02k stars 781 forks source link

resnet50.ipynb has svc not defined ONNX model does not load #963

Closed quantum-fusion closed 3 years ago

quantum-fusion commented 4 years ago

Describe the bug I executed this Jupyter notebook running locally within Vscode.

https://colab.research.google.com/github/bentoml/gallery/blob/master/onnx/resnet50/resnet50.ipynb

It produces these error messages when executing.

image_data = np.array(image).transpose(2, 0, 1) svc.predict(image_data)

NameError Traceback (most recent call last) in 1 image_data = np.array(image).transpose(2, 0, 1) ----> 2 svc.predict(image_data)

NameError: name 'svc' is not defined

Expected behavior I was expecting the BentoML get OnnxResnet50 to show that the service was loaded, but it is missing.

Screen Shot 2020-08-06 at 9 22 20 AM

Screenshots/Logs If applicable, add screenshots, logs or error outputs to help explain your problem.

Environment:

pip list WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Package Version Location


absl-py 0.9.0 aiohttp 3.6.2 alembic 1.4.2 appnope 0.1.0 asn1crypto 1.4.0 astroid 2.4.2 astunparse 1.6.3 async-timeout 3.0.1 attrs 19.3.0 azure-common 1.1.25 azure-core 1.7.0 azure-storage-blob 12.3.2 backcall 0.2.0 beautifulsoup4 4.9.1 BentoML 0.8.3 boto3 1.14.31 botocore 1.17.31 Bottleneck 1.3.2 cachetools 4.1.1 Cerberus 1.3.2 certifi 2020.6.20 cffi 1.14.1 chardet 3.0.4 click 7.1.2 configparser 5.0.0 cryptography 2.9.2 cycler 0.10.0 decorator 4.4.2 defusedxml 0.6.0 docker 4.2.2 docutils 0.15.2 enum-compat 0.0.3 fastprogress 0.2.3 fire 0.3.1 Flask 1.1.2 future 0.18.2 gast 0.3.3 glob2 0.7 google-api-core 1.22.0 google-api-python-client 1.10.0 google-auth 1.19.2 google-auth-httplib2 0.0.4 google-auth-oauthlib 0.4.1 google-pasta 0.2.0 googleapis-common-protos 1.52.0 graphviz 0.8.4 grpcio 1.30.0 gunicorn 20.0.4 h5py 2.10.0 httplib2 0.18.1 humanfriendly 8.2 idna 2.10 imageio 2.9.0 ipykernel 5.3.4 ipython 7.16.1 ipython-genutils 0.2.0 isodate 0.6.0 isort 4.3.21 itsdangerous 1.1.0 jedi 0.17.2 Jinja2 2.11.2 jmespath 0.10.0 joblib 0.16.0 jupyter-client 6.1.6 jupyter-core 4.6.3 Keras 2.4.3 Keras-Applications 1.0.6 Keras-Preprocessing 1.1.2 keras2onnx 1.7.1 kiwisolver 1.2.0 lazy-object-proxy 1.4.3 Mako 1.1.3 Markdown 3.2.2 MarkupSafe 1.1.1 matplotlib 3.3.0 mccabe 0.6.1 mock 4.0.2 model-archiver 1.0.3 msrest 0.6.18 multi-model-server 1.1.2 multidict 4.7.6 munch 2.5.0 mxnet 1.6.0 mxnet-mkl 1.7.0b20200315 mxnet-model-server 1.0.8 networkx 2.4 numpy 1.18.4 nvidia-ml-py3 7.352.0 oauth2client 4.1.3 oauthlib 3.1.0 onnx 1.7.0 onnxconverter-common 1.7.0 onnxmltools 1.7.0 onnxruntime 1.4.0 opencv-contrib-python 4.3.0.36 opt-einsum 3.2.1 oscrypto 1.2.1 packaging 20.4 pandas 1.0.5 parso 0.7.0 pexpect 4.8.0 pickleshare 0.7.5 Pillow 7.1.2 pip 20.2 ply 3.11 pretrainedmodels 0.7.4 prometheus-client 0.8.0 prompt-toolkit 3.0.5 protobuf 3.12.2 psutil 5.7.2 ptyprocess 0.6.0 py-zipkin 0.20.0 py4j 0.10.9 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycparser 2.20 pycryptodomex 3.9.8 Pygments 2.6.1 PyJWT 1.7.1 pylint 2.5.3 pyOpenSSL 19.1.0 pyparsing 2.4.7 pyserial 3.4 pyspark 3.0.0 python-dateutil 2.8.0 python-editor 1.0.4 python-json-logger 0.1.11 pytz 2020.1 PyYAML 5.3.1 pyzmq 19.0.1 requests 2.24.0 requests-oauthlib 1.3.0 rsa 4.6 ruamel.yaml 0.16.10 ruamel.yaml.clib 0.2.0 s3transfer 0.3.3 scikit-learn 0.23.1 scipy 1.4.1 seaborn 0.10.1 setuptools 48.0.0 six 1.15.0 skl2onnx 1.7.0 sklearn 0.0 snowflake-connector-python 2.2.10 soupsieve 2.0.1 SQLAlchemy 1.3.18 SQLAlchemy-Utils 0.36.8 tabulate 0.8.7 tb-nightly 2.3.0a20200722 tensorboard 2.2.2 tensorboard-plugin-wit 1.7.0 tensorflow 2.2.0 tensorflow-estimator 2.2.0 tensorflow-hub 0.8.0 tensorflow-serving-api 2.2.0 termcolor 1.1.0 test-generator 0.1.1 tf-estimator-nightly 2.4.0.dev2020072301 tf-nightly 2.4.0.dev20200723 tf2onnx 1.7.0 Theano 1.0.4 threadpoolctl 2.1.0 thriftpy2 0.4.11 toml 0.10.1 torch 1.5.0 torchvision 0.6.0 tornado 6.0.4 tqdm 4.48.0 traitlets 4.3.3 typing-extensions 3.7.4.2 uritemplate 3.0.1 urllib3 1.25.9 watermark 2.0.2 /Users/hottelet/venv/src/watermark wcwidth 0.2.5 websocket-client 0.57.0 Werkzeug 1.0.1 wheel 0.34.2 wrapt 1.12.1 yarl 1.5.0

Additional context Add any other context about the problem here.

mkosecki commented 4 years ago

@quantum-fusion Did you execute the below notebook node? It seems like (I mean there is possibility) the enviroment did terminated. I run this in google collab and works like a charm, locally on my Mac also. Does the bug show every time you run the notebook cells enviroment?

from onnx_resnet50 import OnnxResnet50
svc = OnnxResnet50()
svc.pack('labels', labels)
svc.pack('model', 'resnet50v2/resnet50v2.onnx')

saved_path = svc.save()
saved_path
quantum-fusion commented 4 years ago

yes, I executed it, and it fails in both colabs and on MAC. I am wondering if there are some garbage cache files, and I tried deleting them, but to no success.

yubozhao commented 4 years ago

@quantum-fusion I ran the notebook in Colab and locally. I didn't encounter the issue you mentioned. Can you update to the latest BentoML version 0.8.5 and try again?