-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: preloading of machine learning models #7540
feat: preloading of machine learning models #7540
Conversation
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.
Thanks for working on this! I think this can be simplified a lot. It should be good after the changes I mention in the comments.
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.
Great job! Just a few minor comments.
If you'd like, you can also change the env to the PRELOAD__CLIP=['model-name']
style based on this.
Based on the suggestions I implemented a pydantic config that parses:
which seems like the least error-prone solution. As I mentioned in a comment above, this limits the env to storing a single model per type but it seems perfect for our use case as there shouldn't be more than one of each type as far as I know. |
Oh, that's a good point! I don't see a use-case for loading multiple of a model type. |
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.
Awesome stuff :)
Thanks a lot for the detailed review and comments :) |
The formatting checks can be a bit strict haha. Running |
Yeah, good lesson on running these types of checks before pushing though |
In response to this discussion
Implements additional step of preloading select models at the start of the machine-learning process into memory permanently.
Models can be selected by changing the environment variable, for example:
MACHINE_LEARNING_PRELOAD="CLIP:ViT-B-32__openai,FACIAL_RECOGNITION:buffalo_s"