Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Error not shown when request via streamlit fails #523

Open
aguschin opened this issue Dec 9, 2022 · 3 comments
Open

Error not shown when request via streamlit fails #523

aguschin opened this issue Dec 9, 2022 · 3 comments
Labels
bug Something isn't working p1-high High priority serve Serving models

Comments

@aguschin
Copy link
Contributor

aguschin commented Dec 9, 2022

    When request via streamlit fails, it prints something like
HTTPError: 500 Server Error: Internal Server Error for url: http://0.0.0.0:8080/predict
Traceback:
File "/Users/aguschin/.local/share/virtualenvs/mlem-Utz6DvOn/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 564, in _run_script
    exec(code, module.__dict__)
File "/private/var/folders/tv/l60j0x050p536g3bh8g2w1n80000gn/T/mlem_streamlit_script_v6wsv2qt/script.py", line 64, in <module>
    response = getattr(client, method_name)(
File "/Users/aguschin/Git/iterative/mlem/mlem/runtime/client.py", line 153, in __call__
    out = self.call_method(self.name, data, return_raw)
File "/Users/aguschin/Git/iterative/mlem/mlem/runtime/client.py", line 201, in _call_method
    ret.raise_for_status()
File "/Users/aguschin/.local/share/virtualenvs/mlem-Utz6DvOn/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

but underneath, FastAPI fails with a different error. This is strange, maybe we eventually will need to either redirect failures, or use MLEM model directly instead of forwarding this to FastAPI, which seems more reasonable to me. For now should work though :)

Originally posted by @aguschin in #512 (comment)

@aguschin aguschin added bug Something isn't working p1-high High priority serve Serving models labels Dec 9, 2022
@aguschin
Copy link
Contributor Author

Hit this again with CV blog post. It happened that for some png images the service https://mlem-cv.fly.dev worked.
Turned out the problem is with the image shapes. Png images that have 0 shape of 4, fails to be processed by the model. E.g.

image

Unfortunately, the real error can be only found out when you use FastAPI or inspect model manually:
image

@mike0sv
Copy link
Contributor

mike0sv commented Jan 20, 2023

We can add an optional shape field to TorchImageSerializer and use it. Or maybe more specific drop_alpha boolean flag?

@mike0sv
Copy link
Contributor

mike0sv commented Jan 20, 2023

It's a separate issue though, nothing to do with streamlit or fastapi

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working p1-high High priority serve Serving models
Projects
None yet
Development

No branches or pull requests

2 participants