I followed this document to try the bentoml. But I got an error when I requesting the API.
2023-07-09T12:50:52+0800 [ERROR] [api_server:stable-diffusion-21:7] Exception on /txt2img [POST] (trace=9ce85de98d9f14dc6460de87d68bb264,span=d3be66fffcf39617,sampled=0,service.name=stable-diffusion-21)
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/bentoml/_internal/server/http_app.py", line 341, in api_func
output = await api.func(*args)
^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/t7/code/bentoml/service.py", line 11, in txt2img
kwargs = input_data.dict()
^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'dict'
```requested
### To reproduce
1. Install bentoml: `pip install bentoml`
2. Create the import_model.py
```python
import bentoml
bentoml.diffusers.import_model(
"sd2.1", # model tag in BentoML model store
"stabilityai/stable-diffusion-2-1", # huggingface model name
)
Run pip3 install --upgrade diffusers transformers accelerate and python import_model.py
Describe the bug
I followed this document to try the bentoml. But I got an error when I requesting the API.
pip3 install --upgrade diffusers transformers accelerate
andpython import_model.py
bento_model = bentoml.diffusers.get("sd2.1:latest") sd21_runner = bento_model.to_runner(name="sd21-runner")
svc = bentoml.Service("stable-diffusion-21", runners=[sd21_runner])
@svc.api(input=JSON(), output=Image()) async def txt2img(input_data): kwargs = input_data.dict() res = await sd21_runner.async_run(**kwargs) images = res[0] return images[0]
Expected behavior
The server can handle this request and start creating the image with the prompt.
But I got an error:
I also tried it with post man and it still is not work.
Environment
bentoml:
python:
OS: