-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Tidy app entrypoint #7668
base: main
Are you sure you want to change the base?
Tidy app entrypoint #7668
Conversation
invokeai/app/util/startup_utils.py
Outdated
|
||
import torch | ||
|
||
from invokeai.backend.util.logging import InvokeAILogger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth inlining this import to the one function that uses it, to prevent this module with the monkeypatch function from loading any more than it strictly needs to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9ba2713
…esponsible for just initializing the FastAPI app. This also gives clearer control over the order of the initialization steps, which will be important as we add planned torch configurations that must be applied before torch is imported.
79f7b8e
to
9fa365f
Compare
…to review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've improved custom node loading in #7698, moving that code to a function instead of running it implicitly as python loads modules.
Maybe should be re-organised per your other changes.
Summary
Prior to this PR, most of the app setup was being done in
api_app.py
at import time. This PR cleans this up, by:api_app.py
file - it just initializes theFastAPI
appThe main motivation for this changes is to make it easier to support an upcoming torch configuration feature that requires more careful ordering of app initialization steps.
Related Issues / Discussions
N/A
QA Instructions
Merge Plan
Checklist
What's New
copy (if doing a release after this PR)