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

Load errors with flair should now be generating proper API errors. #121

Merged
merged 2 commits into from
Jun 18, 2021

Conversation

Narsil
Copy link
Contributor

@Narsil Narsil commented Jun 18, 2021

No description provided.

@Narsil Narsil requested a review from osanseviero June 18, 2021 09:25
@@ -37,7 +37,7 @@
}


@functools.cache
@functools.lru_cache()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiangolo only supports 3.8, and that's equivalent.

@@ -1,5 +1,6 @@
import logging
import os
import functools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix style, this is not sorted properly

(I see that the automatic check is not checking this directory. I'll send a PR to fix)

model_id = os.environ["MODEL_ID"]

app.pipeline = get_pipeline(task, model_id)
app.get_pipeline = get_pipeline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need this below? (just as in #123)

try:
        get_pipeline()
    except Exception:
        # We can fail so we can show exception later.
        pass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will help usage a bit, not a strict requirement.

With this, starlette will load the model form the start, without it it will load it when first request hits.
(It's only memory load, it will already be on disk because of prestart.sh)

@Narsil Narsil merged commit 66380b0 into main Jun 18, 2021
@Narsil Narsil deleted the error_avoid_flair branch June 18, 2021 14:52
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

Successfully merging this pull request may close these issues.

None yet

2 participants