Added the option to wait for model & tokenizer in lmql.model.serve - #15
Merged
Conversation
… the model server
Collaborator
|
Thanks, looks good. I would test and then merge this PR. Just a quick heads up, the core team has decided to relicense LMQL under the Apache 2.0 license, do you agree with merging your changes under this updated license. Let me know. |
Author
|
I've tested this locally, and it works well. I have a python script that hosts the model using POpen and queries the model once the server is running. Without the option, the script errors out on Timeout, after turning the option on, the script properly waits until both the model and tokenizer are running and no longer errors out. I also agree to merging the changes under the updated license. Once this is approved I can merge it. |
Collaborator
|
Thanks, I could just test the fix. Works great. Merging this, thanks a lot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the model starts up and runs the server while the model and tokenizer are loading.
The client cannot tell when the model & tokenizer are ready, so they could send requests during this period. However, since models often take a long time to load, if the client sends a request during this period, they get a timeout, and an exception is raised.
A simple solution to this is to add an optional flag that tells the model server not to run until after the model and tokenizer are loaded. That way the client can know not to send requests while the model is loading (since the port is not open)
In some use cases where a python script wants to host a model and query inference, having this optional flag would be really convenient.
Since this is an optional flag, it doesn't change the current behavior at all, but just provides the option to people who want to use it.